Spaces:
Running
Running
| import pytest | |
| from engine.game.enums import Phase | |
| from engine.tests.ability_test_helper import AbilityTestContext | |
| def test_kasumi_sec_order_deck(): | |
| """ | |
| Test Kasumi SEC (PL!N-bp1-002-SEC): ORDER_DECK ability. | |
| - Play Kasumi. | |
| - Order Deck choice should appear. | |
| """ | |
| ctx = AbilityTestContext() | |
| card_no = "PL!N-bp1-002-SEC" | |
| ctx.setup_game() | |
| ctx.reach_main_phase() | |
| ctx.set_hand(0, [card_no]) | |
| ctx.set_energy(0, 5, 0) | |
| # Play Kasumi to Center | |
| ctx.play_member(0, 1) | |
| # Kasumi SEC has choices for ORDER_DECK | |
| # According to logic.rs, choice ID is 550 + area*100 + ab_idx*10 + choice | |
| # Slot 1, Ab index 0 -> 650, 651, 652, 653 (Done) | |
| ctx.assert_phase(Phase.RESPONSE) | |
| legal = ctx.get_legal_actions() | |
| assert 650 in legal | |
| assert 653 in legal | |
| # Perform ordering | |
| ctx.gs.step(651) | |
| ctx.gs.step(653) | |
| ctx.assert_phase(Phase.MAIN) | |
| ctx.log("Kasumi SEC ORDER_DECK verified!") | |
| def test_emma_verde_activate_energy(): | |
| """ | |
| Test Emma Verde (PL!N-sd1-008-SD): ACTIVATE_ENERGY. | |
| It is an OnPlay ability. | |
| """ | |
| ctx = AbilityTestContext() | |
| card_no = "PL!N-sd1-008-SD" | |
| ctx.setup_game() | |
| ctx.reach_main_phase() | |
| ctx.set_hand(0, [card_no]) | |
| ctx.set_energy(0, 10, 0) # 10 untapped | |
| # Play Emma Verde | |
| ctx.play_member(0, 1) | |
| # Cost 7. After play: 7 tapped, 3 untapped. | |
| # OnPlay activates 2. Final: 5 tapped, 5 untapped. | |
| p0_after = ctx.gs.get_player(0) | |
| tapped_count = sum(1 for t in p0_after.tapped_energy if t) | |
| assert tapped_count == 5, f"Expected 5 tapped energy, got {tapped_count}" | |
| ctx.log("Emma Verde ACTIVATE_ENERGY verified!") | |
| def test_turn_1_condition(): | |
| """ | |
| Test C_TR1 (Turn 1) condition. | |
| C_TR1 = 200 | |
| O_DRAW = 10 | |
| """ | |
| ctx = AbilityTestContext() | |
| # Bytecode: [C_TR1, 1, 0, 0, O_DRAW, 1, 0, 1, JUMP, 1, 0, 0, RETURN, 0, 0, 0] | |
| # Simple check: [200, 1, 0, 0, 10, 1, 0, 1] | |
| bytecode = [200, 1, 0, 0, 10, 1, 0, 1] | |
| ctx.setup_game() | |
| ctx.gs.turn = 1 | |
| hand_before = len(ctx.gs.get_player(0).hand) | |
| ctx.gs.debug_execute_bytecode(bytecode, 0, -1, -1, -1, -1, -1) | |
| hand_after = len(ctx.gs.get_player(0).hand) | |
| assert hand_after == hand_before + 1, "Should have drawn a card on Turn 1" | |
| # Test Turn 2 | |
| ctx.gs.turn = 2 | |
| ctx.gs.debug_execute_bytecode(bytecode, 0, -1, -1, -1, -1, -1) | |
| hand_after_2 = len(ctx.gs.get_player(0).hand) | |
| assert hand_after_2 == hand_after, "Should NOT have drawn a card on Turn 2" | |
| ctx.log("C_TR1 condition verified!") | |
| if __name__ == "__main__": | |
| pytest.main([__file__]) | |