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(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ Bases:
enum.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'¶
-
-
class
evennia.contrib.tutorials.evadventure.enums.WieldLocation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ Bases:
enum.EnumWield (or wear) locations.
-
BACKPACK= 'backpack'¶
-
WEAPON_HAND= 'weapon_hand'¶
-
SHIELD_HAND= 'shield_hand'¶
-
TWO_HANDS= 'two_handed_weapons'¶
-
BODY= 'body'¶
-
HEAD= 'head'¶
-
-
class
evennia.contrib.tutorials.evadventure.enums.ObjType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ Bases:
enum.EnumObject types
-
WEAPON= 'weapon'¶
-
ARMOR= 'armor'¶
-
SHIELD= 'shield'¶
-
HELMET= 'helmet'¶
-
CONSUMABLE= 'consumable'¶
-
GEAR= 'gear'¶
-
MAGIC= 'magic'¶
-
QUEST= 'quest'¶
-
TREASURE= 'treasure'¶
-