File size: 1,660 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
import pytest
from pytest_bdd import given, scenario, then, when

from engine.game.game_state import GameState
from engine.models.ability import Effect, EffectType


@pytest.fixture
def game_state():
    return GameState()


@scenario("../features/deck_operations.feature", "Reveal Cards Effect")
def test_reveal_cards():
    pass


@scenario("../features/deck_operations.feature", "Cheer Reveal Effect")
def test_cheer_reveal():
    pass


@given("a player has 3 cards in deck", target_fixture="p0")
def player_deck_3(game_state):
    p0 = game_state.players[0]
    p0.main_deck = [10, 20, 30]
    return p0


@given("a player has a card in deck", target_fixture="p0")
def player_deck_1(game_state):
    p0 = game_state.players[0]
    p0.main_deck = [99]
    return p0


@when('the player resolves a "Reveal 2 Cards" effect')
def resolve_reveal_2(game_state, p0):
    eff = Effect(EffectType.REVEAL_CARDS, 2, params={"from": "deck"})
    game_state.pending_effects.append(eff)
    game_state._resolve_pending_effect(0)


@when('the player resolves a "Cheer Reveal" effect')
def resolve_cheer(game_state, p0):
    eff = Effect(EffectType.CHEER_REVEAL, 1)
    game_state.pending_effects.append(eff)
    game_state._resolve_pending_effect(0)


@then("2 cards should be revealed")
def check_reveal_count(game_state):
    assert len(game_state.looked_cards) == 2


@then("the main deck should have 1 card remaining")
def check_deck_remaining(p0):
    assert len(p0.main_deck) == 1


@then("the top card should be revealed")
def check_top_reveal(game_state):
    assert game_state.looked_cards == [99]