evennia.contrib.tutorials.evadventure.enums¶
Enums are constants representing different things in EvAdventure. The advantage of using an Enum over, say, a string is that if you make a typo using an unknown enum, Python will give you an error while a typo in a string may go through silently.
It’s used as a direct reference:
from enums import Ability
if abi is Ability.STR:
# ...
To get the value of an enum (must always be hashable, useful for Attribute lookups), use Ability.STR.value (which would return ‘strength’ in our case).
- class evennia.contrib.tutorials.evadventure.enums.Ability(*values)[source]¶
Bases:
EnumThe six base abilities (defense is always bonus + 10)
- STR = 'strength'¶
- DEX = 'dexterity'¶
- CON = 'constitution'¶
- INT = 'intelligence'¶
- WIS = 'wisdom'¶
- CHA = 'charisma'¶
- ARMOR = 'armor'¶
- CRITICAL_FAILURE = 'critical_failure'¶
- CRITICAL_SUCCESS = 'critical_success'¶
- ALLEGIANCE_HOSTILE = 'hostile'¶
- ALLEGIANCE_NEUTRAL = 'neutral'¶
- ALLEGIANCE_FRIENDLY = 'friendly'¶