def test_advent():

    for _ in range(100):
        # Setup rigged game context
        gc, ef = helpers.fresh_gc_ef(random.randint(5, 8))
        h = helpers.get_a_hunter(gc)
        s = helpers.get_a_shadow(gc)
        n = helpers.get_a_neutral(gc)
        c = helpers.get_card_by_title(ef, "Advent")

        # Check that shadows do nothing
        s.damage = 3
        c.use({'self': s, 'card': c})
        assert s.state == 2 and s.damage == 3

        # Check that neutrals do nothing
        n.damage = 3
        c.use({'self': n, 'card': c})
        assert n.state == 2 and n.damage == 3

        # Hunter do nothing
        gc.ask_h = helpers.answer_sequence(
            ['Do nothing', 'Reveal and heal fully', 'Heal fully'])
        h.damage = 3
        c.use({'self': h, 'card': c})
        assert h.state == 2 and h.damage == 3

        # Hunter reveal and full heal
        c.use({'self': h, 'card': c})
        assert h.state == 1 and h.damage == 0

        # Hunter full heal
        h.damage = 3
        c.use({'self': h, 'card': c})
        assert h.state == 1 and h.damage == 0
示例#2
0
def test_diabolic_ritual():

    for _ in range(C.N_ELEMENT_TESTS):
        # Setup rigged game context
        gc, ef = H.fresh_gc_ef(random.randint(5, 8))
        h = H.get_a_hunter(gc)
        s = H.get_a_shadow(gc)
        n = H.get_a_neutral(gc)
        c = H.get_card_by_title(ef, "Diabolic Ritual")

        # Check that hunters do nothing
        h.damage = 3
        c.use({'self': h, 'card': c})
        assert h.state == C.PlayerState.Hidden and h.damage == 3

        # Check that neutrals do nothing
        n.damage = 3
        c.use({'self': n, 'card': c})
        assert n.state == C.PlayerState.Hidden and n.damage == 3

        # Shadow do nothing
        gc.ask_h = H.answer_sequence(['Do nothing', 'Reveal and heal fully'])
        s.damage = 3
        c.use({'self': s, 'card': c})
        assert s.state == C.PlayerState.Hidden and s.damage == 3

        # Shadow reveal and full heal
        c.use({'self': s, 'card': c})
        assert s.state == C.PlayerState.Revealed and s.damage == 0
def setup_hermit(title, n_players=random.randint(5, 8)):
    """
    Return a game context, element factory, a hunter, shadow
    and neutral from that game, and a card of a given title
    """
    gc, ef = helpers.fresh_gc_ef(n_players)
    h = helpers.get_a_hunter(gc)
    s = helpers.get_a_shadow(gc)
    n = helpers.get_a_neutral(gc)
    c = helpers.get_card_by_title(ef, title)
    return (gc, ef, h, s, n, c)
def test_disenchant_mirror():

    for _ in range(100):
        # Setup rigged game context
        gc, ef = helpers.fresh_gc_ef(random.randint(5, 8))
        h = helpers.get_a_hunter(gc)
        s = helpers.get_a_shadow(gc)
        n = helpers.get_a_neutral(gc)
        c = helpers.get_card_by_title(ef, "Disenchant Mirror")

        # Check that shadows reveal
        c.use({'self': s, 'card': c})
        assert s.state == 1

        # Check that hunters do nothing
        c.use({'self': h, 'card': c})
        assert h.state == 2

        # Check that neutrals do nothing
        c.use({'self': n, 'card': c})
        assert n.state == 2
示例#5
0
def test_disenchant_mirror():

    for _ in range(C.N_ELEMENT_TESTS):
        # Setup rigged game context
        gc, ef = H.fresh_gc_ef(random.randint(5, 8))
        h = H.get_a_hunter(gc)
        s = H.get_a_shadow(gc)
        n = H.get_a_neutral(gc)
        c = H.get_card_by_title(ef, "Disenchant Mirror")

        # Check that shadows reveal
        c.use({'self': s, 'card': c})
        assert s.state == C.PlayerState.Revealed

        # Check that hunters do nothing
        c.use({'self': h, 'card': c})
        assert h.state == C.PlayerState.Hidden

        # Check that neutrals do nothing
        c.use({'self': n, 'card': c})
        assert n.state == C.PlayerState.Hidden