From 6f590b48099c193de24578675643f8b6013795d0 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Wed, 20 Dec 2023 20:00:41 -0700 Subject: [PATCH] Pactbreaker tweaks - There is now a 40% chance vigilante will kill a known wolf when visiting that wolf's home even if the wolf is elsewhere. - When a target is in the stocks, vigilantes, wolves, and vampires with evidence on the target have a much greater chance of killing/draining them. - Reduce likelihood of collecting vigilante evidence at their house to match vampire. - Increase likelihood of getting drained while at the village square if a vampire is hunting there. --- src/gamemodes/pactbreaker.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/gamemodes/pactbreaker.py b/src/gamemodes/pactbreaker.py index 25ccc51a..ba905b21 100644 --- a/src/gamemodes/pactbreaker.py +++ b/src/gamemodes/pactbreaker.py @@ -233,6 +233,8 @@ def on_night_kills(self, evt: Event, var: GameState): if role == "wolf": deck.append(("hunted", visitor)) elif role == "vampire": + # vampires have a higher chance of draining people when hunting in the square + deck.append(("drained", visitor)) deck.append(("drained", visitor)) elif role == "vigilante": deck.append(("exposed", visitor)) @@ -250,8 +252,10 @@ def on_night_kills(self, evt: Event, var: GameState): for i, visitor in enumerate(visitors): role = get_main_role(var, visitor) card, actor = deck[i] - # certain roles treat their own cards as evidence instead (or empty-handed if stocks are empty) - if role == "wolf" and card == "hunted": + # killing roles with evidence on the person in the stocks treat drawing an evidence + # card as drawing the card that lets them kill the person in the stocks instead + evidence_special = card == "evidence" and target in self.collected_evidence[visitor] + if role == "wolf" and (card == "hunted" or evidence_special): # wolves kill the player in the stocks (even vampires) if not target or target_role == "wolf": # but don't kill other wolves @@ -260,7 +264,7 @@ def on_night_kills(self, evt: Event, var: GameState): evt.data["victims"].add(target) evt.data["killers"][target].append(visitor) self.night_kill_messages[visitor] = location - elif role == "vampire" and card == "drained": + elif role == "vampire" and (card == "drained" or evidence_special): # vampires fully drain the player in the stocks if not target or target_role == "vampire": # but don't drain other vampires @@ -270,7 +274,7 @@ def on_night_kills(self, evt: Event, var: GameState): evt.data["killers"][target].append(visitor) evt.data["kill_priorities"][actor] = 10 self.night_kill_messages[visitor] = location - elif role == "vigilante" and card == "exposed": + elif role == "vigilante" and (card == "exposed" or evidence_special): # vigilantes kill the player in the stocks if they have hard evidence on them, # otherwise they gain hard evidence if not target: @@ -345,12 +349,13 @@ def on_night_kills(self, evt: Event, var: GameState): self.visit_count[visitor][owner] += 1 total_draws += self.visit_count[visitor][owner] - num_vampires = len([x for x in visitors if get_main_role(var, x) == "vampire"]) + vampires = [x for x in visitors if get_main_role(var, x) == "vampire"] + num_vampires = len(vampires) owner_role = get_main_role(var, owner) deck = ["empty-handed", "empty-handed", "empty-handed" if owner_role != "wolf" else "evidence", - "empty-handed" if owner_role in ("vampire", "wolf") or is_home else "evidence", + "empty-handed" if owner_role != "villager" or is_home else "evidence", "empty-handed" if is_home else "evidence"] if total_draws > 5: for i in range(total_draws - 5): @@ -362,9 +367,11 @@ def on_night_kills(self, evt: Event, var: GameState): cards = deck[i:i+draws] i += draws role = get_main_role(var, visitor) - if (is_home and role == "vigilante" and owner in self.collected_evidence[visitor] - and owner_role in ("wolf", "vampire")): + vigilante_luck = random.random() < 0.4 + if ((vigilante_luck or is_home) and role == "vigilante" + and owner in self.collected_evidence[visitor] and owner_role in ("wolf", "vampire")): # vigilantes will murder a known wolf or vampire if they're home + # (and sometimes even if they're not) evt.data["victims"].add(owner) evt.data["killers"][owner].append(visitor) self.night_kill_messages[visitor] = location @@ -394,7 +401,6 @@ def on_night_kills(self, evt: Event, var: GameState): if not is_home and num_vampires > 0 and num_vampires >= num_visitors / 2: # vampires outnumber non-vampires; drain the non-vampires - vampires = [x for x in visitors if get_main_role(var, x) == "vampire"] i = 0 for visitor in visitors: if get_main_role(var, visitor) == "vampire": @@ -403,6 +409,7 @@ def on_night_kills(self, evt: Event, var: GameState): evt.data["killers"][visitor].append(vampires[i]) evt.data["kill_priorities"][vampires[i]] = 10 self.night_kill_messages[vampires[i]] = location + i += 1 def on_player_protected(self, evt: Event,