Created
July 9, 2021 00:26
-
-
Save KinoAR/cc3274572a39da95b771358672a11edf to your computer and use it in GitHub Desktop.
Advanced Enum Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ADTs take in a parameter as you can see here. | |
*/ | |
enum ElementalAtk { | |
FireAtk(?dmg:Int); | |
WaterAtk(?dmg:Int); | |
LightningAtk(?dmg:Int); | |
MagnetoAtk(?dmg:Int); | |
IceAtk(?dmg:Int); | |
WindAtk(?dmg:Int); | |
PhysAtk(?dmg:Int); | |
} | |
/** | |
* Elemental Resistances. | |
* Elemental resistance of 100 means you will not be affected by the | |
* status effect, thus making it impossible to be caught on fire. | |
* | |
*/ | |
enum ElementalResistances { | |
FireRes(?res:Float); // question mark means you don't have to enter the elemental resistance Float | |
WaterRes(?res:Float); | |
IceRes(?res:Float); | |
MagneticRes(?res:Float); | |
LightningRes(?res:Float); | |
WindRes(?res:Float); | |
PhysRes(?res:Float); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment