Spaces:
Sleeping
Sleeping
File size: 4,940 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 134 135 136 137 138 139 140 141 142 143 |
import pytest
from engine.game.enums import Phase
from engine.game.game_state import initialize_game
class TestVerificationBatch2:
@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_006_maki(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-006-SD"
card_id = self.get_card_id_by_no(gs, card_no)
live_in_hand_no = "PL!-sd1-019-SD"
live_in_hand_id = self.get_card_id_by_no(gs, live_in_hand_no)
live_in_success_no = "PL!-sd1-020-SD"
live_in_success_id = self.get_card_id_by_no(gs, live_in_success_no)
p.hand = [card_id, live_in_hand_id]
p.success_lives = [live_in_success_id]
gs.phase = Phase.MAIN
gs.step(1)
p = gs.players[0]
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(live_in_hand_id)
gs.step(500 + idx)
if gs.pending_choices:
choice_type, params = gs.pending_choices[0]
if choice_type == "SELECT_SWAP_SOURCE":
idx = params["cards"].index(live_in_success_id)
gs.step(600 + idx)
if gs.pending_choices and gs.pending_choices[0][0] == "SELECT_SWAP_TARGET":
p = gs.players[0]
idx = p.hand.index(live_in_hand_id)
gs.step(500 + idx)
# Verify swap if logic correct
# Just ensure no crash/hang
pass
def test_pl_sd1_007_nozomi(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-007-SD"
card_id = self.get_card_id_by_no(gs, card_no)
live_id = self.get_card_id_by_no(gs, "PL!-sd1-019-SD")
dummy = card_id
p.hand = [card_id]
p.main_deck = [dummy, dummy, live_id, dummy, dummy] + [dummy] * 10
gs.phase = Phase.MAIN
gs.step(1, check_legality=False, in_place=True)
p = gs.players[0]
# Check mill
assert len(p.discard) == 5
assert live_id in p.discard
assert len(p.hand) == 1
def test_pl_sd1_008_hanayo(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-008-SD"
card_id = self.get_card_id_by_no(gs, card_no)
p.stage[0] = card_id
dummy = card_id
p.main_deck = [dummy] * 20
gs.phase = Phase.MAIN
gs.step(200, check_legality=False, in_place=True) # Activate
assert len(p.discard) == 10
def test_pl_sd1_009_nico(self, game_state):
gs = game_state
gs.current_player = 0
p = gs.players[0]
card_no = "PL!-sd1-009-SD"
card_id = self.get_card_id_by_no(gs, card_no)
honoka_id = self.get_card_id_by_no(gs, "PL!-sd1-001-SD")
p.discard = [honoka_id] * 25
p.live_zone = [self.get_card_id_by_no(gs, "PL!-sd1-019-SD")]
p.live_zone_revealed = [True]
p.stage[0] = card_id
gs.phase = Phase.PERFORMANCE_P1
gs.step(0, check_legality=False, in_place=True)
found_effect = False
for ce in p.continuous_effects:
eff = ce.get("effect")
if eff and eff.effect_type.name in ("MODIFY_SCORE_RULE", "BOOST_SCORE", "ADD_BLADES"):
found_effect = True
break
# SD1-009 has a constant effect that adds score per 5 cards in discard
# With 25 cards in discard, this should add +5 score
# If no continuous effect, check if score_bonus is set
if not found_effect:
found_effect = p.live_score_bonus > 0
assert found_effect, (
f"No score effect found. continuous_effects={p.continuous_effects}, live_score_bonus={p.live_score_bonus}"
)
def test_pl_sd1_010_honoka_vanilla(self, game_state):
gs = game_state
card_no = "PL!-sd1-010-SD"
card_id = self.get_card_id_by_no(gs, card_no)
card = gs.member_db[card_id]
assert not card.abilities
|