/** * 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; }
@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; }; }
@Override public boolean targetMatches( PlayerSide originSide, Card origin, PlayerSide targetSide, Minion targetCharacter, BoardModel board) { if (!super.targetMatches(originSide, origin, targetSide, targetCharacter, board)) { return false; } if (targetCharacter.getHealth() == targetCharacter.getMaxHealth()) { return false; } return true; }