Esempio n. 1
0
  /**
   * Use the card on the given target
   *
   * <p>Gives all friendly totems +2 health
   *
   * @param thisCardIndex The index (position) of the card in the hand
   * @param playerIndex The index of the target player. 0 if targeting yourself or your own minions,
   *     1 if targeting the enemy
   * @param minionIndex The index of the target minion.
   * @param boardState The BoardState before this card has performed its action. It will be
   *     manipulated and returned.
   * @return The boardState is manipulated and returned
   */
  @Override
  protected HearthTreeNode use_core(
      int targetPlayerIndex,
      Minion targetMinion,
      HearthTreeNode boardState,
      Deck deckPlayer0,
      Deck deckPlayer1,
      boolean singleRealizationOnly)
      throws HSException {
    if (!(targetMinion instanceof Hero) || targetPlayerIndex == 1) {
      return null;
    }

    HearthTreeNode toRet =
        super.use_core(
            targetPlayerIndex,
            targetMinion,
            boardState,
            deckPlayer0,
            deckPlayer1,
            singleRealizationOnly);
    if (toRet != null) {
      for (Minion minion : toRet.data_.getMinions_p0()) {
        if (minion instanceof Totem) {
          minion.setHealth((byte) (2 + minion.getHealth()));
          minion.setMaxHealth((byte) (2 + minion.getMaxHealth()));
        }
      }
    }
    return toRet;
  }
Esempio n. 2
0
 @Override
 public EffectCharacter<Minion> getBattlecryEffect() {
   return (PlayerSide targetSide,
       CharacterIndex targetCharacterIndex,
       HearthTreeNode boardState) -> {
     Minion targetCharacter = boardState.data_.getCharacter(targetSide, targetCharacterIndex);
     Voljin.this.setHealth(targetCharacter.getHealth());
     Voljin.this.setMaxHealth(targetCharacter.getMaxHealth());
     targetCharacter.setHealth((byte) 2);
     targetCharacter.setMaxHealth((byte) 2);
     return boardState;
   };
 }
  @Before
  public void setup() throws HSException {
    board = new HearthTreeNode(new BoardState());

    Minion minion0_0 = new Minion("" + 0, mana, attack0, health0, attack0, health0, health0);
    Minion minion0_1 =
        new Minion("" + 0, mana, attack0, (byte) (health1 - 1), attack0, health1, health1);
    Minion minion1_0 = new Minion("" + 0, mana, attack0, health0, attack0, health0, health0);
    Minion minion1_1 =
        new Minion("" + 0, mana, attack0, (byte) (health1 - 1), attack0, health1, health1);
    Minion minion1_2 = new Abomination();

    minion1_2.setHealth((byte) 1);

    board.data_.placeMinion(0, minion0_0);
    board.data_.placeMinion(0, minion0_1);

    board.data_.placeMinion(1, minion1_0);
    board.data_.placeMinion(1, minion1_1);
    board.data_.placeMinion(1, minion1_2);

    Card cards[] = new Card[10];
    for (int index = 0; index < 10; ++index) {
      cards[index] = new TheCoin();
    }

    deck = new Deck(cards);

    Minion fb = new ElvenArcher();
    board.data_.placeCard_hand_p0(fb);

    board.data_.setMana_p0((byte) 7);
    board.data_.setMana_p1((byte) 4);

    board.data_.setMaxMana_p0((byte) 7);
    board.data_.setMaxMana_p1((byte) 4);
  }