Skip to content

Commit

Permalink
PB changes
Browse files Browse the repository at this point in the history
- Fix !myrole display bug that displayed the target's actual role
  instead of the evidence role collected for that target.
- Vampires now draw 2 cards when visiting graveyard instead of 1.
- Vampires now gain 2 clue tokens when biting (but not killing/turning)
  someone, in addition to the 3 clue tokens the victim gains.
- Streets now confirms if all of your evidence is accurate when drawing
  3 evidence cards there.
- Streets now guarantees that you will get something when visiting
  there; either contradiction or 1 clue token (1 token is given when
  confirming there are no contradictions).
  • Loading branch information
skizzerz committed Dec 21, 2024
1 parent 5ec5993 commit a99897a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
3 changes: 2 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@
"pactbreaker_graveyard_clue": "While searching the graveyard last night, you gained some useful clues towards determining someone's identity.",
"pactbreaker_graveyard_empty": "Your search of the graveyard last night did not turn up any useful evidence.",
"pactbreaker_streets_evidence": "Your search of the streets last night allowed you to correct a previous mistaken assumption and learn that {0:@} is actually {1!role:article} {1!role:bold}!",
"pactbreaker_streets_special": "Your search of the streets last night allowed to you determine that all of your collected evidence is correct, giving you a useful clue towards determining someone else's identity.",
"pactbreaker_streets_clue": "Your search of the streets last night was stymied by some poor luck, but you still feel like you've gained a useful clue towards determining someone's identity.",
"pactbreaker_streets_empty": "Your search of the streets last night did not turn up any useful evidence.",
"pactbreaker_kill_fail": "You tried to find {0:@} last night but they were nowhere to be seen...",
Expand All @@ -1481,7 +1482,7 @@
"pactbreaker_hunter_stocks": "Prowling the area last night, you come across {0:@} in the stocks and launch an attack. They are unable to run or fight back, and quickly die from the onslaught.",
"pactbreaker_hunted": "While out last night, you are suddenly pounced upon by a large werewolf! It is the last thing you see...",
"pactbreaker_hunted_stocks": "While in the stocks, you are suddenly pounced upon by a large werewolf! It is the last thing you see...",
"pactbreaker_drain": "While out last night, you spot {0:@} alone and unaware of your presence. You quickly close in for a quick meal and vanish back into the shadows before they can clearly see who you are.",
"pactbreaker_drain": "While out last night, you spot {0:@} alone and unaware of your presence. You quickly close in for a quick meal and vanish back into the shadows before they can clearly see who you are. Seeing how they reacted to you has given you a potential clue to their identity.",
"pactbreaker_drain_kill": "While out last night, you spot {0:@} alone and unaware of your presence. You quickly close in for a quick meal, draining them fully and killing them.",
"pactbreaker_drain_turn": "While out last night, you spot {0:@} alone and unaware of your presence. You quickly close in for a quick meal, draining them fully. Before they die, you give them a bit of your own blood, turning them into {=vampire!role:article} {=vampire!role}.",
"pactbreaker_drained": "While out last night, you are suddenly overtaken by {=vampire!role:article} {=vampire!role:bold}! They drain your blood and your vision blurs, however you manage to make the vague shape of your assailant before they retreat, giving you a potential clue to their identity.",
Expand Down
5 changes: 5 additions & 0 deletions src/defaultsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,11 @@ gameplay: &gameplay
- int
_default: 3.2
bite:
_desc: >
The maximum number of clue tokens a vampire draws when biting (but not killing or turning) someone.
_type: int
_default: 2
bitten:
_desc: The maximum number of clue tokens drawn when someone is the target of a vampire bite.
_type: int
_default: 3
Expand Down
31 changes: 25 additions & 6 deletions src/gamemodes/pactbreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def on_myrole(self, evt: Event, var: GameState, player: User):
evt.data["messages"].append(messages["pactbreaker_info_no_evidence"])
else:
entries = []
for target in evidence:
entries.append(messages["pactbreaker_info_evidence_entry"].format(target, get_main_role(var, target)))
for target, role in evidence.items():
entries.append(messages["pactbreaker_info_evidence_entry"].format(target, role))
evt.data["messages"].append(messages["pactbreaker_info_evidence"].format(sorted(entries)))

