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
def test_hermit_exorcism(): # setup rigged gc gc, ef, h, s, n, c = setup_hermit("Hermit\'s Exorcism") gc.ask_h = helpers.answer_sequence([ "Use Hermit\'s Exorcism", h.user_id, 'Do nothing', # test for hunter "Use Hermit\'s Exorcism", s.user_id, 'Receive 2 damage', # test for shadow "Use Hermit\'s Exorcism", n.user_id, 'Do nothing' # test for neutral ]) # Check that hunters do nothing init_damage = h.damage c.use({'self': s, 'card': c}) assert h.damage == init_damage # Check that shadows take 2 damage init_damage = s.damage c.use({'self': h, 'card': c}) assert s.damage == init_damage + 2 # Check that neutrals do nothing init_damage = n.damage c.use({'self': h, 'card': c}) assert n.damage == init_damage
def test_chocolate(): for _ in range(100): # Setup rigged game context gc, ef = helpers.fresh_gc_ef(n_players=7) weak = [ p for p in gc.players if p.character.name in ["Allie", "Ellen", "Ultra Soul"] ][0] strong = [ p for p in gc.players if p.character.name not in ["Allie", "Ellen", "Ultra Soul"] ][0] c = helpers.get_card_by_title(ef, "Chocolate") # Strong player do nothing strong.damage = 3 c.use({'self': strong, 'card': c}) assert strong.state == 2 and strong.damage == 3 # Weak player do nothing gc.ask_h = helpers.answer_sequence( ['Do nothing', 'Reveal and heal fully', 'Heal fully']) weak.damage = 3 c.use({'self': weak, 'card': c}) assert weak.state == 2 and weak.damage == 3 # Weak player reveal and full heal c.use({'self': weak, 'card': c}) assert weak.state == 1 and weak.damage == 0 # Weak player full heal weak.damage = 3 c.use({'self': weak, 'card': c}) assert weak.state == 1 and weak.damage == 0
def test_erstwhile_altar(): # Set up rigged game context gc, ef = H.fresh_gc_ef() area = H.get_area_by_name(gc, "Erstwhile Altar") target = H.get_a_shadow(gc) actor = H.get_a_hunter(gc) gc.ask_h = H.answer_sequence([ target.user_id, 'Holy Robe' # test pick an equipment to steal ]) # Check that nothing happens if no one has equipment area.action(gc, actor) assert all([len(p.equipment) == 0 for p in gc.players]) # Check that nothing happens if only current player has equipment chainsaw = H.get_card_by_title(ef, "Chainsaw") actor.equipment.append(chainsaw) area.action(gc, actor) assert all([len(p.equipment) == 0 for p in gc.players if p != actor]) assert actor.equipment == [chainsaw] # Check that selected equipment is stolen from selected player axe = H.get_card_by_title(ef, "Rusted Broad Axe") roly_hobe = H.get_card_by_title(ef, "Holy Robe") target.equipment.append(axe) target.equipment.append(roly_hobe) area.action(gc, actor) assert actor.equipment == [chainsaw, roly_hobe] assert target.equipment == [axe]
def test_banana_peel(): for _ in range(C.N_ELEMENT_TESTS): # Setup rigged game context gc, ef = H.fresh_gc_ef() p1 = gc.players[0] p2 = gc.players[1] gc.ask_h = H.answer_sequence([ "Receive 1 damage", "Give an equipment card", "Holy Robe", p2.user_id ]) c = H.get_card_by_title(ef, "Banana Peel") # Give p1 holy robe roly_hobe = H.get_card_by_title(ef, "Holy Robe") p1.equipment.append(roly_hobe) # Check take one damage assert p1.damage == 0 c.use({'self': p1, 'card': c}) assert p1.damage == 1 # Check give away equipment c.use({'self': p1, 'card': c}) assert p1.damage == 1 assert not p1.equipment assert p2.equipment == [roly_hobe]
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 test_spiritual_doll(): for _ in range(C.N_ELEMENT_TESTS): # Setup rigged game context gc, ef = H.fresh_gc_ef() p1 = gc.players[0] p2 = gc.players[1] c = H.get_card_by_title(ef, "Spiritual Doll") gc.ask_h = H.answer_sequence( ["Use Spiritual Doll", p2.user_id, "Roll the 6-sided die!"]) # Check that someone gets hit c.use({'self': p1, 'card': c}) assert bool(p1.damage == 3) != bool(p2.damage == 3)
def test_hermit_prediction(): # setup rigged gc gc, ef, h, s, n, c = setup_hermit("Hermit\'s Prediction") gc.ask_h = helpers.answer_sequence([ "Use Hermit\'s Prediction", h.user_id, 'Reveal', ]) # Check that using the card works c.use({'self': s, 'card': c}) # Effects no change on the game state assert 1
def test_hermit_greed(): # setup rigged gc gc, ef, h, s, n, c = setup_hermit("Hermit\'s Greed") gc.ask_h = helpers.answer_sequence([ "Use Hermit\'s Greed", h.user_id, 'Do nothing', # test for hunter "Use Hermit\'s Greed", s.user_id, 'Receive 1 damage', # test for shadow "Use Hermit\'s Greed", n.user_id, 'Receive 1 damage', # test for neutral "Use Hermit\'s Greed", s.user_id, 'Give an equipment card', 'Holy Robe' # test give equipment ]) # Check that hunters do nothing init_damage = h.damage c.use({'self': s, 'card': c}) assert h.damage == init_damage # Check that shadows take 1 damage init_damage = s.damage c.use({'self': h, 'card': c}) assert s.damage == init_damage + 1 # Check that neutrals take 1 damage init_damage = n.damage c.use({'self': h, 'card': c}) assert n.damage == init_damage + 1 # Check that giving equipment works eq = helpers.get_card_by_title(ef, 'Holy Robe') s.equipment.append(eq) init_damage = s.damage c.use({'self': h, 'card': c}) assert s.damage == init_damage assert not s.equipment assert h.equipment == [eq]
def test_weird_woods(): # Set up rigged game context gc, ef = helpers.fresh_gc_ef() area = helpers.get_area_by_name(gc, "Weird Woods") target = helpers.get_a_shadow(gc) actor = helpers.get_a_hunter(gc) gc.ask_h = helpers.answer_sequence([ target.user_id, 'Give 2 damage', # test damage target.user_id, 'Heal 1 damage', # test heal ]) # Check give 2 damage area.action(gc, actor) assert target.damage == 2 # Check heal 1 damage area.action(gc, actor) assert target.damage == 1
def test_hermit_huddle(): # setup rigged gc gc, ef, h, s, n, c = setup_hermit("Hermit\'s Huddle") gc.ask_h = helpers.answer_sequence([ "Use Hermit\'s Huddle", h.user_id, 'Do nothing', # test for hunter "Use Hermit\'s Huddle", s.user_id, 'Heal 1 damage', # test for shadow "Use Hermit\'s Huddle", n.user_id, 'Do nothing', # test for neutral "Use Hermit\'s Huddle", s.user_id, 'Receive 1 damage' # test for shadow (damage) ]) # Check that hunters do nothing h.damage = 1 c.use({'self': s, 'card': c}) assert h.damage == 1 # Check that shadows heal 1 damage s.damage = 1 c.use({'self': h, 'card': c}) assert s.damage == 0 # Check that neutrals do nothing n.damage = 1 c.use({'self': h, 'card': c}) assert n.damage == 1 # Check that shadows take 1 damage when at 0 c.use({'self': h, 'card': c}) assert s.damage == 1
def test_hermit_bully(): # setup rigged gc gc, ef, h, s, n, c = setup_hermit("Hermit\'s Bully", n_players=8) high_p = [p for p in gc.players if p.character.max_damage >= 12][0] low_p = [p for p in gc.players if p.character.max_damage <= 11][0] gc.ask_h = helpers.answer_sequence([ "Use Hermit\'s Bully", high_p.user_id, 'Do nothing', # test for high hp "Use Hermit\'s Bully", low_p.user_id, 'Receive 1 damage', # test for low hp ]) # Check that characters with hp >= 12 do nothing init_damage = high_p.damage c.use({'self': low_p, 'card': c}) assert high_p.damage == init_damage # Check that characters with hp <= 11 take 1 damage init_damage = low_p.damage c.use({'self': high_p, 'card': c}) assert low_p.damage == init_damage + 1