Browse Source

wolfgame.py taal gewijzigd tot regel 872

pull/1/head
Jeebeevee 10 years ago
parent
commit
e02d843b76
  1. 92
      modules/wolfgame.py

92
modules/wolfgame.py

@ -707,9 +707,9 @@ def stop_game(cli, winner = ""):
nitemin, nitesec = var.NIGHT_TIMEDELTA.seconds // 60, var.NIGHT_TIMEDELTA.seconds % 60 nitemin, nitesec = var.NIGHT_TIMEDELTA.seconds // 60, var.NIGHT_TIMEDELTA.seconds % 60
total = var.DAY_TIMEDELTA + var.NIGHT_TIMEDELTA total = var.DAY_TIMEDELTA + var.NIGHT_TIMEDELTA
tmin, tsec = total.seconds // 60, total.seconds % 60 tmin, tsec = total.seconds // 60, total.seconds % 60
gameend_msg = ("Game lasted \u0002{0:0>2}:{1:0>2}\u0002. " + gameend_msg = ("Spel duurde \u0002{0:0>2}:{1:0>2}\u0002. " +
"\u0002{2:0>2}:{3:0>2}\u0002 was day. " + "\u0002{2:0>2}:{3:0>2}\u0002 was dag. " +
"\u0002{4:0>2}:{5:0>2}\u0002 was night. ").format(tmin, tsec, "\u0002{4:0>2}:{5:0>2}\u0002 was nacht. ").format(tmin, tsec,
daymin, daysec, daymin, daysec,
nitemin, nitesec) nitemin, nitesec)
cli.msg(chan, gameend_msg) cli.msg(chan, gameend_msg)
@ -720,28 +720,28 @@ def stop_game(cli, winner = ""):
roles_msg = [] roles_msg = []
var.ORIGINAL_ROLES["cursed villager"] = var.CURSED # A hack var.ORIGINAL_ROLES["vervloekte burger"] = var.CURSED # A hack
var.ORIGINAL_ROLES["gunner"] = list(var.GUNNERS.keys()) var.ORIGINAL_ROLES["kanonnier"] = list(var.GUNNERS.keys())
lroles = list(var.ORIGINAL_ROLES.keys()) lroles = list(var.ORIGINAL_ROLES.keys())
lroles.remove("wolf") lroles.remove("wolf")
lroles.insert(0, "wolf") # picky, howl consistency lroles.insert(0, "wolf") # picky, howl consistency
for role in lroles: for role in lroles:
if len(var.ORIGINAL_ROLES[role]) == 0 or role == "villager": if len(var.ORIGINAL_ROLES[role]) == 0 or role == "burger":
continue continue
playersinrole = list(var.ORIGINAL_ROLES[role]) playersinrole = list(var.ORIGINAL_ROLES[role])
for i,plr in enumerate(playersinrole): for i,plr in enumerate(playersinrole):
if plr.startswith("(dced)"): # don't care about it here if plr.startswith("(dced)"): # don't care about it here
playersinrole[i] = plr[6:] playersinrole[i] = plr[6:]
if len(playersinrole) == 2: if len(playersinrole) == 2:
msg = "The {1} were \u0002{0[0]}\u0002 and \u0002{0[1]}\u0002." msg = "De {1} waren \u0002{0[0]}\u0002 en \u0002{0[1]}\u0002."
roles_msg.append(msg.format(playersinrole, var.plural(role))) roles_msg.append(msg.format(playersinrole, var.plural(role)))
elif len(playersinrole) == 1: elif len(playersinrole) == 1:
roles_msg.append("The {1} was \u0002{0[0]}\u0002.".format(playersinrole, roles_msg.append("De {1} was \u0002{0[0]}\u0002.".format(playersinrole,
role)) role))
else: else:
msg = "The {2} were {0}, and \u0002{1}\u0002." msg = "De {2} waren {0}, en \u0002{1}\u0002."
nickslist = ["\u0002"+x+"\u0002" for x in playersinrole[0:-1]] nickslist = ["\u0002"+x+"\u0002" for x in playersinrole[0:-1]]
roles_msg.append(msg.format(", ".join(nickslist), roles_msg.append(msg.format(", ".join(nickslist),
playersinrole[-1], playersinrole[-1],
@ -772,18 +772,18 @@ def stop_game(cli, winner = ""):
if acc == "*": if acc == "*":
continue # not logged in during game start continue # not logged in during game start
# determine if this player's team won # determine if this player's team won
if plr in (var.ORIGINAL_ROLES["wolf"] + var.ORIGINAL_ROLES["traitor"] + if plr in (var.ORIGINAL_ROLES["wolf"] + var.ORIGINAL_ROLES["verrader"] +
var.ORIGINAL_ROLES["werecrow"]): # the player was wolf-aligned var.ORIGINAL_ROLES["weerkraai"]): # the player was wolf-aligned
if winner == "wolves": if winner == "wolven":
won = True won = True
elif winner == "villagers": elif winner == "burgers":
won = False won = False
else: else:
break # abnormal game stop break # abnormal game stop
else: else:
if winner == "wolves": if winner == "wolven":
won = False won = False
elif winner == "villagers": elif winner == "burgers":
won = True won = True
else: else:
break break
@ -811,7 +811,7 @@ def chk_win(cli):
lpl = len(var.list_players()) lpl = len(var.list_players())
if lpl == 0: if lpl == 0:
cli.msg(chan, "No more players remaining. Game ended.") cli.msg(chan, "Er zijn geen spelers meer. Het spel is gestopt.")
reset(cli) reset(cli)
return True return True
@ -820,50 +820,50 @@ def chk_win(cli):
lwolves = (len(var.ROLES["wolf"])+ lwolves = (len(var.ROLES["wolf"])+
len(var.ROLES["traitor"])+ len(var.ROLES["verrader"])+
len(var.ROLES["werecrow"])) len(var.ROLES["weerkraai"]))
if var.PHASE == "day": if var.PHASE == "day":
lpl -= len([x for x in var.WOUNDED if x not in var.ROLES["traitor"]]) lpl -= len([x for x in var.WOUNDED if x not in var.ROLES["verrader"]])
lwolves -= len([x for x in var.WOUNDED if x in var.ROLES["traitor"]]) lwolves -= len([x for x in var.WOUNDED if x in var.ROLES["verrader"]])
if lwolves == lpl / 2: if lwolves == lpl / 2:
cli.msg(chan, ("Game over! There are the same number of wolves as "+ cli.msg(chan, ("Game over! Er zijn evenveel wolven als burgers."+
"villagers. The wolves eat everyone and win.")) "De wolven eten iedereen op en winnen het spel."))
var.LOGGER.logMessage(("Game over! There are the same number of wolves as "+ var.LOGGER.logMessage(("Game over! Er zijn evenveel wolven als burgers."+
"villagers. The wolves eat everyone, and win.")) "De wolven eten iedereen op en winnen het spel."))
village_win = False village_win = False
var.LOGGER.logBare("WOLVES", "WIN") var.LOGGER.logBare("WOLVEN", "WIN")
elif lwolves > lpl / 2: elif lwolves > lpl / 2:
cli.msg(chan, ("Game over! There are more wolves than "+ cli.msg(chan, ("Game over! Er zijn meer wolven dan burgers."+
"villagers. The wolves eat everyone, and win.")) "De wolven eten iedereen op en winnen het spel."))
var.LOGGER.logMessage(("Game over! There are more wolves than "+ var.LOGGER.logMessage(("Game over! Er zijn evenveel wolven als burgers."+
"villagers. The wolves eat everyone, and win.")) "De wolven eten iedereen op en winnen het spel."))
village_win = False village_win = False
var.LOGGER.logBare("WOLVES", "WIN") var.LOGGER.logBare("WOLVEN", "WIN")
elif (not var.ROLES["wolf"] and elif (not var.ROLES["wolf"] and
not var.ROLES["traitor"] and not var.ROLES["verrader"] and
not var.ROLES["werecrow"]): not var.ROLES["weerkraai"]):
cli.msg(chan, ("Game over! All the wolves are dead! The villagers "+ cli.msg(chan, ("Game over! Alle wolven zijn dood! De burgers "+
"chop them up, BBQ them, and have a hearty meal.")) "filleren ze, BBQ ze, en hebben een stevige maaltijd."))
var.LOGGER.logMessage(("Game over! All the wolves are dead! The villagers "+ var.LOGGER.logMessage(("Game over! Alle wolven zijn dood! De burgers "+
"chop them up, BBQ them, and have a hearty meal.")) "filleren ze, BBQ ze, en hebben een stevige maaltijd."))
village_win = True village_win = True
var.LOGGER.logBare("VILLAGERS", "WIN") var.LOGGER.logBare("BURGERS", "WIN")
elif (not var.ROLES["wolf"] and not elif (not var.ROLES["wolf"] and not
var.ROLES["werecrow"] and var.ROLES["traitor"]): var.ROLES["weerkraai"] and var.ROLES["verrader"]):
for t in var.ROLES["traitor"]: for t in var.ROLES["verrader"]:
var.LOGGER.logBare(t, "TRANSFORM") var.LOGGER.logBare(t, "TRANSFORM")
chk_traitor(cli) chk_traitor(cli)
cli.msg(chan, ('\u0002The villagers, during their celebrations, are '+ cli.msg(chan, ('\u0002De burgers, tijdens het festijn, zijn bang '+
'frightened as they hear a loud howl. The wolves are '+ 'ze horen een luide huil. De wolven zijn '+
'not gone!\u0002')) 'niet weg!\u0002'))
var.LOGGER.logMessage(('The villagers, during their celebrations, are '+ var.LOGGER.logMessage(('De burgers, tijdens het festijn, zijn bang '+
'frightened as they hear a loud howl. The wolves are '+ 'ze horen een luide huil. De wolven zijn '+
'not gone!')) 'niet weg!'))
return chk_win(cli) return chk_win(cli)
else: else:
return False return False
stop_game(cli, "villagers" if village_win else "wolves") stop_game(cli, "burgers" if village_win else "wolven")
return True return True

Loading…
Cancel
Save