File size: 3,112 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
import pytest

from engine.game.game_state import initialize_game

# Candidates to Strictly Verify
# 1. PL!N-bp1-001-P (Ayumu Uehara): On Play -> Gain 1 Blade
# 2. PL!N-bp1-005-P (Ai Miyashita): Constant? Need to re-read but let's test Ayumu first.
# 3. PL!-bp4-011-N (Eli Ayase): Live Start -> Gain 1 Blade until live end.


@pytest.fixture
def game():
    print("\nDEBUG: INITIALIZING GAME FIXTURE")
    return initialize_game(deck_type="training")


def _find_card_id(game, card_no):
    for cid, card in game.member_db.items():
        if card.card_no == card_no:
            return cid
    return None


def test_verify_ayumu_bp1_001_p(game):
    """

    Card: PL!N-bp1-001-P

    Text: [On Play] Gain 1 Blade.

    """
    card_no = "PL!N-bp1-001-P"
    cid = _find_card_id(game, card_no)
    print(f"DEBUG: lookup for {card_no} returned {cid}")
    assert cid is not None

    p0 = game.players[0]
    p0.hand = [cid]

    # Action: Play to Stage Center
    game.inject_card(0, cid, "stage", position=1)

    # Manually trigger ON_PLAY since inject doesn't
    # In real engine, play_card action calls resolve_effect
    # We will simulate the trigger resolution
    card = game.member_db[cid]
    # Check stats before
    # Check stats before
    # assert card.blades == 0 # Base - REMOVED: Some cards have base blades
    base_blades = card.blades

    # Find ability
    print(f"\nDEBUG: Analyzing Card {card_no} (ID: {cid})")
    print(f"DEBUG: Name: {card.name}")
    print(f"DEBUG: Base Blades: {base_blades}")
    try:
        print(f"DEBUG: Ability Text: {getattr(card, 'ability_text', 'N/A')}")
    except:
        pass

    if not card.abilities:
        import pprint

        print("DEBUG: FULL CARD DUMP:")
        pprint.pprint(vars(card))
        pytest.fail(f"Card {card_no} has NO parsed abilities! Parser failure.")

    ability = card.abilities[0]
    print(f"DEBUG: Trigger: {ability.trigger}")
    print(f"DEBUG: Conditions: {ability.conditions}")
    print(f"DEBUG: Effects: {ability.effects}")

    if ability.effects:
        eff = ability.effects[0]
        print(f"DEBUG: Eff[0] detail: Type={eff.effect_type} Value={eff.value} Params={eff.params}")

    assert ability.trigger == 2  # ON_LIVE_START
    assert len(ability.effects) == 1
    eff = ability.effects[0]
    assert eff.effect_type == 1  # ADD_BLADES
    assert eff.value == 1

    print(f"Verified {card_no} data structure.")


def test_verify_eli_bp4_011_n(game):
    """

    Card: PL!-bp4-011-N

    Text: [Live Start] Gain 1 Blade until live end.

    """
    card_no = "PL!-bp4-011-N"
    cid = _find_card_id(game, card_no)
    assert cid is not None

    p0 = game.players[0]
    p0.stage[1] = cid

    card = game.member_db[cid]
    ability = card.abilities[0]

    assert ability.trigger == 2  # ON_LIVE_START
    eff = ability.effects[0]
    assert eff.effect_type == 1  # ADD_BLADES
    assert eff.value == 2
    assert eff.params.get("until") == "live_end"

    print(f"Verified {card_no} data structure.")