From dff9ec1e52e824645c37a94f49b7de43b24b4161 Mon Sep 17 00:00:00 2001 From: Janik Kleinhoff Date: Fri, 29 Aug 2014 06:56:19 +0200 Subject: [PATCH] Avoid having the village 'mourn' a wolfteam or monster death. --- modules/wolfgame.py | 14 +++++++++----- settings/wolfgame.py | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 7c2f270..0a508b8 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1465,7 +1465,8 @@ def del_player(cli, nick, forced_death = False, devoice = True, end_game = True, role = var.get_reveal_role(target) an = "n" if role[0] in ("a", "e", "i", "o", "u") else "" message = ("Before dying, \u0002{0}\u0002 quickly slits \u0002{1}\u0002's throat. " + - "The village mourns the loss of a{2} \u0002{3}\u0002.").format(nick, target, an, role) + "The village {2} of a{3} \u0002{4}\u0002.").format(nick, target, + "mourns the loss" if var.mourn(role) else "celebrates the death", an, role) else: message = "Before dying, \u0002{0}\u0002 quickly slits \u0002{1}\u0002's throat.".format(nick, target) cli.msg(botconfig.CHANNEL, message) @@ -2491,8 +2492,8 @@ def transition_day(cli, gameid=0): if var.ROLE_REVEAL: role = var.get_reveal_role(victim) an = "n" if role[0] in ("a", "e", "i", "o", "u") else "" - message.append(("The dead body of \u0002{0}\u0002, a{1} \u0002{2}\u0002, is found. " + - "Those remaining mourn the tragedy.").format(victim, an, role)) + message.append(("The dead body of \u0002{0}\u0002, a{1} \u0002{2}\u0002, is found.{3}").format(victim, an, role, + " Those remaining mourn the tragedy." if var.mourn(role) else "")) else: message.append(("The dead body of \u0002{0}\u0002 is found. " + "Those remaining mourn the tragedy.").format(victim)) @@ -3225,10 +3226,13 @@ def shoot(cli, nick, chann_, rest): var.LOGGER.logMessage("{0} is a lousy shooter and missed!".format(nick)) else: if var.ROLE_REVEAL: + role = var.get_reveal_role(nick) cli.msg(chan, ("Oh no! \u0002{0}\u0002's gun was poorly maintained and has exploded! "+ - "The village mourns a gunner-\u0002{1}\u0002.").format(nick, var.get_reveal_role(nick))) + "The village {1} a gunner-\u0002{2}\u0002's death.").format(nick, + "mourns" if var.mourn(role) else "cheers on", role)) var.LOGGER.logMessage(("Oh no! {0}'s gun was poorly maintained and has exploded! "+ - "The village mourns a gunner-{1}.").format(nick, var.get_reveal_role(nick))) + "The village {1} a gunner-\u0002{2}\u0002's death.").format(nick, + "mourns" if var.mourn(role) else "cheers on", role)) else: cli.msg(chan, ("Oh no! \u0002{0}\u0002's gun was poorly maintained and has exploded!").format(nick)) var.LOGGER.logMessage(("Oh no! {0}'s gun was poorly maintained and has exploded!").format(nick)) diff --git a/settings/wolfgame.py b/settings/wolfgame.py index a81d185..77da5c0 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -235,6 +235,9 @@ def get_reveal_role(nick): else: return get_role(nick) +def mourn(role): + return not (role in WOLFTEAM_ROLES or role == "monster") + def del_player(pname): prole = get_role(pname) ROLES[prole].remove(pname)