evennia.contrib.tutorials.evadventure.characters

Character class.

class evennia.contrib.tutorials.evadventure.characters.LivingMixin[source]

Bases: object

Mixin class to use for all living things.

is_pc = False
property hurt_level

String describing how hurt this character is.

heal(hp, healer=None)[source]

Heal by a certain amount of HP.

at_attacked(attacker, **kwargs)[source]

Called when being attacked / combat starts.

at_damage(damage, attacker=None)[source]

Called when attacked and taking damage.

at_defeat()[source]

Called when this living thing reaches HP 0.

at_death()[source]

Called when this living thing dies.

at_pay(amount)[source]

Get coins, but no more than we actually have.

at_looted(looter)[source]

Called when being looted (after defeat).

Parameters

looter (Object) – The one doing the looting.

pre_loot(defeated_enemy)[source]

Called just before looting an enemy.

Parameters

defeated_enemy (Object) – The enemy soon to loot.

Returns

bool – If False, no looting is allowed.

at_do_loot(defeated_enemy)[source]

Called when looting another entity.

Parameters

defeated_enemy – The thing to loot.

post_loot(defeated_enemy)[source]

Called just after having looted an enemy.

Parameters

defeated_enemy (Object) – The enemy just looted.

class evennia.contrib.tutorials.evadventure.characters.EvAdventureCharacter(*args, **kwargs)[source]

Bases: evennia.contrib.tutorials.evadventure.characters.LivingMixin, evennia.objects.objects.DefaultCharacter

A Character for use with EvAdventure.

is_pc = True
strength

AttributeProperty.

dexterity

AttributeProperty.

constitution

AttributeProperty.

intelligence

AttributeProperty.

wisdom

AttributeProperty.

charisma

AttributeProperty.

hp

AttributeProperty.

hp_max

AttributeProperty.

level

AttributeProperty.

coins

AttributeProperty.

xp

AttributeProperty.

xp_per_level = 1000
equipment[source]

Allows to access equipment like char.equipment.worn

quests[source]

Access and track quests

property weapon
property armor
at_pre_object_receive(moved_object, source_location, **kwargs)[source]

Hook called by Evennia before moving an object here. Return False to abort move.

Parameters
  • moved_object (Object) – Object to move into this one (that is, into inventory).

  • source_location (Object) – Source location moved from.

  • **kwargs – Passed from move operation; the move_type is useful; if someone is giving us something (move_type==’give’) we want to ask first.

Returns

bool – If move should be allowed or not.

at_object_receive(moved_object, source_location, **kwargs)[source]

Hook called by Evennia as an object is moved here. We make sure it’s added to the equipment handler.

Parameters
  • moved_object (Object) – Object to move into this one (that is, into inventory).

  • source_location (Object) – Source location moved from.

  • **kwargs – Passed from move operation; unused here.

at_pre_object_leave(leaving_object, destination, **kwargs)[source]

Hook called when dropping an item. We don’t allow to drop wielded/worn items (need to unwield/remove them first). Return False to

at_object_leave(moved_object, destination, **kwargs)[source]

Called just before an object leaves from inside this object

Parameters
  • moved_obj (Object) – The object leaving

  • destination (Object) – Where moved_obj is going.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_defeat()[source]

This happens when character drops <= 0 HP. For Characters, this means rolling on the death table.

at_death()[source]

Called when character dies.

at_pre_loot()[source]

Called before allowing to loot. Return False to block enemy looting.

at_looted(looter)[source]

Called when being looted.

add_xp(xp)[source]

Add new XP.

Parameters

xp (int) – The amount of gained XP.

Returns

bool – If a new level was reached or not.

Notes

level 1 -> 2 = 1000 XP level 2 -> 3 = 2000 XP etc

level_up(*abilities)[source]

Perform the level-up action.

Parameters

*abilities (str) – A set of abilities (like ‘strength’, ‘dexterity’ (normally 3) to upgrade by 1. Max is usually +10.

Notes

We block increases above a certain value, but we don’t raise an error here, that will need to be done earlier, when the user selects the ability to increase.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultCharacter.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultCharacter.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.characters.EvAdventureCharacter'
typename = 'EvAdventureCharacter'
evennia.contrib.tutorials.evadventure.characters.get_character_sheet(character)[source]

Generate a character sheet. This is grouped in a class in order to make it easier to override the look of the sheet.