Events/targeted_command

From Werewolf Wiki
Jump to navigation Jump to search

The targeted_command event is usually called whenever a role command which takes a target is executed. Certain roles may not fire this event, usually these roles act on night 1 only.

Event callback

def on_targeted_command(event: Event, cli: IRCClient, var: module, command: str, actor: str, orig_target: str, tags: frozenset(str)) -> None
  • prevent_default prevents the command from being executed. It is the handler's responsibility to somehow inform the player of this fact (e.g. by calling pm).
  • event: The event object
  • cli: The IRC connection
  • var: Reference to the src.settings module
  • command: Command being executed
  • actor: Person using the command
  • orig_target: Person originally targeted by the command. This may be different than who is currently being targeted, and should only be checked if knowing the original target is important
  • tags: Collection of tags that describe this command, see below for more information

Event data

{
    "target": str,
    "misdirection": bool,
    "exchange": bool
}

The target data property holds the current target of the command, which may be different than orig_target. If misdirection is True, misdirection/luck totems are applied to the target. If exchange is True, exchange totems are applied to the target. The handling for misdirection and exchange totems happens on event priority 9, so events that wish to modify these properties should register a lower priority number. Events that wish to check the target after misdirection or luck totems are applied should register a higher priority number.

Tags

The following is a summary of the various tags applied to commands, this list may grow over time. Most tags are purely informational, that is, they have no defined game function. However, they are presented anyway in case they are useful for consumers of the event.

  • info: The command gives information to the person that uses it (such as a seer's see or a werecrow's observe).
  • detrimental: The command has a direct negative impact on the target (such as a wolf's kill or a doomsayer's see).
  • beneficial: The command has a direct positive impact on the target (such as a guardian angel's guard). If a command lacks this tag, it cannot be used to target a succubus.
  • immediate: The results of the command happen immediately; that is, the actor cannot change their target once the command is executed. The lack of this tag implies the opposite, where the actor can change their mind before the command takes effect.