Spaces:
Running
Running
File size: 4,838 Bytes
bb3fbf9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
import pytest
from engine.game.enums import Phase
from engine.game.game_state import initialize_game
class TestVerificationBatch3:
@pytest.fixture
def game_state(self):
gs = initialize_game(use_real_data=True)
if not gs.member_db:
pytest.skip("Card data not loaded")
valid_id = next(iter(gs.member_db))
gs.active_player.energy_zone = [valid_id] * 20
gs.active_player.tapped_energy.fill(False)
return gs
def get_card_id_by_no(self, gs, card_no):
for cid, card in gs.member_db.items():
if card.card_no == card_no:
return cid
for cid, card in gs.live_db.items():
if card.card_no == card_no:
return cid
raise ValueError(f"Card {card_no} not found")
def test_pl_sd1_011_eli(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-011-SD"
card_id = self.get_card_id_by_no(gs, card_no)
fodder_id = self.get_card_id_by_no(gs, "PL!-sd1-001-SD")
c1 = self.get_card_id_by_no(gs, "PL!-sd1-002-SD")
c2 = self.get_card_id_by_no(gs, "PL!-sd1-003-SD")
c3 = self.get_card_id_by_no(gs, "PL!-sd1-004-SD")
deck_ids = [c1, c2, c3]
p.hand = [card_id, fodder_id]
p.main_deck = deck_ids + [fodder_id] * 5
gs.phase = Phase.MAIN
gs.step(1, check_legality=False, in_place=True)
# Cost
if gs.pending_choices:
choice_type, params = gs.pending_choices[0]
if choice_type == "TARGET_HAND" and params.get("reason") == "cost":
idx = p.hand.index(fodder_id)
gs.step(500 + idx, check_legality=False, in_place=True)
# Effect
if gs.pending_choices:
choice_type, params = gs.pending_choices[0]
if choice_type == "SELECT_FROM_LIST":
# Select second card (c2)
gs.step(601, check_legality=False, in_place=True)
assert c2 in p.hand
assert len(p.discard) >= 1
def test_pl_sd1_012_kotori(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-012-SD"
card_id = self.get_card_id_by_no(gs, card_no)
fodder_id = self.get_card_id_by_no(gs, "PL!-sd1-001-SD")
c1 = self.get_card_id_by_no(gs, "PL!-sd1-002-SD")
c2 = self.get_card_id_by_no(gs, "PL!-sd1-003-SD")
c3 = self.get_card_id_by_no(gs, "PL!-sd1-004-SD")
deck_ids = [c1, c2, c3]
p.hand = [card_id, fodder_id]
p.main_deck = deck_ids + [fodder_id] * 5
gs.phase = Phase.MAIN
gs.step(1, check_legality=False, in_place=True)
if gs.pending_choices and gs.pending_choices[0][0] == "TARGET_HAND":
gs.step(500, check_legality=False, in_place=True) # Discard first available
if gs.pending_choices:
# Select 3rd card
gs.step(602, check_legality=False, in_place=True)
assert c3 in p.hand
def test_pl_sd1_013_umi_vanilla(self, game_state):
gs = game_state
card_no = "PL!-sd1-013-SD"
card_id = self.get_card_id_by_no(gs, card_no)
card = gs.member_db[card_id]
assert not card.abilities
def test_pl_sd1_014_rin_vanilla(self, game_state):
gs = game_state
card_no = "PL!-sd1-014-SD"
card_id = self.get_card_id_by_no(gs, card_no)
card = gs.member_db[card_id]
assert not card.abilities
def test_pl_sd1_015_maki(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-015-SD"
card_id = self.get_card_id_by_no(gs, card_no)
fodder_id = self.get_card_id_by_no(gs, "PL!-sd1-001-SD")
live_id = self.get_card_id_by_no(gs, "PL!-sd1-019-SD")
member_id = self.get_card_id_by_no(gs, "PL!-sd1-002-SD")
p.hand = [card_id, fodder_id]
p.main_deck = [live_id, live_id, member_id, live_id, live_id] + [fodder_id] * 5
gs.phase = Phase.MAIN
gs.step(1, check_legality=False, in_place=True)
if gs.pending_choices and gs.pending_choices[0][0] == "TARGET_HAND":
gs.step(500, check_legality=False, in_place=True)
if gs.pending_choices:
choice_type, params = gs.pending_choices[0]
if member_id in params["cards"]:
idx = params["cards"].index(member_id)
gs.step(600 + idx, check_legality=False, in_place=True)
assert member_id in p.hand
# Check discard count
assert len(p.discard) >= 1
|