File size: 1,289 Bytes
9fca766
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Content loading: every authored card, deck, and encounter must parse."""

from scrypt.data import load_content
from scrypt.engine.cards import CostType


def test_content_loads():
    content = load_content()
    assert len(content.pool) >= 15
    assert "vanilla" in content.starter_decks
    assert "first_blood" in content.encounters


def test_starter_decks_are_full_and_carry_free_fodder():
    content = load_content()
    assert set(content.starter_decks) >= {"vanilla", "forkstorm", "graveyard"}
    for deck_id, deck in content.starter_decks.items():
        cards = deck["cards"]
        assert len(cards) >= 7, f"{deck_id} too thin"
        free = sum(1 for c in cards if c.cost.type.value == "free")
        cheap = sum(1 for c in cards if c.cost.amount <= 1)
        assert free >= 1, f"{deck_id} has no free fodder"
        assert cheap >= len(cards) // 2, f"{deck_id} curve too steep"


def test_bit_is_free_fodder():
    content = load_content()
    bit = content.card("bit")
    assert bit.cost.type is CostType.FREE
    assert bit.power == 0


def test_encounter_script_lanes_in_range():
    content = load_content()
    for enc in content.encounters.values():
        for turn in enc["script"]:
            for play in turn:
                assert 0 <= play.lane < 4