Avoid having the village 'mourn' a wolfteam or monster death.

This commit is contained in:
Janik Kleinhoff 2014-08-29 06:56:19 +02:00
parent 818b58f569
commit dff9ec1e52
2 changed files with 12 additions and 5 deletions

View File

@ -1465,7 +1465,8 @@ def del_player(cli, nick, forced_death = False, devoice = True, end_game = True,
role = var.get_reveal_role(target) role = var.get_reveal_role(target)
an = "n" if role[0] in ("a", "e", "i", "o", "u") else "" 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. " + 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: else:
message = "Before dying, \u0002{0}\u0002 quickly slits \u0002{1}\u0002's throat.".format(nick, target) message = "Before dying, \u0002{0}\u0002 quickly slits \u0002{1}\u0002's throat.".format(nick, target)
cli.msg(botconfig.CHANNEL, message) cli.msg(botconfig.CHANNEL, message)
@ -2491,8 +2492,8 @@ def transition_day(cli, gameid=0):
if var.ROLE_REVEAL: if var.ROLE_REVEAL:
role = var.get_reveal_role(victim) role = var.get_reveal_role(victim)
an = "n" if role[0] in ("a", "e", "i", "o", "u") else "" 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. " + 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.").format(victim, an, role)) " Those remaining mourn the tragedy." if var.mourn(role) else ""))
else: else:
message.append(("The dead body of \u0002{0}\u0002 is found. " + message.append(("The dead body of \u0002{0}\u0002 is found. " +
"Those remaining mourn the tragedy.").format(victim)) "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)) var.LOGGER.logMessage("{0} is a lousy shooter and missed!".format(nick))
else: else:
if var.ROLE_REVEAL: 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! "+ 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! "+ 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: else:
cli.msg(chan, ("Oh no! \u0002{0}\u0002's gun was poorly maintained and has exploded!").format(nick)) 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)) var.LOGGER.logMessage(("Oh no! {0}'s gun was poorly maintained and has exploded!").format(nick))

View File

@ -235,6 +235,9 @@ def get_reveal_role(nick):
else: else:
return get_role(nick) return get_role(nick)
def mourn(role):
return not (role in WOLFTEAM_ROLES or role == "monster")
def del_player(pname): def del_player(pname):
prole = get_role(pname) prole = get_role(pname)
ROLES[prole].remove(pname) ROLES[prole].remove(pname)