Events/chk_decision

From Werewolf Wiki
Jump to navigation Jump to search

The chk_decision event is called every time someone uses !vote, !abstain, or the day times out (thus forcing a lynch). The event can control who is voting for whom, as well as the flow from the vote logic into nighttime.

Event callback

def on_chk_decision(event: Event, cli: IRCClient, var: module, force: str) -> None
  • prevent_default has no effect for this event
  • event: The event object
  • cli: The IRC instance
  • var: Reference to the src.settings module
  • force: If chk_decision was called due to the day timing out, force is set to the nick of the person to be voted. Otherwise, is an empty string

Event data

{
    "avail": int,
    "votesneeded": int,
    "not_lynching": set(str),
    "votelist": dict(str: list(str)),
    "transition_night": func(cli: IRCClient) -> None
}

Impatience and pacifism totem resolution has already taken place in not_lynching by the time this event is called, however no such resolution has been performed for votelist yet at this time (meaning people with pacifism totems can show up in votelist, and people with impatience totems are not listed for all possible targets). The transition_night key is set to the built-in transition_night function. It can be overridden if one wishes to implement a new custom phase in between day and night, however that code should record the default transition_night so it can call it when it is over. If one wishes to simply hook into the beginning of night, the transition_night_begin event is better suited for that purpose.