You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Fox-V3/werewolf/roles/seer.py

112 lines
3.6 KiB

import logging
4 years ago
from werewolf.constants import (
ALIGNMENT_TOWN,
ALIGNMENT_WEREWOLF,
CATEGORY_TOWN_INVESTIGATIVE,
CATEGORY_TOWN_RANDOM,
)
from werewolf.listener import wolflistener
from werewolf.night_powers import pick_target
from werewolf.role import Role
7 years ago
log = logging.getLogger("red.fox_v3.werewolf.role.seer")
7 years ago
7 years ago
class Seer(Role):
4 years ago
rand_choice = True
town_balance = 4
4 years ago
category = [
CATEGORY_TOWN_RANDOM,
CATEGORY_TOWN_INVESTIGATIVE,
] # List of enrolled categories (listed above)
alignment = ALIGNMENT_TOWN # 1: Town, 2: Werewolf, 3: Neutral
7 years ago
channel_id = "" # Empty for no private channel
unique = False # Only one of this role per game
game_start_message = (
"Your role is **Seer**\n"
"You win by lynching all evil in the town\n"
"Lynch players during the day with `[p]ww vote <ID>`\n"
"Check for werewolves at night with `[p]ww choose <ID>`"
)
description = (
"A mystic in search of answers in a chaotic town.\n"
"Calls upon the cosmos to discern those of Lycan blood"
)
7 years ago
7 years ago
def __init__(self, game):
super().__init__(game)
7 years ago
# self.game = game
# self.player = None
# self.blocked = False
# self.properties = {} # Extra data for other roles (i.e. arsonist)
self.see_target = None
# self.action_list = [
# (self._at_game_start, 1), # (Action, Priority)
# (self._at_day_start, 0),
# (self._at_voted, 0),
# (self._at_kill, 0),
# (self._at_hang, 0),
# (self._at_day_end, 0),
# (self._at_night_start, 2),
# (self._at_night_end, 4),
# (self._at_visit, 0),
# ]
7 years ago
async def see_alignment(self, source=None):
"""
Interaction for investigative roles attempting
4 years ago
to see team (Village, Werewolf, Other)
"""
4 years ago
return ALIGNMENT_TOWN
async def get_role(self, source=None):
7 years ago
"""
Interaction for powerful access of role
Unlikely to be able to deceive this
"""
4 years ago
return "Seer"
7 years ago
async def see_role(self, source=None):
7 years ago
"""
Interaction for investigative roles.
More common to be able to deceive these roles
"""
4 years ago
return "Seer"
7 years ago
@wolflistener("at_night_start", priority=2)
async def _at_night_start(self):
if not self.player.alive:
return
self.see_target = None
7 years ago
await self.game.generate_targets(self.player.member)
7 years ago
await self.player.send_dm("**Pick a target to see tonight**")
7 years ago
@wolflistener("at_night_end", priority=4)
async def _at_night_end(self):
if self.see_target is None:
if self.player.alive:
await self.player.send_dm("You will not use your powers tonight...")
return
target = await self.game.visit(self.see_target, self.player)
7 years ago
7 years ago
alignment = None
if target:
alignment = await target.role.see_alignment(self.player)
7 years ago
4 years ago
if alignment == ALIGNMENT_WEREWOLF:
7 years ago
out = "Your insight reveals this player to be a **Werewolf!**"
4 years ago
else: # Don't reveal neutrals
7 years ago
out = "You fail to find anything suspicious about this player..."
await self.player.send_dm(out)
7 years ago
async def choose(self, ctx, data):
"""Handle night actions"""
await super().choose(ctx, data)
7 years ago
self.see_target, target = await pick_target(self, ctx, data)
await ctx.send(
f"**You will attempt to see the role of {target.member.display_name} tonight...**"
)