示例#1
0
    def buy_card_from_store(self, index, purchasing_player: Player,
                            other_players):
        card_to_buy: Card = self.__card_store[index]
        card_cost = card_to_buy.cost
        if purchasing_player.has_instance_of_card(AlienMetabolism()):
            card_cost = card_to_buy.cost - 1
        if purchasing_player.energy < card_cost:
            raise InsufficientFundsException(constants.INSUFFICIENT_FUNDS_MSG)
        else:
            purchasing_player.update_energy_by(-card_cost)
            if purchasing_player.has_instance_of_card(DedicatedNewsTeam()):
                DedicatedNewsTeam().special_effect(purchasing_player, None)
            if isinstance(card_to_buy, DiscardCard):
                print("{} is a discard card".format(card_to_buy.name))

                # if the card is DropFromHighAltitude, we have to prompt player, and then consumers.py will handle
                # triggering the immediate_effect
                if not isinstance(card_to_buy, DropFromHighAltitude):
                    card_to_buy.immediate_effect(purchasing_player,
                                                 other_players)
                self.discard(card_to_buy)
            elif isinstance(card_to_buy, KeepCard):
                card_to_buy.immediate_effect(purchasing_player, other_players)
            else:
                print("UNEXPECTED CARD TYPE!!!")
                raise UnexpectedCardTypeException
            self.__card_store.remove(card_to_buy)
            self.__fill_card_store()
        return card_to_buy
示例#2
0
文件: attack.py 项目: otaiwo70/kot
def get_attackable_players(attacking_player: Player, other_players, is_dice_roll=True):
    attackable_players = []

    if is_dice_roll and attacking_player.has_instance_of_card(NovaBreath()):
        return other_players
    else:
        for other_player in other_players:
            if is_attackable(attacking_player, other_player):
                attackable_players.append(other_player)
        return attackable_players
示例#3
0
def test_solar_powered_player_add_card(player: Player):
    SolarPowered().immediate_effect(player, None)
    assert player.has_instance_of_card(SolarPowered())