Spaces:
Running
Running
| import pytest | |
| from engine.game.enums import Phase | |
| from engine.game.game_state import initialize_game | |
| class TestVerificationBatch1: | |
| 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_001_honoka(self, game_state): | |
| gs = game_state | |
| gs.current_player = 0 | |
| p = gs.players[0] | |
| card_no = "PL!-sd1-001-SD" | |
| card_id = self.get_card_id_by_no(gs, card_no) | |
| # Constant Ability Check | |
| p.stage[0] = card_id | |
| # Inject dummy success lives | |
| dummy_live = next(iter(gs.live_db)) | |
| p.success_lives = [dummy_live, dummy_live] # 2 lives | |
| base_blades = gs.member_db[card_id].blades | |
| eff_blades = p.get_effective_blades(0, gs.member_db) | |
| assert eff_blades == base_blades + 2 | |
| # On Play Ability Check | |
| gs._reset() | |
| gs.current_player = 0 | |
| gs.players[0] = p | |
| p = gs.players[0] | |
| p.success_lives = [dummy_live, dummy_live] # 2 lives (Condition Met) | |
| # Setup Discard | |
| live_card_no = "PL!-sd1-019-SD" | |
| live_card_id = self.get_card_id_by_no(gs, live_card_no) | |
| p.discard = [live_card_id] | |
| p.hand = [card_id] | |
| p.energy_zone = [card_id] * 20 | |
| p.tapped_energy.fill(False) | |
| gs.phase = Phase.MAIN | |
| gs.step(1, check_legality=False, in_place=True) | |
| assert gs.pending_choices, "Expected SELECT_FROM_DISCARD choice" | |
| choice_type, params = gs.pending_choices[0] | |
| assert choice_type == "SELECT_FROM_DISCARD" | |
| gs.step(660, check_legality=False, in_place=True) # Select first | |
| assert live_card_id in p.hand | |
| def test_pl_sd1_002_eli(self, game_state): | |
| gs = game_state | |
| gs.current_player = 0 | |
| p = gs.players[0] | |
| card_no = "PL!-sd1-002-SD" | |
| card_id = self.get_card_id_by_no(gs, card_no) | |
| p.stage[0] = card_id | |
| target_id = self.get_card_id_by_no(gs, "PL!-sd1-001-SD") | |
| p.discard = [target_id] | |
| gs.phase = Phase.MAIN | |
| gs.step(200, check_legality=False, in_place=True) # Activate | |
| assert p.stage[0] == -1, "Eli retired" | |
| assert gs.pending_choices | |
| gs.step(660, check_legality=False, in_place=True) # Select | |
| assert target_id in p.hand | |
| def test_pl_sd1_003_kotori(self, game_state): | |
| gs = game_state | |
| gs.current_player = 0 | |
| p = gs.players[0] | |
| card_no = "PL!-sd1-003-SD" | |
| card_id = self.get_card_id_by_no(gs, card_no) | |
| # On Play | |
| target_id = self.get_card_id_by_no(gs, "PL!-sd1-010-SD") | |
| p.discard = [target_id] | |
| p.hand = [card_id] | |
| gs.phase = Phase.MAIN | |
| gs.step(1, check_legality=False, in_place=True) | |
| if gs.pending_choices: | |
| gs.step(660, check_legality=False, in_place=True) | |
| assert target_id in p.hand | |
| # Live Start | |
| gs._reset() | |
| gs.current_player = 0 | |
| p = gs.players[0] | |
| p.stage[0] = card_id | |
| p.live_zone = [self.get_card_id_by_no(gs, "PL!-sd1-019-SD")] | |
| p.live_zone_revealed = [True] | |
| gs.phase = Phase.PERFORMANCE_P1 | |
| gs.step(0, check_legality=False, in_place=True) # Trigger performance | |
| # Check trigger queue or choice | |
| # Kotori has trigger 2 (Live Start) | |
| pass # Placeholder until live triggers stable | |
| def test_pl_sd1_004_umi(self, game_state): | |
| gs = game_state | |
| gs.current_player = 0 | |
| p = gs.players[0] | |
| card_no = "PL!-sd1-004-SD" | |
| card_id = self.get_card_id_by_no(gs, card_no) | |
| target_live = self.get_card_id_by_no(gs, "PL!-sd1-019-SD") | |
| dummy = card_id | |
| p.main_deck = [dummy, dummy, target_live, dummy, dummy] | |
| p.hand = [card_id] | |
| gs.phase = Phase.MAIN | |
| gs.step(1, check_legality=False, in_place=True) | |
| if gs.pending_choices: | |
| # Look and Choose | |
| choice_type, params = gs.pending_choices[0] | |
| cards = params.get("cards", []) | |
| if target_live in cards: | |
| idx = cards.index(target_live) | |
| gs.step(600 + idx, check_legality=False, in_place=True) | |
| assert target_live in p.hand | |
| def test_pl_sd1_005_rin(self, game_state): | |
| gs = game_state | |
| gs.current_player = 0 | |
| p = gs.players[0] | |
| card_no = "PL!-sd1-005-SD" | |
| card_id = self.get_card_id_by_no(gs, card_no) | |
| p.stage[0] = card_id | |
| target = self.get_card_id_by_no(gs, "PL!-sd1-019-SD") | |
| p.discard = [target] | |
| gs.phase = Phase.MAIN | |
| gs.step(200, check_legality=False, in_place=True) # Activate | |
| assert p.stage[0] == -1 | |
| if gs.pending_choices: | |
| gs.step(660, check_legality=False, in_place=True) | |
| assert target in p.hand | |
| 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 | |