Skip to content

fix: target player for AnyPlayer potions#54

Open
Julian-Moncarz wants to merge 1 commit into
wuhao21:mainfrom
Julian-Moncarz:fix/anyplayer-potion-targets-player
Open

fix: target player for AnyPlayer potions#54
Julian-Moncarz wants to merge 1 commit into
wuhao21:mainfrom
Julian-Moncarz:fix/anyplayer-potion-targets-player

Conversation

@Julian-Moncarz
Copy link
Copy Markdown
Contributor

@Julian-Moncarz Julian-Moncarz commented May 11, 2026

Summary

Fix AnyPlayer potions so the headless CLI targets the player creature when constructing UsePotionAction.

Before this change, an AnyPlayer potion such as Liquid Bronze could be consumed without applying its player-targeted effect. In the regression test, Liquid Bronze disappears from the potion list but no Thorns power is added.

Changes

  • Treat TargetType.AnyPlayer like other player-targeting potion types in DoUsePotion.
  • Add stable id fields to serialized player potions and player/enemy powers, so tests and downstream agents do not need localized display names.
  • Add a regression test using seed p3, selecting Phial Holster by its stable text_key.
  • The test enters combat, uses LIQUID_BRONZE, and verifies the player gains THORNS_POWER.

Tests

Red before the fix:

pytest tests/test_potions.py -q
# failed: player_powers did not contain Thorns after Liquid Bronze was consumed

Green after the fix:

pytest tests/test_potions.py -q
# 1 passed

pytest -q -k 'not test_skip_card and not test_heal_caps_at_max'
# 56 passed, 2 deselected, 1 warning

dotnet build src/Sts2Headless/Sts2Headless.csproj -c Release
# Build succeeded

Note: tests/test_card_reward.py::TestCardReward::test_skip_card and tests/test_rest_site.py::TestRestSiteActions::test_heal_caps_at_max fail on clean upstream with my current game DLLs as well, so I excluded them from the broader validation run.

@Julian-Moncarz Julian-Moncarz force-pushed the fix/anyplayer-potion-targets-player branch from 119be27 to 1053d44 Compare May 11, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant