From 7b2ee4ecd5215b1ca0c65194a7ab40be0fb25597 Mon Sep 17 00:00:00 2001 From: skizzerz Date: Thu, 4 Dec 2014 21:50:32 -0600 Subject: [PATCH 1/2] Fix impatience totem interaction with abstaining: - Moving code to chk_decision means that doing an actual !abstain will still make you show up in !votes (unlike now where it does not) - impatience and pacifism should balance each other out if they are present in equal numbers, preventing an !abstain from working if you have impatience does not yield that behavior --- modules/wolfgame.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 7733a64..7c2c98b 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -844,10 +844,18 @@ def chk_decision(cli, force = ""): pl = var.list_players() avail = len(pl) - len(var.WOUNDED) - len(var.ASLEEP) votesneeded = avail // 2 + 1 - not_lynching = set(var.NO_LYNCH) + not_lynching = var.NO_LYNCH[:] for p in var.PACIFISTS: if p in pl and p not in var.WOUNDED and p not in var.ASLEEP: - not_lynching.add(p) + not_lynching.append(p) + + # .remove() will only remove the first instance, which means this plays nicely with pacifism countering this + for p in var.IMPATIENT: + if p in not_lynching: + not_lynching.remove(p) + + # remove duplicates + not_lynching = set(not_lynching) # we only need 50%+ to not lynch, instead of an actual majority, because a tie would time out day anyway # don't check for ABSTAIN_ENABLED here since we may have a case where the majority of people have pacifism totems or something @@ -2818,7 +2826,7 @@ def no_lynch(cli, nick, chan, rest): var.VOTES[voter].remove(nick) if not var.VOTES[voter]: del var.VOTES[voter] - if nick not in var.NO_LYNCH and nick not in var.IMPATIENT: + if nick not in var.NO_LYNCH: var.NO_LYNCH.append(nick) cli.msg(chan, "\u0002{0}\u0002 votes to not lynch anyone today.".format(nick)) From 5819976a1f897212344c350d09cdc0b934f71ea3 Mon Sep 17 00:00:00 2001 From: skizzerz Date: Thu, 4 Dec 2014 22:45:11 -0600 Subject: [PATCH 2/2] Pacifism/Impatience totem improvements - A message is now displayed whenever a pacifism or impatience totem is triggered, e.g. "X impatiently votes for Y." or "X meekly votes to not lynch anyone today." These are played immediately before the vote passes, so there is no opportunity for people to abandon course. - Reinstate people with impatience totems being the ones that die to desperation totems. Due to the above message playing, it is now more obvious why they died, and I believe that doing it this way adds to gameplay ("I have a random totem and so does the person being voted. I should try to jump in early just in case I have impatience so I don't die."). If someone with impatience votes normally, their actual vote counts for determing vote order (so they aren't last unless they voted last). If there are multiple people with impatience that didn't vote, then the order in which they vote is random. --- modules/wolfgame.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 7c2c98b..7b4e854 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -860,18 +860,33 @@ def chk_decision(cli, force = ""): # we only need 50%+ to not lynch, instead of an actual majority, because a tie would time out day anyway # don't check for ABSTAIN_ENABLED here since we may have a case where the majority of people have pacifism totems or something if len(not_lynching) >= math.ceil(avail / 2): + for p in not_lynching: + if p not in var.NO_LYNCH: + cli.msg(botconfig.CHANNEL, "\u0002{0}\u0002 meekly votes to not lynch anyone today.".format(p)) cli.msg(botconfig.CHANNEL, "The villagers have agreed to not lynch anybody today.") var.ABSTAINED = True transition_night(cli) return aftermessage = None votelist = copy.deepcopy(var.VOTES) + impatient_voters = [] for votee, voters in votelist.items(): numvotes = 0 + random.shuffle(var.IMPATIENT) for v in var.IMPATIENT: if v in pl and v not in voters and v != votee and v not in var.WOUNDED and v not in var.ASLEEP: - voters = [v] + voters - for v in voters: + # don't add them in if they have the same number or more of pacifism totems + # this matters for desperation totem on the votee + imp_count = sum([1 if p == v else 0 for p in var.IMPATIENT]) + pac_count = sum([1 if p == v else 0 for p in var.PACIFISTS]) + if pac_count >= imp_count: + continue + + # yes, this means that one of the impatient people will get desperation totem'ed if they didn't + # already !vote earlier. sucks to suck. >:) + voters.append(v) + impatient_voters.append(v) + for v in voters[:]: weight = 1 imp_count = sum([1 if p == v else 0 for p in var.IMPATIENT]) pac_count = sum([1 if p == v else 0 for p in var.PACIFISTS]) @@ -884,6 +899,9 @@ def chk_decision(cli, force = ""): numvotes += weight if numvotes >= votesneeded or votee == force: + for p in impatient_voters: + cli.msg(botconfig.CHANNEL, "\u0002{0}\u0002 impatiently votes for \u0002{1}\u0002.".format(p, votee)) + # roles that prevent any lynch from happening if votee in var.ROLES["mayor"] and votee not in var.REVEALED_MAYORS: lmsg = ("While being dragged to the gallows, \u0002{0}\u0002 reveals that they " +