Spaces:
Sleeping
Sleeping
File size: 3,615 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 |
import pytest
from engine.game.enums import Phase
from engine.game.game_state import initialize_game
class TestVerificationBatch14:
@pytest.fixture
def game_state(self):
gs = initialize_game(use_real_data=True)
if not gs.member_db:
pytest.skip("Card data not loaded")
gs.active_player.tapped_energy.fill(False)
return gs
def get_card_id(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
pytest.fail(f"Card {card_no} not found")
def _test_draw1_discard1(self, game_state, card_no):
"""
Generic test for "Draw 1, Discard 1".
"""
gs = game_state
card_id = self.get_card_id(gs, card_no)
p1 = gs.players[0]
p1.hand = [card_id]
fodder_id = self.get_card_id(gs, "PL!-sd1-001-SD")
p1.main_deck = [fodder_id] * 5
gs.current_player = 0
gs.phase = Phase.MAIN
initial_deck = len(p1.main_deck)
gs.step(1, check_legality=False, in_place=True) # Play
# Verify Draw
assert len(p1.main_deck) == initial_deck - 1
assert len(p1.hand) == 1
# Verify Discard Choice
assert gs.pending_choices, "Expected Discard Choice"
gs.step(500, check_legality=False, in_place=True)
assert len(p1.hand) == 0
assert len(p1.discard) >= 1
def _test_all_blade_heart(self, game_state, card_no):
"""
Generic test for "All Blade Heart" ability.
"""
gs = game_state
card_id = self.get_card_id(gs, card_no)
card = gs.member_db.get(card_id) or gs.live_db.get(card_id)
assert card is not None
assert len(card.abilities) > 0
has_meta = False
for ab in card.abilities:
for eff in ab.effects:
if eff.effect_type.name == "META_RULE" and eff.params.get("source") == "all_blade":
has_meta = True
break
assert has_meta, f"Card {card_no} missing ALL_BLADE meta rule"
def test_pln_bp1_014_n_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-bp1-014-N")
def test_pln_bp1_015_n_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-bp1-015-N")
def test_pln_bp1_019_n_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-bp1-019-N")
def test_pln_bp1_019_pr_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-bp1-019-PR")
def test_pln_sd1_013_sd_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-sd1-013-SD")
def test_pln_sd1_021_sd_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-sd1-021-SD")
def test_pln_sd1_022_sd_draw1_discard1(self, game_state):
self._test_draw1_discard1(game_state, "PL!N-sd1-022-SD")
def test_plhs_pr_010_pr_niji_all_blade_heart(self, game_state):
self._test_all_blade_heart(game_state, "PL!HS-PR-010-PR")
def test_plhs_pr_011_pr_niji_all_blade_heart(self, game_state):
self._test_all_blade_heart(game_state, "PL!HS-PR-011-PR")
def test_plhs_pr_012_pr_niji_all_blade_heart(self, game_state):
self._test_all_blade_heart(game_state, "PL!HS-PR-012-PR")
|