def post_roll_actions(self, active_player): # TODO, refactor to other method if active_player.has_instance_of_card(EnergyHoarder()): EnergyHoarder().special_effect( active_player, self.players.get_all_alive_players_minus_current_player()) if active_player.has_instance_of_card(SolarPowered()): SolarPowered().special_effect( active_player, self.players.get_all_alive_players_minus_current_player()) if active_player.has_instance_of_card(RootingForTheUnderdog()): RootingForTheUnderdog().special_effect( active_player, self.players.get_all_alive_players_minus_current_player()) self.check_if_winner(active_player)
def test_generate_player_status_with_cards_summary(): player1 = Player() player1.add_card(EnergyHoarder()) player1.add_card(SolarPowered()) player2 = Player() player2.add_card(EvenBigger()) player_queue = GamePlayers() player_queue.add_player_to_game(player1) player_queue.add_player_to_game(player2) player_queue.set_player_order() actual_summary: [] = generate_player_status_summary(player_queue) expected_p1_dictionary = player1.generate_player_status_as_dictionary() expected_p2_dictionary = player2.generate_player_status_as_dictionary() expected_summary: [] = [expected_p1_dictionary, expected_p2_dictionary] assert actual_summary == expected_summary
def test_solar_powered_costs_4_energy(): assert SolarPowered().cost == 4
def test_solar_powered_player_add_card(player: Player): SolarPowered().immediate_effect(player, None) assert player.has_instance_of_card(SolarPowered())
def test_solar_powered_gain_1_star_when_energy_is_0(player): player.energy = 0 SolarPowered().immediate_effect(player, None) SolarPowered().special_effect(player, None) assert player.energy == 1
def get_all_cards(): """ Serves as the master list of all cards to add to the deck. Create lists to reflect package structure and add individual cards to each list. If a new list is created extend it onto the full_list_of_cards """ energy_manipulation_cards = [Energize()] health_manipulation_cards = [FireBlast(), HighAltitudeBombing()] multi_manipulation_cards = [ GasRefinery(), JetFighters(), NationalGuard(), NuclearPowerPlant(), Tanks(), VastStorm() ] victory_point_manipulation_cards = [ ApartmentBuilding(), CommuterTrain(), CornerStore(), DropFromHighAltitude(), EvacuationOrders(), Skyscraper() ] turn_manipulation_cards = [Frenzy()] discard_cards = [] discard_cards.extend(health_manipulation_cards) discard_cards.extend(energy_manipulation_cards) discard_cards.extend(multi_manipulation_cards) discard_cards.extend(victory_point_manipulation_cards) discard_cards.extend(turn_manipulation_cards) keep_cards = [] keep_attack_manipulation_cards = [NovaBreath(), SpikedTail()] keep_energy_manipulation_cards = [ EnergyHoarder(), FriendOfChildren(), SolarPowered(), WereOnlyMakingItStronger(), AlienMetabolism() ] keep_health_manipulation_cards = [ ItHasAChild(), EvenBigger(), Regeneration(), ArmorPlating() ] keep_victory_point_manipulation_cards = [ AlphaMonster(), CompleteDestruction(), DedicatedNewsTeam(), Gourmet(), Omnivore(), EaterOfTheDead() ] keep_turn_manipulation_cards = [GiantBrain()] keep_cards = [] keep_cards.extend(keep_attack_manipulation_cards) keep_cards.extend(keep_energy_manipulation_cards) keep_cards.extend(keep_health_manipulation_cards) keep_cards.extend(keep_victory_point_manipulation_cards) keep_cards.extend(keep_turn_manipulation_cards) full_list_of_cards = [] full_list_of_cards.extend(discard_cards) full_list_of_cards.extend(keep_cards) return full_list_of_cards