Esempio n. 1
0
def _banish_card_from_hand(board, param, my_targets, all_targets):
  assert param == len(my_targets), "Expected %d targets; got %s" % (
    param, str(my_targets))

  for card_name in my_targets:
    card = board.current_player().remove_card_from_hand(card_name)
    board.void.append(card)

    raise_strategy_card_events(board, 'banished_from_deck', card_name)
Esempio n. 2
0
def _banish_card_from_discard(board, param, my_targets, all_targets):
    assert param == len(
        my_targets), "Expected %d targets; got %s" % (param, str(my_targets))

    for card_name in my_targets:
        card = board.current_player().remove_card_from_discard(card_name)
        board.void.append(card)

        raise_strategy_card_events(board, 'banished_from_deck', card_name)
Esempio n. 3
0
  def play_card(self, card_name):
    card = self.remove_card_from_hand(card_name)
    if card.is_construct():
      self.constructs.append(card)
      self.played_constructs.append(card)

      raise_strategy_card_events(self.board, 'construct_placed', card_name)
    else:
      self.played_cards.append(card)
Esempio n. 4
0
def _banish_card_from_center(board, param, my_targets, all_targets):
  assert param == len(my_targets), "Expected %d targets; got %s" % (
    param, str(my_targets))

  assert "Avatar of the Fallen" not in my_targets, "Cannot banish Avatar of the Fallen"

  for card_name in my_targets:
    card = board.remove_card_from_center(card_name)
    board.void.append(card)

    raise_strategy_card_events(board, 'banished_from_center', card_name)
Esempio n. 5
0
def _banish_card_from_center(board, param, my_targets, all_targets):
    assert param == len(
        my_targets), "Expected %d targets; got %s" % (param, str(my_targets))

    assert "Avatar of the Fallen" not in my_targets, "Cannot banish Avatar of the Fallen"

    for card_name in my_targets:
        card = board.remove_card_from_center(card_name)
        board.void.append(card)

        raise_strategy_card_events(board, 'banished_from_center', card_name)
Esempio n. 6
0
  def apply_acquire(self, board):
    assert self.move_type == "acquire"
    assert self.targets is None

    # raises an exception if the card isn't there, or, e.g. there aren't any
    # more Mystics
    card = board.remove_card_from_center(self.card_name)

    # Checks for, e.g., runes toward mechana constructs; will raise an exception
    # if the player can't afford the card.
    board.current_player().pay_for_acquired_card(card)
    board.current_player().acquire(card)

    raise_strategy_card_events(board, 'acquired_card', self.card_name)
Esempio n. 7
0
def _take_random_card_from_each_opponent(board, param, my_targets, all_targets):
  assert len(my_targets) == 0, "Expected no targets; got %s" % str(my_targets)
  opponent_indices = _get_opponent_indices(board)

  for opponent_index in opponent_indices:
    opponent = board.players[opponent_index]
    card_name = random.choice(opponent.hand).name
    card = opponent.remove_card_from_hand(card_name)

    raise_strategy_card_events_for_player(board, opponent_index, 'banished_from_deck', card_name)

    board.current_player().hand.append(card)

    raise_strategy_card_events(board, 'acquired_card', card_name)
Esempio n. 8
0
    def apply_acquire(self, board):
        assert self.move_type == "acquire"
        assert self.targets is None

        # raises an exception if the card isn't there, or, e.g. there aren't any
        # more Mystics
        card = board.remove_card_from_center(self.card_name)

        # Checks for, e.g., runes toward mechana constructs; will raise an exception
        # if the player can't afford the card.
        board.current_player().pay_for_acquired_card(card)
        board.current_player().acquire(card)

        raise_strategy_card_events(board, 'acquired_card', self.card_name)
Esempio n. 9
0
def _acquire_hero(board, param, my_targets, all_targets):
  assert len(my_targets) == 1, "Expected 1 target; got %s" % str(my_targets)

  card_name = my_targets[0]
  card = board.card_dictionary.find_card(card_name)

  assert "Hero" in card.card_type, "Tried to acquire %s, which is not a hero" % (
    card.name)

  assert card.cost <= param, ("Can only use this effect to acquire heros up to %d runes" +
    " (%s costs %d runes)" % (param, card.name, card.cost))

  board.remove_card_from_center(card.name)
  board.current_player().deck.cards.append(card)
  raise_strategy_card_events(board, 'acquired_card', card_name)
