package com.hearthsim.card.basic.spell;
import com.hearthsim.card.basic.minion.Sheep;
import com.hearthsim.card.spellcard.SpellTargetableCard;
import com.hearthsim.event.effect.EffectCharacter;
import com.hearthsim.event.filter.FilterCharacter;
import com.hearthsim.event.filter.FilterCharacterTargetedSpell;
public class Polymorph extends SpellTargetableCard {
/**
* Constructor
*
* @param hasBeenUsed Whether the card has already been used or not
*/
@Deprecated
public Polymorph(boolean hasBeenUsed) {
this();
this.hasBeenUsed = hasBeenUsed;
}
/**
* Constructor
*
* Defaults to hasBeenUsed = false
*/
public Polymorph() {
super();
}
@Override
public FilterCharacter getTargetableFilter() {
return FilterCharacterTargetedSpell.ALL_MINIONS;
}
/**
*
* Use the card on the given target
*
* Transform a minion into 1/1 sheep
*
* @return The boardState is manipulated and returned
*/
@Override
public EffectCharacter getTargetableEffect() {
if (this.effect == null) {
this.effect = (targetSide, targetCharacterIndex, boardState) -> {
Sheep sheep = new Sheep();
boardState.data_.removeMinion(targetSide, targetCharacterIndex);
boardState.data_.placeMinion(targetSide, sheep, targetCharacterIndex.indexToLeft());
return boardState;
};
}
return this.effect;
}
}