File size: 5,825 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
import pytest

from engine.game.enums import Phase
from engine.game.game_state import initialize_game


class TestVerificationBatch1:
    @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_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