Skip to content

Instantly share code, notes, and snippets.

@KinoAR
Created July 9, 2021 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KinoAR/cc3274572a39da95b771358672a11edf to your computer and use it in GitHub Desktop.
Save KinoAR/cc3274572a39da95b771358672a11edf to your computer and use it in GitHub Desktop.
Advanced Enum Example
/**
* 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