Add first version of the demoniac role

This commit is contained in:
Lukas Martini 2015-10-27 23:34:09 +01:00
parent be051dde70
commit c80078d7f4
2 changed files with 31 additions and 8 deletions

View File

@ -251,9 +251,9 @@ WOLFCHAT_ROLES = WOLF_ROLES | {"traitor", "hag", "sorcerer", "warlock", "doomsay
# Wins with the wolves, even if the roles are not necessarily wolves themselves
WOLFTEAM_ROLES = WOLFCHAT_ROLES | {"minion", "cultist"}
# These roles either steal away wins or can otherwise win with any team
TRUE_NEUTRAL_ROLES = frozenset({"crazed shaman", "fool", "jester", "monster", "clone", "piper", "turncoat", "succubus", "demoniac"})
TRUE_NEUTRAL_ROLES = frozenset({"crazed shaman", "fool", "jester", "monster", "demoniac", "clone", "piper", "turncoat", "succubus", "demoniac"})
# These are the roles that will NOT be used for when amnesiac turns, everything else is fair game! (var.DEFAULT_ROLE is also added if not in this set)
AMNESIAC_BLACKLIST = frozenset({"monster", "minion", "matchmaker", "clone", "doctor", "villager", "cultist", "piper"})
AMNESIAC_BLACKLIST = frozenset({"monster", "demoniac", "minion", "matchmaker", "clone", "doctor", "villager", "cultist", "piper"})
# These roles are seen as wolf by the seer/oracle
SEEN_WOLF = WOLF_ROLES | {"monster", "mad scientist", "succubus"}
# These are seen as the default role (or villager) when seen by seer (this overrides SEEN_WOLF)

View File

@ -2458,7 +2458,7 @@ def stop_game(cli, winner = "", abort = False, additional_winners = None):
if lvr in plrl:
lvrrol = plrl[lvr]
if not winner.startswith("@") and winner not in ("monsters", "pipers"):
if not winner.startswith("@") and winner not in ("monsters", "demoniacs", "pipers"):
iwon = True
break
elif winner.startswith("@") and winner == "@" + lvr and var.LOVER_WINS_WITH_FOOL:
@ -2467,19 +2467,24 @@ def stop_game(cli, winner = "", abort = False, additional_winners = None):
elif winner == "monsters" and lvrrol == "monster":
iwon = True
break
elif winner == "demoniacs" and lvrrol == "demoniac":
iwon = True
break
elif winner == "pipers" and lvrrol == "piper":
iwon = True
break
elif rol == "monster" and splr in survived and winner == "monsters":
iwon = True
elif rol == "demoniac" and splr in survived and winner == "demoniacs":
iwon = True
elif rol == "piper" and splr in survived and winner == "pipers":
iwon = True
elif rol == "crazed shaman" or rol == "clone":
# For clone, this means they ended game while being clone and not some other role
if splr in survived and not winner.startswith("@") and winner not in ("monsters", "pipers"):
if splr in survived and not winner.startswith("@") and winner not in ("monsters", "demoniacs", "pipers"):
iwon = True
elif rol == "vengeful ghost":
if not winner.startswith("@") and winner not in ("monsters", "pipers"):
if not winner.startswith("@") and winner not in ("monsters", "demoniacs", "pipers"):
if won and splr in survived:
iwon = True
elif splr in var.VENGEFUL_GHOSTS and var.VENGEFUL_GHOSTS[splr] == "villagers" and winner == "wolves":
@ -2571,6 +2576,7 @@ def chk_win(cli, end_game=True, winner=None):
lcubs = len(var.ROLES.get("wolf cub", ()))
lrealwolves = len(var.list_players(var.WOLF_ROLES - {"wolf cub"}))
lmonsters = len(var.ROLES.get("monster", ()))
ldemoniacs = len(var.ROLES.get("demoniac", ()))
ltraitors = len(var.ROLES.get("traitor", ()))
lpipers = len(var.ROLES.get("piper", ()))
if var.PHASE == "day":
@ -2584,9 +2590,9 @@ def chk_win(cli, end_game=True, winner=None):
except KeyError:
pass
return chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, lpipers, cli, end_game, winner)
return chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ldemoniacs, ltraitors, lpipers, cli, end_game, winner)
def chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, lpipers, cli, end_game=True, winner=None):
def chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ldemoniacs, ltraitors, lpipers, cli, end_game=True, winner=None):
"""Internal handler for the chk_win function."""
chan = botconfig.CHANNEL
with var.GRAVEYARD_LOCK:
@ -2609,6 +2615,12 @@ def chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, l
"the monster{0} quickly kill{1} the remaining villagers, " +
"causing the monster{0} to win.").format(plural, "" if plural else "s")
winner = "monsters"
elif ldemoniacs > 0:
plural = "s" if ldemoniacs > 1 else ""
message = ("Game over! All the wolves are dead! As the villagers start preparing the BBQ, " +
"a sudden flash illuminates the sky. Demonic spirits emerge around the sacrificed wolves " +
"and possess all villagers, causing the demoniac{0} to win.").format(plural)
winner = "demoniacs"
else:
message = ("Game over! All the wolves are dead! The villagers " +
"chop them up, BBQ them, and have a hearty meal.")
@ -2642,7 +2654,7 @@ def chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, l
lcubs = len(var.ROLES.get("wolf cub", ()))
lrealwolves = len(var.list_players(var.WOLF_ROLES - {"wolf cub"}))
ltraitors = len(var.ROLES.get("traitor", ()))
return chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, lpipers, cli, end_game)
return chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ldemoniacs, ltraitors, lpipers, cli, end_game)
event = Event("chk_win", {"winner": winner, "message": message, "additional_winners": None})
event.dispatch(var, lpl, lwolves, lrealwolves)
@ -2660,6 +2672,9 @@ def chk_win_conditions(lpl, lwolves, lcubs, lrealwolves, lmonsters, ltraitors, l
if winner == "monsters":
for plr in var.ROLES["monster"]:
players.append("{0} ({1})".format(plr, var.get_role(plr)))
if winner == "demoniacs":
for plr in var.ROLES["demoniac"]:
players.append("{0} ({1})".format(plr, var.get_role(plr)))
elif winner == "wolves":
for plr in var.list_players(var.WOLFTEAM_ROLES):
players.append("{0} ({1})".format(plr, var.get_role(plr)))
@ -6942,6 +6957,14 @@ def transition_night(cli):
else:
pm(cli, monster, "You are a \u0002monster\u0002.")
for demoniac in var.ROLES["demoniac"]:
if demoniac in var.PLAYERS and not is_user_simple(demoniac):
pm(cli, demoniac, ('You are a \u0002demoniac\u0002. You win instead of the normal winners '+
'if all wolves are killed while you are alive.'))
else:
pm(cli, demoniac, "You are a \u0002demoniac\u0002.")
for lycan in var.ROLES["lycan"]:
if lycan in var.PLAYERS and not is_user_simple(lycan):
pm(cli, lycan, ('You are a \u0002lycan\u0002. You are currently on the side of the ' +