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)[源代码]

基类: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()[源代码]

Start with max health.

at_attacked(attacker, **kwargs)[源代码]

Called when being attacked and combat starts.

ai_next_action(**kwargs)[源代码]

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

exception DoesNotExist

基类:evennia.objects.objects.DefaultCharacter.DoesNotExist

exception MultipleObjectsReturned

基类:evennia.objects.objects.DefaultCharacter.MultipleObjectsReturned

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

基类: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)[源代码]

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

classmethod create(key, account=None, **kwargs)[源代码]

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

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

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

关键字参数
  • 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.

返回

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)[源代码]

Called by the talk command when another entity addresses us.

参数
  • 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.

提示

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

exception DoesNotExist

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.DoesNotExist

exception MultipleObjectsReturned

基类: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)[源代码]

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)[源代码]

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC

An NPC that acts as a dispenser of quests.

exception DoesNotExist

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC.DoesNotExist

exception MultipleObjectsReturned

基类: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)[源代码]

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC

ShopKeeper NPC.

upsell_factor

AttributeProperty.

miser_factor

AttributeProperty.

common_ware_prototypes

AttributeProperty.

at_damage(damage, attacker=None)[源代码]

Immortal - we don’t deduct any damage here.

exception DoesNotExist

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureTalkativeNPC.DoesNotExist

exception MultipleObjectsReturned

基类: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)[源代码]

基类: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[源代码]
ai_idle()[源代码]

Do nothing.

ai_combat()[源代码]

Manage the combat/combat state of the mob.

ai_roam()[源代码]

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

ai_flee()[源代码]

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()[源代码]

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

exception DoesNotExist

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.DoesNotExist

exception MultipleObjectsReturned

基类:evennia.contrib.tutorials.evadventure.npcs.EvAdventureNPC.MultipleObjectsReturned

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