Browse Source

wounded traitors count against wolves now.

master
jcao219 14 years ago
parent
commit
887f95ea1b
  1. 24
      wolfgame.py

24
wolfgame.py

@ -727,26 +727,27 @@ def chk_win(cli):
chan = botconfig.CHANNEL chan = botconfig.CHANNEL
lpl = len(var.list_players()) lpl = len(var.list_players())
lwolves = (len(var.ROLES["wolf"])+
len(var.ROLES["traitor"])+
len(var.ROLES["werecrow"]))
if var.PHASE == "day": if var.PHASE == "day":
lpl -= len(var.WOUNDED) lpl -= len([x for x in var.WOUNDED if x not in var.ROLES["traitor"]])
lwolves -= len([x for x in var.WOUNDED if x in var.ROLES["traitor"]])
if lpl == 0: if lpl == 0:
cli.msg(chan, "No more players remaining. Game ended.") cli.msg(chan, "No more players remaining. Game ended.")
reset(cli) reset(cli)
return True return True
if var.PHASE == "join": if var.PHASE == "join":
return False return False
elif (len(var.ROLES["wolf"])+ elif lwolves == lpl / 2:
len(var.ROLES["traitor"])+
len(var.ROLES["werecrow"])) == lpl / 2:
cli.msg(chan, ("Game over! There are the same number of wolves as "+ cli.msg(chan, ("Game over! There are the same number of wolves as "+
"villagers. The wolves eat everyone, and win.")) "villagers. The wolves eat everyone, and win."))
var.LOGGER.logMessage(("Game over! There are the same number of wolves as "+ var.LOGGER.logMessage(("Game over! There are the same number of wolves as "+
"villagers. The wolves eat everyone, and win.")) "villagers. The wolves eat everyone, and win."))
village_win = False village_win = False
var.LOGGER.logBare("WOLVES", "WIN") var.LOGGER.logBare("WOLVES", "WIN")
elif (len(var.ROLES["wolf"])+ elif lwolves > lpl / 2:
len(var.ROLES["traitor"])+
len(var.ROLES["werecrow"])) > lpl / 2:
cli.msg(chan, ("Game over! There are more wolves than "+ cli.msg(chan, ("Game over! There are more wolves than "+
"villagers. The wolves eat everyone, and win.")) "villagers. The wolves eat everyone, and win."))
var.LOGGER.logMessage(("Game over! There are more wolves than "+ var.LOGGER.logMessage(("Game over! There are more wolves than "+
@ -762,7 +763,8 @@ def chk_win(cli):
"chop them up, BBQ them, and have a hearty meal.")) "chop them up, BBQ them, and have a hearty meal."))
village_win = True village_win = True
var.LOGGER.logBare("VILLAGERS", "WIN") var.LOGGER.logBare("VILLAGERS", "WIN")
elif not len(var.ROLES["wolf"]) and var.ROLES["traitor"]: elif (not var.ROLES["wolf"] and not
var.ROLES["werecrow"] and var.ROLES["traitor"]):
for t in var.ROLES["traitor"]: for t in var.ROLES["traitor"]:
var.LOGGER.logBare(t, "TRANSFORM") var.LOGGER.logBare(t, "TRANSFORM")
chk_traitor(cli) chk_traitor(cli)
@ -1814,10 +1816,16 @@ def mass_privmsg(cli, targets, msg):
def relay(cli, nick, rest): def relay(cli, nick, rest):
if var.PHASE != "night": if var.PHASE != "night":
return return
badguys = var.ROLES["wolf"] + var.ROLES["traitor"] + var.ROLES["werecrow"] badguys = var.ROLES["wolf"] + var.ROLES["traitor"] + var.ROLES["werecrow"]
if len(badguys) > 1: if len(badguys) > 1:
if nick in badguys: if nick in badguys:
badguys.remove(nick) # remove self from list badguys.remove(nick) # remove self from list
if rest.startswith("\01ACTION"):
rest = rest[7:-1]
mass_privmsg(cli, badguys, nick+rest)
else:
mass_privmsg(cli, badguys, "\02{0}\02 says: {1}".format(nick, rest)) mass_privmsg(cli, badguys, "\02{0}\02 says: {1}".format(nick, rest))

Loading…
Cancel
Save