evennia.contrib.tutorials.evadventure.npcs

EvAdventure NPCs. This includes both friends and enemies, only separated by their AI.

class evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC(*args, **kwargs)[source]

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

This is the base class for all non-player entities, including monsters. These generally don’t advance in level but uses a simplified, abstract measure of how dangerous or competent they are - the ‘hit dice’ (HD).

HD indicates how much health they have and how hard they hit. In _Knave_, HD also defaults to being the bonus for all abilities. HP is 4 x Hit die (this can then be customized per-entity of course).

Morale is set explicitly per-NPC, usually between 7 and 9.

Monsters don’t use equipment in the way PCs do, instead they have a fixed armor value, and their Abilities are dynamically generated from the HD (hit_dice).

If wanting monsters or NPCs that can level and work the same as PCs, base them off the EvAdventureCharacter class instead.

The weapon of the npc is stored as an Attribute instead of implementing a full inventory/equipment system. This means that the normal inventory can be used for non-combat purposes (or for loot to get when killing an enemy).

is_pc = False
hit_dice

AttributeProperty.

armor

AttributeProperty.

morale

AttributeProperty.

hp_multiplier

AttributeProperty.

hp

AttributeProperty.

allegiance

AttributeProperty.

is_idle

AttributeProperty.

weapon

AttributeProperty.

coins

AttributeProperty.

group

Tag Property.

property strength
property dexterity
property constitution
property intelligence
property wisdom
property charisma
property hp_max
at_object_creation()[source]

Start with max health.

at_attacked(attacker, **kwargs)[source]

Called when being attacked and combat starts.

ai_next_action(**kwargs)[source]

The combat engine should ask this method in order to get the next action the npc should perform in combat.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultCharacter.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultCharacter.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC'
typename = 'EvAdventureNPC'
class evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC(*args, **kwargs)[source]

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC

Talkative NPCs can be addressed by talk [to] <npc>. This opens a chat menu with communication options. The menu is created with the npc and we override the .create to allow passing in the menu nodes.

menudata

AttributeProperty.

menu_kwargs

AttributeProperty.

hi_text

AttributeProperty.

at_damage(damage, attacker=None)[source]

Talkative NPCs are generally immortal (we don’t deduct HP here by default).”

classmethod create(key, account=None, **kwargs)[source]

Overriding the creation of the NPC, allowing some extra **kwargs.

Parameters
  • key (str) – Name of the new object.

  • account (Account, optional) – Account to attribute this object to.

Keyword Arguments
  • description (str) – Brief description for this object (same as default Evennia)

  • ip (str) – IP address of creator (for object auditing) (same as default Evennia).

  • menudata (dict or str) – The menudata argument to EvMenu. This is either a dict of {“nodename”: <node_callable>,…} or the python-path to a module containing such nodes (see EvMenu docs). This will be used to generate the chat menu chat menu for the character that talks to the NPC (which means the at_talk hook is called (by our custom talk command).

  • menu_kwargs (dict) – This will be passed as **kwargs into EvMenu when it is created. Make sure this dict can be pickled to an Attribute.

Returns

tuple(new_character, errors). On error, the new_character is None and errors is a list of error strings (an empty list otherwise).

at_talk(talker, startnode='node_start', session=None, **kwargs)[source]

Called by the talk command when another entity addresses us.

Parameters
  • talker (Object) – The one talking to us.

  • startnode (str, optional) – Allows to start in a different location in the menu tree. The given node must exist in the tree.

  • session (Session, optional) – The talker’s current session, allows for routing correctly in multi-session modes.

  • **kwargs – This will be passed into the EvMenu creation and appended and menu_kwargs given to the NPC at creation.

Notes

We pass npc=self into the EvMenu for easy back-reference. This will appear in the **kwargs of the start node.

exception DoesNotExist

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC'
typename = 'EvAdventureTalkativeNPC'
evennia.contrib.tutorials.evadventure.npcs.node_start(caller, raw_string, **kwargs)[source]

This is the intended start menu node for the Talkative NPC interface. It will use on-npc Attributes to build its message and will also pick its options based on nodes named node_start_* are available in the node tree.

class evennia.contrib.tutorials.evadventure.npcs.EvAdventureQuestGiver(*args, **kwargs)[source]

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC

An NPC that acts as a dispenser of quests.

exception DoesNotExist

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.npcs.EvAdventureQuestGiver'
typename = 'EvAdventureQuestGiver'
class evennia.contrib.tutorials.evadventure.npcs.EvAdventureShopKeeper(*args, **kwargs)[source]

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC

ShopKeeper NPC.

upsell_factor

AttributeProperty.

miser_factor

AttributeProperty.

common_ware_prototypes

AttributeProperty.

at_damage(damage, attacker=None)[source]

Immortal - we don’t deduct any damage here.

exception DoesNotExist

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.npcs.EvAdventureShopKeeper'
typename = 'EvAdventureShopKeeper'
class evennia.contrib.tutorials.evadventure.npcs.EvAdventureMob(*args, **kwargs)[source]

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC

Mob (mobile) NPC; this is usually an enemy.

combat_probabilities = {'attack': 0.85, 'flee': 0.05, 'hold': 0.0, 'item': 0.0, 'stunt': 0.05}
ai[source]
ai_idle()[source]

Do nothing.

ai_combat()[source]

Manage the combat/combat state of the mob.

ai_roam()[source]

roam, moving randomly to a new room. If a target is found, switch to combat state.

ai_flee()[source]

Flee from the current room, avoiding going back to the room from which we came. If no exits are found, switch to roam state.

at_defeat()[source]

Mobs die right away when defeated, no death-table rolls.

exception DoesNotExist

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.npcs.EvAdventureMob'
typename = 'EvAdventureMob'