132 lines
3.9 KiB
Python
132 lines
3.9 KiB
Python
|
|
import typing as t
|
|
import enum
|
|
|
|
class GamePhase(enum.Enum):
|
|
Setup = enum.auto()
|
|
GameSetup = enum.auto()
|
|
StartOfNight = enum.auto()
|
|
NightPhase1 = enum.auto()
|
|
NightPhase2 = enum.auto()
|
|
NightPhase3 = enum.auto()
|
|
NightPhase4 = enum.auto()
|
|
NightPhase5 = enum.auto()
|
|
NightEnd5 = enum.auto()
|
|
ShowDead = enum.auto()
|
|
Election = enum.auto()
|
|
Discussion = enum.auto()
|
|
Accuse = enum.auto()
|
|
Poll = enum.auto()
|
|
Voting = enum.auto()
|
|
PollResult = enum.auto()
|
|
Award = enum.auto()
|
|
|
|
class RoleGroup(enum.Enum):
|
|
NoGroup = enum.auto()
|
|
Villagers = enum.auto()
|
|
Werewolfs = enum.auto()
|
|
LovedOnes = enum.auto()
|
|
|
|
|
|
class Roles(enum.Enum):
|
|
NoRole = enum.auto()
|
|
Villager = enum.auto()
|
|
Werewolf = enum.auto()
|
|
Seer = enum.auto()
|
|
Witch = enum.auto()
|
|
Hunter = enum.auto()
|
|
Cupid = enum.auto()
|
|
Protector = enum.auto()
|
|
ParanormalInvestigator = enum.auto()
|
|
Lycantroph = enum.auto()
|
|
Spy = enum.auto()
|
|
Pacifist = enum.auto()
|
|
OldMan = enum.auto()
|
|
Murder = enum.auto()
|
|
Leaderwolf = enum.auto()
|
|
|
|
@classmethod
|
|
def isWerwolf(cls, role: "Roles"):
|
|
return role in [cls.Werewolf, cls.Leaderwolf]
|
|
|
|
@classmethod
|
|
def getGroup(cls, role: "Roles"):
|
|
return RoleGroup.Werewolfs if role in [cls.Werewolf, cls.Leaderwolf] else RoleGroup.Villagers
|
|
|
|
class Rules(object):
|
|
showRoles: bool #`charaktereAufdecken` INT ( 2 ) DEFAULT 0,
|
|
passMajor: bool #`buergermeisterWeitergeben` INT ( 2 ) DEFAULT 0,
|
|
seerSeesIdentity: bool #`seherSiehtIdentitaet` INT ( 2 ) DEFAULT 1,
|
|
werewolfes: int
|
|
witches: int
|
|
seers: int
|
|
hunters: int
|
|
cupids: int
|
|
protectors: int
|
|
paranormals: int
|
|
lycantrophs: int
|
|
spys: int
|
|
murders: int
|
|
pacifists: int
|
|
oldmans: int
|
|
leaderwolfs: int
|
|
randomSelect: bool #`zufaelligeAuswahl` INT ( 2 ) DEFAULT 0 ,
|
|
randomBonus: int #`zufaelligeAuswahlBonus` INT ( 5 ) DEFAULT 0 ,
|
|
unanimously: bool #`werwolfeinstimmig` INT ( 2 ) DEFAULT 1 ,
|
|
timer_unanimously: int
|
|
timer_unanimously_per_wolf: int
|
|
timer_unsuccessfull: int
|
|
timer_unsuccessfull_per_wolf: int
|
|
timer_accusation: int
|
|
timer_accusation_per_player: int
|
|
timer_votation: int
|
|
timer_votation_per_player: int
|
|
timer_inactivity: int
|
|
timer_inactivity_per_player: int
|
|
|
|
|
|
|
|
|
|
class Player(object):
|
|
role: Roles
|
|
name: str
|
|
leader: bool
|
|
alive: bool
|
|
ready: bool
|
|
popup_text: str
|
|
log: t.List[str]
|
|
diedInRound: int
|
|
accusedBy: "Player"
|
|
|
|
|
|
@property
|
|
def isWerwolf(self):
|
|
return Roles.isWerwolf(self.role)
|
|
|
|
|
|
# `wahlAuf` INT ( 5 ) DEFAULT -1 ,
|
|
# `angeklagtVon` INT ( 5 ) DEFAULT -1 ,
|
|
# `nachtIdentitaet` INT( 10 ) NULL,
|
|
# `buergermeister` INT ( 2 ) DEFAULT 0,
|
|
# `hexeHeiltraenke` INT( 10 ) NULL,
|
|
# `hexeTodestraenke` INT( 5 ) NULL ,
|
|
# `hexenOpfer` INT ( 5 ) DEFAULT -1 ,
|
|
# `hexeHeilt` INT (2) DEFAULT 0,
|
|
# `beschuetzerLetzteRundeBeschuetzt` INT( 5 ) DEFAULT -1 ,
|
|
# `parErmEingesetzt` INT (2) DEFAULT 0 ,
|
|
# `verliebtMit` INT ( 5 ) DEFAULT -1 ,
|
|
# `jaegerDarfSchiessen` INT (2) DEFAULT 0 ,
|
|
# `buergermeisterDarfWeitergeben` INT (2) DEFAULT 0 ,
|
|
# `urwolf_anzahl_faehigkeiten` INT ( 5 ) DEFAULT 0,
|
|
# `countdownBis` INT (10) DEFAULT 0 ,
|
|
# `countdownAb` INT (10) DEFAULT 0 ,
|
|
|
|
class GameState(object):
|
|
currentPhase: GamePhase #`spielphase` INT( 5 ) DEFAULT 0,
|
|
gameRound: int
|
|
rules: Rules
|
|
log: t.List[str]
|
|
players: t.List[Player]
|
|
#`werwolfopfer` INT ( 5 ) DEFAULT -1 ,
|
|
|