Skip to content

Commit

Permalink
pb fixes
Browse files Browse the repository at this point in the history
- Fix error with event listener re-registration (blame PyCharm for not
  flagging this as an error)
- Increase probability of stuff happening when visiting by removing
  some empty-handed cards from locations.
- Wolves have a higher chance of killing when hunting in forest.
  • Loading branch information
skizzerz committed Aug 31, 2024
1 parent 2f1d1ff commit 8a074de
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/gamemodes/pactbreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def teardown(self):
wolf_retract.register()
vampire_bite.register()
vampire_retract.register()
vampire_drained.register()
vampire_drained.install()
vigilante_kill.register()
vigilante_retract.register()
vigilante_pass.register()
Expand Down Expand Up @@ -199,7 +199,8 @@ def on_night_kills(self, evt: Event, var: GameState):
deck.append(("evidence", wolf))
if wolf in visitors:
deck.append(("hunted", wolf))
while len(deck) < max(10, len(non_wolves)):
deck.append(("hunted", wolf))
while len(deck) < max(8, len(non_wolves)):
deck.append(("empty-handed", None))

random.shuffle(deck)
Expand Down Expand Up @@ -228,7 +229,7 @@ def on_night_kills(self, evt: Event, var: GameState):
else:
visitor.send(messages["pactbreaker_forest_empty"])
elif location is VillageSquare:
deck = [("empty-handed", None), ("empty-handed", None), ("empty-handed", None)]
deck = [("empty-handed", None)]
# figure out who is in the stocks (if anyone)
stocks_players = set(get_players(var)) - self.active_players
for visitor in visitors:
Expand All @@ -241,10 +242,10 @@ def on_night_kills(self, evt: Event, var: GameState):
deck.append(("drained", visitor))
elif role == "vigilante":
deck.append(("exposed", visitor))
while len(deck) < 10:
while len(deck) < 8:
deck.append(("evidence", None))
if len(visitors) > 10:
for i in range(len(visitors) - 10):
if len(visitors) > 8:
for i in range(len(visitors) - 8):
deck.append(("empty-handed", None))

# at most one person can be in the stocks; this simplifies some later logic
Expand Down Expand Up @@ -356,12 +357,11 @@ def on_night_kills(self, evt: Event, var: GameState):
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 != "villager" or is_home else "evidence",
"empty-handed" if is_home else "evidence"]
if total_draws > 5:
for i in range(total_draws - 5):
if total_draws > 4:
for i in range(total_draws - 4):
deck.append("empty-handed")
random.shuffle(deck)
i = 0
Expand Down

0 comments on commit 8a074de

Please sign in to comment.