Compare commits

...

1 Commits

Author SHA1 Message Date
Alberto Xamin
ff68001976 Fix Sventagliata to target only one player at a distance from the first target
Related to #513

Update the `Sventagliata` card to restrict the secondary target to be at a distance from the first target.

* **backend/bang/expansions/the_valley_of_shadows/cards.py**
  - Modify the `play_card` method in the `Sventagliata` class to enforce distance constraints for the secondary target.
  - Ensure the secondary target selection logic only includes players at a distance of 1 from the first target.

* **backend/tests/valley_of_shadows_test.py**
  - Update the `test_sventagliata` test to verify the secondary target is at a distance from the first target.
  - Add assertions to ensure the secondary target is correctly chosen based on the distance constraint.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/albertoxamin/bang/issues/513?shareId=XXXX-XXXX-XXXX-XXXX).
2024-08-03 18:58:33 +01:00
2 changed files with 7 additions and 1 deletions

View File

@ -178,7 +178,7 @@ class Sventagliata(
player.available_cards = [
dict(p, **{"original_target": against})
for p in player.game.get_visible_players(t)
if p["name"] != player.name and p["name"] != t.name and p["dist"]
if p["name"] != player.name and p["name"] != t.name and p["dist"] == 1
]
if len(player.available_cards) > 0:
player.pending_action = PendingAction.CHOOSE

View File

@ -330,6 +330,12 @@ def test_sventagliata():
assert p.pending_action == PendingAction.PLAY
assert len(p.hand) == 1
# Ensure the secondary target is at a distance from the first target
assert any(
target["name"] == secondary_target and target["dist"] > 1
for target in g.get_visible_players(p1)
)
def test_mira():
g = started_game(['the_valley_of_shadows'])