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