Spaces:
Running
Running
| import pytest | |
| from engine.game.enums import Phase | |
| from engine.game.game_state import initialize_game | |
| class TestVerificationBatch2: | |
| 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 | |