package com.hearthsim.card.basic.spell;
import com.hearthsim.card.minion.Minion;
import com.hearthsim.card.minion.Minion.MinionTribe;
import com.hearthsim.card.spellcard.SpellTargetableCard;
import com.hearthsim.event.effect.EffectCharacter;
import com.hearthsim.event.filter.FilterCharacter;
import com.hearthsim.event.filter.FilterCharacterTargetedSpell;
import com.hearthsim.model.PlayerModel;
import com.hearthsim.model.PlayerSide;
public class TotemicMight extends SpellTargetableCard {
/**
* Constructor
*
* Defaults to hasBeenUsed = false
*/
public TotemicMight() {
super();
}
@Override
public FilterCharacter getTargetableFilter() {
return FilterCharacterTargetedSpell.SELF;
}
/**
*
* Use the card on the given target
*
* Gives all friendly totems +2 health
*
* @return The boardState is manipulated and returned
*/
@Override
public EffectCharacter getTargetableEffect() {
if (this.effect == null) {
this.effect = (targetSide, targetCharacterIndex, boardState) -> {
PlayerModel currentPlayer = boardState.data_.modelForSide(PlayerSide.CURRENT_PLAYER);
for (Minion minion : currentPlayer.getMinions()) {
if (minion.getTribe() == MinionTribe.TOTEM) {
minion.setHealth((byte)(2 + minion.getHealth()));
minion.setMaxHealth((byte)(2 + minion.getMaxHealth()));
}
}
return boardState;
};
}
return this.effect;
}
}