Esempio n. 10
0
def _acquire_hero(board, param, my_targets, all_targets):
    assert len(my_targets) == 1, "Expected 1 target; got %s" % str(my_targets)

    card_name = my_targets[0]
    card = board.card_dictionary.find_card(card_name)

    assert "Hero" in card.card_type, "Tried to acquire %s, which is not a hero" % (
        card.name)

    assert card.cost <= param, (
        "Can only use this effect to acquire heros up to %d runes" +
        " (%s costs %d runes)" % (param, card.name, card.cost))

    board.remove_card_from_center(card.name)
    board.current_player().deck.cards.append(card)
    raise_strategy_card_events(board, 'acquired_card', card_name)
Esempio n. 11
0
def _banish_for_additional_turn(board, param, my_targets, all_targets):
  assert len(my_targets) == 1, "Expected 1 target; got %s" % str(my_targets)

  card_name = my_targets[0]
  assert card_name == "Tablet of Time's Dawn"

  board.current_player().should_take_additional_turn = True
  card = board.current_player().remove_card_from_constructs(card_name)
  board.void.append(card)

  raise_strategy_card_events(board, 'banished_from_deck', card_name)

  # we know the only card with this effect is the Tablet of Time's Dawn
  # and it's a construct
  assert card.is_construct()

  raise_strategy_card_events(board, 'construct_removed', card_name)
Esempio n. 12
0
def _take_random_card_from_each_opponent(board, param, my_targets,
                                         all_targets):
    assert len(
        my_targets) == 0, "Expected no targets; got %s" % str(my_targets)
    opponent_indices = _get_opponent_indices(board)

    for opponent_index in opponent_indices:
        opponent = board.players[opponent_index]
        card_name = random.choice(opponent.hand).name
        card = opponent.remove_card_from_hand(card_name)

        raise_strategy_card_events_for_player(board, opponent_index,
                                              'banished_from_deck', card_name)

        board.current_player().hand.append(card)

        raise_strategy_card_events(board, 'acquired_card', card_name)
Esempio n. 13
0
def _banish_for_additional_turn(board, param, my_targets, all_targets):
    assert len(my_targets) == 1, "Expected 1 target; got %s" % str(my_targets)

    card_name = my_targets[0]
    assert card_name == "Tablet of Time's Dawn"

    board.current_player().should_take_additional_turn = True
    card = board.current_player().remove_card_from_constructs(card_name)
    board.void.append(card)

    raise_strategy_card_events(board, 'banished_from_deck', card_name)

    # we know the only card with this effect is the Tablet of Time's Dawn
    # and it's a construct
    assert card.is_construct()

    raise_strategy_card_events(board, 'construct_removed', card_name)
Esempio n. 14
0
  def apply_defeat(self, board):
    assert self.move_type == "defeat"

    # raises an exception if the card isn't there, or, e.g., there aren't any
    # more Heavy Infantry
    card = board.remove_card_from_center(self.card_name)
    assert card.cost <= board.current_player().power_remaining, ("Not enough power" +
      " to defeat %s (%d power remaining)" % (self.card_name, self.power_remaining))

    board.current_player().power_remaining -= card.cost

    if card.name != "Cultist":
      board.give_honor(board.current_player(),
        board.current_player().honor_for_defeating_monster)
      board.current_player().honor_for_defeating_monster = 0

    self._activate_card_effects(board)

    raise_strategy_card_events(board, 'defeated_card', self.card_name)
Esempio n. 15
0
    def apply_defeat(self, board):
        assert self.move_type == "defeat"

        # raises an exception if the card isn't there, or, e.g., there aren't any
        # more Heavy Infantry
        card = board.remove_card_from_center(self.card_name)
        assert card.cost <= board.current_player().power_remaining, (
            "Not enough power" + " to defeat %s (%d power remaining)" %
            (self.card_name, self.power_remaining))

        board.current_player().power_remaining -= card.cost

        if card.name != "Cultist":
            board.give_honor(
                board.current_player(),
                board.current_player().honor_for_defeating_monster)
            board.current_player().honor_for_defeating_monster = 0

        self._activate_card_effects(board)

        raise_strategy_card_events(board, 'defeated_card', self.card_name)