def on_revealroles(self, evt: Event, var: GameState):
Expand Down Expand Up @@ -291,7 +291,7 @@ def on_night_kills(self, evt: Event, var: GameState):
victim_role = get_main_role(var, victim)
have_evidence = victim in self.collected_evidence[killer][victim_role]

if victim is not self.in_stocks and not have_evidence and killer_role != "vampire":
if victim is not self.in_stocks and not have_evidence and victim_role == "vampire":
killer.send(messages["pactbreaker_kill_fail"].format(victim))
else:
evt.data["victims"].add(victim)
Expand Down Expand Up @@ -331,8 +331,10 @@ def on_night_kills(self, evt: Event, var: GameState):
random.shuffle(vl)
for visitor in vl:
visitor_role = get_main_role(var, visitor)
cards = deck[i:i + num_draws]
i += num_draws
# vamps draw 2 cards at graveyard instead of 1
extra_draws = 1 if visitor_role == "vampire" and location is Graveyard else 0
cards = deck[i:i + num_draws + extra_draws]
i += num_draws + extra_draws
empty = True
_logger.debug("[{0}] {1}: {2}", loc, visitor.name, ", ".join(cards))

Expand Down Expand Up @@ -377,15 +379,28 @@ def on_night_kills(self, evt: Event, var: GameState):
# refute fake evidence that the visitor may have collected,
# in order of cursed -> villager (or vampire, if a cursed vig turned) and then vigilante -> vampire
# if there's no fake evidence, fall back to giving a clue token
collected_any = False
for wolf in self.collected_evidence[visitor]["wolf"]:
collected_any = True
if wolf in all_cursed and wolf not in self.collected_evidence[visitor]["villager"]:
evidence_target = wolf
break
else:
for vig in self.collected_evidence[visitor]["vigilante"]:
collected_any = True
if vig in all_vamps and vig not in self.collected_evidence[visitor]["vampire"]:
evidence_target = vig
break
# no evidence to refute? give a special message indicating that
if collected_any and evidence_target is None and self.clue_pool > 0:
tokens = min(self.clue_pool, config.Main.get(f"gameplay.modes.pactbreaker.clue.{loc}"))
self.clue_pool -= tokens
self.clue_tokens[visitor] += tokens
visitor.send(messages[f"pactbreaker_{loc}_special"].format(tokens))
break
elif location is Streets:
# streets is guaranteed to give a clue token each night (as long as clue tokens remain)
num_evidence = 2

if num_evidence >= 2:
if evidence_target is not None:
Expand Down Expand Up @@ -444,9 +459,13 @@ def on_player_protected(self,
vvar.vampire_drained.add(target)
attacker.send(messages["pactbreaker_drain"].format(target))
target.send(messages["pactbreaker_drained"])
victim_tokens = min(config.Main.get("gameplay.modes.pactbreaker.clue.bite"), self.clue_pool)
# give the victim tokens before vamp so that pool exhaustion doesn't overly benefit vamp
victim_tokens = min(config.Main.get("gameplay.modes.pactbreaker.clue.bitten"), self.clue_pool)
self.clue_pool -= victim_tokens
self.clue_tokens[target] += victim_tokens
vamp_tokens = min(config.Main.get("gameplay.modes.pactbreaker.clue.bite"), self.clue_pool)
self.clue_pool -= vamp_tokens
self.clue_tokens[attacker] += vamp_tokens
elif protector_role == "vigilante":
# if the vampire fully drains a vigilante, they might turn into a vampire instead of dying
# this protection triggering means they should turn
Expand Down

0 comments on commit a99897a

Please sign in to comment.