Events/chk_win

From Werewolf Wiki
Jump to navigation Jump to search

The chk_win event is called every time win conditions are checked, and can be used to implement custom win conditions.

Event callback

def on_chk_win(event: Event, var: module, num_players: int, num_wolves: int, num_realwolves: int) -> None
  • prevent_default has no effect for this event
  • event: The event object
  • var: Reference to the src.settings module
  • num_players: Number of players still alive
  • num_wolves: Number of wolfchat roles still alive
  • num_realwolves: Number of wolf roles (excluding wolf cub) still alive

Event data

{
    "winner": str or None,
    "message": str,
    "additional_winners": list(str) or None
}

If the winner is None, this indicates that the game is not over yet. Otherwise, it should be a string naming a team such as "villagers", "wolves", "succubi", "monsters", a fool, or "" to indicate nobody won. Passing "" means nobody receives a win (not even additional_winners), if you wish it so that people can still get individual wins should they fulfill their own win cond (e.g. crazed shaman and the like), specify an invalid team such as "no_team_wins" instead. If a fool won, the winner takes the form "@nick", where nick is the fool's nick (check if the first character of winner is a "@" if you wish to detect fool wins). The message is output to the channel if the game is actually over, it should be the particular game over message that explains who won. If additional_winners is defined (it is initialized to None), then it is a list of people who will received individual wins in addition to the normal winners.