async def test_play_round_end_round_one_shelter_destroyed(zombie): gs = GameState() gs.players = [PlayerShelter('0'), PlayerShelter('1'), PlayerShelter('2')] gs.supply_deck = [ Supply.AXE, Supply.AXE, Supply.AXE, Supply.AXE, Supply.AXE, Supply.AXE ] for player in gs.players: player.survivors = [CityCard()] gs.players[0].zombies = [zombie] gs.active_player = gs.players[0] shelter = gs.active_player shelter.print = dumper_factory() shelter.input = helper_factory(['3', '3']) shelter.survivors = [CityCard()] shelter.supplies = [Supply.AXE, Supply.BARRICADES, Supply.ALARM] await gs.play_round() assert len(shelter.supplies) == 0 assert shelter.defeated assert gs.active_player != shelter shelter = gs.active_player shelter.print = dumper_factory() shelter.input = helper_factory(['3', '3']) await gs.play_round() assert len(shelter.supplies) == 3 assert not shelter.defeated assert gs.active_player != shelter shelter = gs.active_player shelter.print = dumper_factory() shelter.input = helper_factory(['3', '3']) await gs.play_round() assert len(shelter.supplies) == 3 assert not shelter.defeated assert gs.active_player != shelter
def test_get_supplies(): gs = GameState() gs.active_player = PlayerShelter() gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] gs.get_supplies() assert len(gs.supply_deck) == 1 assert gs.supply_deck[0] == Supply.GUN assert len(gs.active_player.supplies) == 3 gs = GameState() gs.active_player = PlayerShelter() gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] gs.active_player.supplies = [Supply.RADIO, Supply.DRONE] gs.get_supplies() assert len(gs.supply_deck) == 3 assert gs.supply_deck[0] == Supply.ALARM assert len(gs.active_player.supplies) == 3
async def test_end_active_player_turn_no_zombies(): gs = GameState() gs.players = [PlayerShelter(), PlayerShelter(), PlayerShelter()] survivor_card = CityCard(ZombieType.ZOMBIE) survivor_card.flip() for player in gs.players: player.survivors.append(survivor_card) gs.active_player = gs.players[2] gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] await gs.end_active_player_turn() assert gs.active_player == gs.players[0] assert len(gs.players[2].supplies) == 3
async def test_play_round(): gs = GameState() gs.players = [PlayerShelter('0'), PlayerShelter('1')] gs.players[1].survivors = [CityCard()] gs.active_player = gs.players[0] gs.supply_deck = [Supply.DRONE, Supply.DRONE] shelter = gs.active_player shelter.print = dumper_factory() shelter.input = helper_factory(['3', '1', '2']) shelter.survivors = [CityCard()] shelter.supplies = [Supply.AXE, Supply.BARRICADES, Supply.ALARM] await gs.play_round() assert len(shelter.supplies) == 3 assert Supply.BARRICADES not in shelter.supplies assert Supply.DRONE in shelter.supplies assert len(gs.supply_deck) == 1 assert gs.active_player != shelter
async def test_play_round_last_supplies(zombie): gs = GameState() gs.players = [PlayerShelter('0'), PlayerShelter('1')] gs.supply_deck = [Supply.SACRIFICE, Supply.DRONE, Supply.GUN] gs.city_deck = [CityCard()] gs.players[1].survivors = [CityCard()] gs.active_player = gs.players[0] shelter = gs.active_player shelter.print = dumper_factory() shelter.input = helper_factory(['0', '0', '0', 'y']) shelter.survivors = [CityCard()] shelter.zombies = [zombie] shelter.supplies = [Supply.RADIO, Supply.BARRICADES, Supply.ALARM] await gs.play_round() assert len(shelter.supplies) == 3 assert gs.final_attack assert gs.last_supplies_taken assert gs.active_player != shelter
async def test_end_active_player_turn_zombies_no_obstacles(): gs = GameState() gs.players = [PlayerShelter(), PlayerShelter(), PlayerShelter()] survivor_card = CityCard(ZombieType.ZOMBIE) survivor_card.flip() for player in gs.players: player.survivors.append(survivor_card) gs.active_player = gs.players[2] gs.active_player.print = dumper_factory() gs.active_player.supplies = [Supply.AXE, Supply.ALARM] zombie_card = CityCard(ZombieType.ZOMBIE) zombie_card.flip() gs.active_player.zombies = [zombie_card] gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] await gs.end_active_player_turn() assert gs.active_player == gs.players[0] assert len(gs.players[2].supplies) == 0 assert len(tests.common.outputs) == 2
async def test_end_active_player_turn_zombies_and_alarm( fast_zombie, zombie, big_zombie): gs = GameState() gs.players = [PlayerShelter(), PlayerShelter(), PlayerShelter()] survivor_card = CityCard(ZombieType.ZOMBIE) for player in gs.players: player.survivors.append(survivor_card) survivor_card.flip() gs.city_deck.append(survivor_card) gs.supply_deck = [Supply.AXE, Supply.ALARM, Supply.AXE, Supply.GUN] gs.active_player = gs.players[2] shelter = gs.active_player shelter.obstacles = [Supply.ALARM, Supply.ALARM] shelter.zombies = [fast_zombie, zombie, big_zombie] shelter.print = dumper_factory() shelter.input = helper_factory(['y']) await gs.end_active_player_turn() assert len(shelter.survivors) == 1 assert len(shelter.zombies) == 4 assert len(gs.city_deck) == 0 assert len(shelter.obstacles) == 1 assert len(gs.supply_graveyard) == 1 assert len(shelter.supplies) == 3 assert len(tests.common.outputs) == 7