evennia.contrib.tutorials.evadventure.combat_twitch

EvAdventure Twitch-based combat

This implements a ‘twitch’ (aka DIKU or other traditional muds) style of MUD combat.


class evennia.contrib.tutorials.evadventure.combat_twitch.EvAdventureCombatTwitchHandler(*args, **kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.combat_base.EvAdventureCombatBaseHandler

This is created on the combatant when combat starts. It tracks only the combatants side of the combat and handles when the next action will happen.

action_classes = {'attack': <class 'evennia.contrib.tutorials.evadventure.combat_base.CombatActionAttack'>, 'hold': <class 'evennia.contrib.tutorials.evadventure.combat_base.CombatActionHold'>, 'stunt': <class 'evennia.contrib.tutorials.evadventure.combat_base.CombatActionStunt'>, 'use': <class 'evennia.contrib.tutorials.evadventure.combat_base.CombatActionUseItem'>, 'wield': <class 'evennia.contrib.tutorials.evadventure.combat_base.CombatActionWield'>}
advantage_against

AttributeProperty.

disadvantage_against

AttributeProperty.

action_dict

AttributeProperty.

fallback_action_dict

AttributeProperty.

current_ticker_ref

AttributeProperty.

msg(message, broadcast=True, **kwargs)[源代码]

Central place for sending messages to combatants. This allows for adding any combat-specific text-decoration in one place.

参数
  • message (str) – The message to send.

  • combatant (Object) – The ‘You’ in the message, if any.

  • broadcast (bool) – If False, combatant must be included and will be the only one to see the message. If True, send to everyone in the location.

  • location (Object, optional) – If given, use this as the location to send broadcast messages to. If not, use self.obj as that location.

提示

If combatant is given, use $You/you() markup to create a message that looks different depending on who sees it. Use $You(combatant_key) to refer to other combatants.

at_init()[源代码]

Called when the Script is cached in the idmapper. This is usually more reliable than overriding __init__ since the latter can be called at unexpected times.

get_sides(combatant)[源代码]

Get a listing of the two ‘sides’ of this combat, from the perspective of the provided combatant. The sides don’t need to be balanced.

参数

combatant (Character or NPC) – The one whose sides are to determined.

返回

tuple

A tuple of lists (allies, enemies), from the perspective of combatant.

Note that combatant itself is not included in either of these.

give_advantage(recipient, target)[源代码]

Let a benefiter gain advantage against the target.

参数
  • recipient (Character or NPC) – The one to gain the advantage. This may or may not be the same entity that creates the advantage in the first place.

  • target (Character or NPC) – The one against which the target gains advantage. This could (in principle) be the same as the benefiter (e.g. gaining advantage on some future boost)

give_disadvantage(recipient, target)[源代码]

Let an affected party gain disadvantage against a target.

参数
  • recipient (Character or NPC) – The one to get the disadvantage.

  • target (Character or NPC) – The one against which the target gains disadvantage, usually an enemy.

has_advantage(combatant, target)[源代码]

Check if a given combatant has advantage against a target.

参数
  • combatant (Character or NPC) – The one to check if they have advantage

  • target (Character or NPC) – The target to check advantage against.

has_disadvantage(combatant, target)[源代码]

Check if a given combatant has disadvantage against a target.

参数
  • combatant (Character or NPC) – The one to check if they have disadvantage

  • target (Character or NPC) – The target to check disadvantage against.

queue_action(action_dict, combatant=None)[源代码]

Schedule the next action to fire.

参数
  • action_dict (dict) – The new action-dict to initialize.

  • combatant – Unused.

execute_next_action()[源代码]

Triggered after a delay by the command

check_stop_combat()[源代码]

Check if the combat is over.

stop_combat()[源代码]

Stop combat immediately.

exception DoesNotExist

基类:evennia.contrib.tutorials.evadventure.combat_base.EvAdventureCombatBaseHandler.DoesNotExist

exception MultipleObjectsReturned

基类:evennia.contrib.tutorials.evadventure.combat_base.EvAdventureCombatBaseHandler.MultipleObjectsReturned

path = 'evennia.contrib.tutorials.evadventure.combat_twitch.EvAdventureCombatTwitchHandler'
typename = 'EvAdventureCombatTwitchHandler'
class evennia.contrib.tutorials.evadventure.combat_twitch.CmdAttack(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.combat_twitch._BaseTwitchCombatCommand

Attack a target. Will keep attacking the target until combat ends or another combat action is taken.

Usage:

attack/hit <target>

key = 'attack'
aliases = ['hit']
help_category = 'combat'
func()[源代码]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'hit', 'category': 'combat', 'key': 'attack', 'no_prefix': ' hit', 'tags': '', 'text': '\n Attack a target. Will keep attacking the target until\n combat ends or another combat action is taken.\n\n Usage:\n attack/hit <target>\n\n '}
class evennia.contrib.tutorials.evadventure.combat_twitch.CmdLook(**kwargs)[源代码]

基类:evennia.commands.default.general.CmdLook, evennia.contrib.tutorials.evadventure.combat_twitch._BaseTwitchCombatCommand

look at location or object

Usage:

look look <obj> look *<account>

Observes your location or objects in your vicinity.

func()[源代码]

Handle the looking.

aliases = ['ls', 'l']
help_category = 'general'
key = 'look'
lock_storage = 'cmd:all()'
search_index_entry = {'aliases': 'ls l', 'category': 'general', 'key': 'look', 'no_prefix': ' ls l', 'tags': '', 'text': '\n look at location or object\n\n Usage:\n look\n look <obj>\n look *<account>\n\n Observes your location or objects in your vicinity.\n '}
class evennia.contrib.tutorials.evadventure.combat_twitch.CmdHold(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.combat_twitch._BaseTwitchCombatCommand

Hold back your blows, doing nothing.

Usage:

hold

key = 'hold'
func()[源代码]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'hold', 'no_prefix': ' ', 'tags': '', 'text': '\n Hold back your blows, doing nothing.\n\n Usage:\n hold\n\n '}
class evennia.contrib.tutorials.evadventure.combat_twitch.CmdStunt(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.combat_twitch._BaseTwitchCombatCommand

Perform a combat stunt, that boosts an ally against a target, or foils an enemy, giving them disadvantage against an ally.

Usage:

boost [ability] <recipient> <target> foil [ability] <recipient> <target> boost [ability] <target> (same as boost me <target>) foil [ability] <target> (same as foil <target> me)

示例

boost STR me Goblin boost DEX Goblin foil STR Goblin me foil INT Goblin boost INT Wizard Goblin

key = 'stunt'
aliases = ['boost', 'foil']
help_category = 'combat'
parse()[源代码]

Handle parsing of most supported combat syntaxes (except stunts).

<action> [<target>|<item>] or <action> <item> [on] <target>

Use ‘on’ to differentiate if names/items have spaces in the name.

func()[源代码]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'boost foil', 'category': 'combat', 'key': 'stunt', 'no_prefix': ' boost foil', 'tags': '', 'text': '\n Perform a combat stunt, that boosts an ally against a target, or\n foils an enemy, giving them disadvantage against an ally.\n\n Usage:\n boost [ability] <recipient> <target>\n foil [ability] <recipient> <target>\n boost [ability] <target> (same as boost me <target>)\n foil [ability] <target> (same as foil <target> me)\n\n Example:\n boost STR me Goblin\n boost DEX Goblin\n foil STR Goblin me\n foil INT Goblin\n boost INT Wizard Goblin\n\n '}
class evennia.contrib.tutorials.evadventure.combat_twitch.CmdUseItem(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.combat_twitch._BaseTwitchCombatCommand

Use an item in combat. The item must be in your inventory to use.

Usage:

use <item> use <item> [on] <target>

实际案例

use potion use throwing knife on goblin use bomb goblin

key = 'use'
help_category = 'combat'
parse()[源代码]

Handle parsing of most supported combat syntaxes (except stunts).

<action> [<target>|<item>] or <action> <item> [on] <target>

Use ‘on’ to differentiate if names/items have spaces in the name.

func()[源代码]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'use', 'no_prefix': ' ', 'tags': '', 'text': '\n Use an item in combat. The item must be in your inventory to use.\n\n Usage:\n use <item>\n use <item> [on] <target>\n\n Examples:\n use potion\n use throwing knife on goblin\n use bomb goblin\n\n '}
class evennia.contrib.tutorials.evadventure.combat_twitch.CmdWield(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.combat_twitch._BaseTwitchCombatCommand

Wield a weapon or spell-rune. You will the wield the item, swapping with any other item(s) you were wielded before.

Usage:

wield <weapon or spell>

实际案例

wield sword wield shield wield fireball

Note that wielding a shield will not replace the sword in your hand, while wielding a two-handed weapon (or a spell-rune) will take two hands and swap out what you were carrying.

key = 'wield'
help_category = 'combat'
parse()[源代码]

Handle parsing of most supported combat syntaxes (except stunts).

<action> [<target>|<item>] or <action> <item> [on] <target>

Use ‘on’ to differentiate if names/items have spaces in the name.

func()[源代码]

This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())

aliases = []
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'wield', 'no_prefix': ' ', 'tags': '', 'text': '\n Wield a weapon or spell-rune. You will the wield the item, swapping with any other item(s) you\n were wielded before.\n\n Usage:\n wield <weapon or spell>\n\n Examples:\n wield sword\n wield shield\n wield fireball\n\n Note that wielding a shield will not replace the sword in your hand, while wielding a two-handed\n weapon (or a spell-rune) will take two hands and swap out what you were carrying.\n\n '}
class evennia.contrib.tutorials.evadventure.combat_twitch.TwitchCombatCmdSet(cmdsetobj=None, key=None)[源代码]

基类:evennia.commands.cmdset.CmdSet

Add to character, to be able to attack others in a twitch-style way.

key = 'twitch_combat_cmdset'
at_cmdset_creation()[源代码]

Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().

path = 'evennia.contrib.tutorials.evadventure.combat_twitch.TwitchCombatCmdSet'
class evennia.contrib.tutorials.evadventure.combat_twitch.TwitchLookCmdSet(cmdsetobj=None, key=None)[源代码]

基类:evennia.commands.cmdset.CmdSet

This will be added/removed dynamically when in combat.

key = 'twitch_look_cmdset'
at_cmdset_creation()[源代码]

Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().

path = 'evennia.contrib.tutorials.evadventure.combat_twitch.TwitchLookCmdSet'