File size: 4,177 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
from engine.game.game_state import initialize_game


def setup_test_state():
    # initialize_game loads real data into GameState.member_db and live_db
    state = initialize_game(use_real_data=True)
    return state


def test_PL_bp3_006_R_maki_ability_zero_success():
    """

    PL!-bp3-006-R (Nishikino Maki)

    [Live Start] Discard 1 from hand: +2 blades for each success live card until live end.

    Test with 0 success lives.

    """
    state = setup_test_state()
    p0 = state.players[0]

    # Maki's Card ID is 26 in cards_compiled.json
    maki_id = 26

    # Setup state
    p0.hand = [1, 2]  # Two dummy cards
    p0.success_lives = []  # 0 success lives

    maki_card = state.member_db[maki_id]
    ability = maki_card.abilities[0]

    # Trigger Maki's ability.
    state.triggered_abilities.append((0, ability, {"card_id": maki_id, "area": 1}))  # Center

    while state.triggered_abilities and not state.pending_choices:
        player_id, ab, context = state.triggered_abilities.pop(0)
        state._play_automatic_ability(player_id, ab, context)

    # Answer the choice: discard card at index 0 (ID 1)
    state._handle_choice(500)

    # Process the effect
    while state.pending_effects or state.triggered_abilities:
        state._resolve_pending_effect(0, {"card_id": maki_id, "area": 1})

    # Verify blade bonus.
    # Python engine: ADD_BLADES with multiplier=True calculates val at resolution.
    # val = 2 * 0 lives = 0.
    # It appends a dict with "effect": Effect(ADD_BLADES, 0, ...)
    found_effect = False
    for effect_dict in p0.continuous_effects:
        effect = effect_dict["effect"]
        # EffectType.ADD_BLADES = 1
        if effect.effect_type.value == 1:
            found_effect = True
            assert effect.value == 0
            # Since Maki's ability usually targets self (MEMBER_SELF),
            # the target_slot should be the area provided in context (1).
            assert effect_dict["target_slot"] == 1

    assert found_effect


def test_PL_bp3_006_R_maki_ability_two_success():
    """

    Test with 2 success lives. Expect +4 blades.

    """
    state = setup_test_state()
    p0 = state.players[0]
    maki_id = 26

    # Setup state: 2 success lives
    p0.hand = [1, 2]
    p0.success_lives = [100, 101]  # Two dummy success lives

    maki_card = state.member_db[maki_id]
    ability = maki_card.abilities[0]

    state.triggered_abilities.append((0, ability, {"card_id": maki_id, "area": 0}))  # Left

    while state.triggered_abilities and not state.pending_choices:
        player_id, ab, context = state.triggered_abilities.pop(0)
        state._play_automatic_ability(player_id, ab, context)

    # Discard 1
    state._handle_choice(500)

    while state.pending_effects or state.triggered_abilities:
        state._resolve_pending_effect(0, {"card_id": maki_id, "area": 0})

    # Verify bonus. 2 lives * 2 blades = 4 blades.
    found = False
    for effect_dict in p0.continuous_effects:
        effect = effect_dict["effect"]
        if effect.effect_type.value == 1:
            found = True
            assert effect.value == 4
            assert effect_dict["target_slot"] == 0
    assert found


def test_PL_bp3_006_R_maki_ability_optional_deny():
    """

    Test denying the optional cost.

    """
    state = setup_test_state()
    p0 = state.players[0]
    maki_id = 26

    p0.hand = [1]
    maki_card = state.member_db[maki_id]
    ability = maki_card.abilities[0]

    state.triggered_abilities.append((0, ability, {"card_id": maki_id, "area": 2}))  # Right

    while state.triggered_abilities and not state.pending_choices:
        player_id, ab, context = state.triggered_abilities.pop(0)
        state._play_automatic_ability(player_id, ab, context)

    # Deny the choice (PASS is action 0)
    state._handle_choice(0)

    while state.pending_effects or state.triggered_abilities:
        state._resolve_pending_effect(0, {"card_id": maki_id, "area": 2})

    # No continuous effect should be added
    assert len(p0.continuous_effects) == 0