Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/engine/registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def execute_potion_effect(potion_id: str, state: CombatState,
if not potion:
return {"success": False, "error": f"Unknown potion: {potion_id}"}

has_sacred_bark = state.has_relic("SacredBark")
has_sacred_bark = state.has_relic("Sacred Bark")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sacred Bark relic ID mismatch breaks functionality

High Severity

The code checks for "Sacred Bark" (with space) but the relic definition in relics.py has id="SacredBark" (no space). When relics are obtained in gameplay, they're stored using the canonical ID from the definition. This mismatch causes has_relic("Sacred Bark") to always return False in production, completely breaking the Sacred Bark doubling effect. Tests pass only because they manually set relics=["Sacred Bark"] instead of using the relic system.

Fix in Cursor Fix in Web

potency = potion.get_effective_potency(has_sacred_bark)

target = None
Expand Down
4 changes: 0 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
"""

import pytest
import sys

# Ensure project root is in path
sys.path.insert(0, '/Users/jackswitzer/Desktop/SlayTheSpireRL')

from packages.engine.state.combat import (
CombatState, EntityState, EnemyCombatState,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_potion_effects_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def combat_with_sacred_bark():
deck=["Strike", "Strike", "Defend", "Defend"],
energy=3,
max_energy=3,
relics=["SacredBark"],
relics=["Sacred Bark"],
potions=["", "", ""],
)

Expand Down
16 changes: 8 additions & 8 deletions tests/test_potion_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_fire_potion_deals_20_damage(self):

def test_fire_potion_with_sacred_bark(self):
"""Fire Potion with Sacred Bark should deal 40 damage."""
state = self._create_combat_state(relics=["SacredBark"])
state = self._create_combat_state(relics=["Sacred Bark"])
initial_hp = state.enemies[0].hp

result = execute_potion_effect("Fire Potion", state, target_idx=0)
Expand Down Expand Up @@ -116,7 +116,7 @@ def test_block_potion_gains_12_block(self):

def test_block_potion_with_sacred_bark(self):
"""Block Potion with Sacred Bark should gain 24 block."""
state = self._create_combat_state(relics=["SacredBark"])
state = self._create_combat_state(relics=["Sacred Bark"])

result = execute_potion_effect("Block Potion", state, target_idx=-1)

Expand Down Expand Up @@ -153,7 +153,7 @@ def test_strength_potion_gains_2_strength(self):

def test_strength_potion_with_sacred_bark(self):
"""Strength Potion with Sacred Bark should gain 4 Strength."""
state = self._create_combat_state(relics=["SacredBark"])
state = self._create_combat_state(relics=["Sacred Bark"])

result = execute_potion_effect("Strength Potion", state, target_idx=-1)

Expand Down Expand Up @@ -199,7 +199,7 @@ def test_weak_potion_applies_3_weak(self):

def test_weak_potion_with_sacred_bark(self):
"""Weak Potion with Sacred Bark should apply 6 Weak."""
state = self._create_combat_state(relics=["SacredBark"])
state = self._create_combat_state(relics=["Sacred Bark"])

result = execute_potion_effect("Weak Potion", state, target_idx=0)

Expand Down Expand Up @@ -236,7 +236,7 @@ def test_energy_potion_gains_2_energy(self):

def test_energy_potion_with_sacred_bark(self):
"""Energy Potion with Sacred Bark should gain 4 energy."""
state = self._create_combat_state(relics=["SacredBark"])
state = self._create_combat_state(relics=["Sacred Bark"])
assert state.energy == 3

result = execute_potion_effect("Energy Potion", state, target_idx=-1)
Expand Down Expand Up @@ -274,7 +274,7 @@ def test_combat_runner_sacred_bark_doubles_potency(self):
"""CombatRunner with Sacred Bark should double potion potency."""
run = create_watcher_run("TEST123", ascension=0)
run.potion_slots[0].potion_id = "Strength Potion"
run.relics.append(type("Relic", (), {"id": "SacredBark"})())
run.relics.append(type("Relic", (), {"id": "Sacred Bark"})())

rng = Random(12345)
enemies = [JawWorm(ai_rng=rng, ascension=0, hp_rng=rng)]
Expand Down Expand Up @@ -422,7 +422,7 @@ def _create_combat_state(self, potions, relics=None):

def test_blessing_of_forge_not_doubled(self):
"""Blessing of the Forge should upgrade hand, not doubled by Sacred Bark."""
state = self._create_combat_state(["BlessingOfTheForge"], relics=["SacredBark"])
state = self._create_combat_state(["BlessingOfTheForge"], relics=["Sacred Bark"])
state.hand = ["Strike", "Defend"]

result = execute_potion_effect("BlessingOfTheForge", state, target_idx=-1)
Expand All @@ -434,7 +434,7 @@ def test_blessing_of_forge_not_doubled(self):

def test_gamblers_brew_not_doubled(self):
"""Gambler's Brew should reshuffle hand, not doubled by Sacred Bark."""
state = self._create_combat_state(["GamblersBrew"], relics=["SacredBark"])
state = self._create_combat_state(["GamblersBrew"], relics=["Sacred Bark"])
state.hand = ["Card1", "Card2"]
state.draw_pile = ["Card3", "Card4"]

Expand Down
2 changes: 0 additions & 2 deletions tests/test_potion_sacred_bark.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Test Sacred Bark and new potion implementations.
"""
import pytest
import sys
sys.path.insert(0, '/Users/jackswitzer/Desktop/SlayTheSpireRL')

from packages.engine.combat_engine import CombatEngine
from packages.engine.state.combat import CombatState, EntityState, EnemyCombatState
Expand Down