fixed Elemental Appeal not properly pumping tokens it creates

This commit is contained in:
Evan Kranzler 2018-05-14 12:24:39 -04:00
parent 954237e5ff
commit 9b53aebab8

View file

@ -27,20 +27,25 @@
*/
package mage.cards.e;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.LockedInCondition;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.game.Game;
import mage.game.permanent.token.ElementalAppealElementalToken;
@ -56,13 +61,8 @@ public class ElementalAppeal extends CardImpl {
// Kicker {5}
this.addAbility(new KickerAbility("{5}"));
// Create a 7/1 red Elemental creature token with trample and haste. Exile it at the beginning of the next end step.
// Create a 7/1 red Elemental creature token with trample and haste. Exile it at the beginning of the next end step. If Elemental Appeal was kicked, that creature gets +7/+0 until end of turn.
this.getSpellAbility().addEffect(new ElementalAppealEffect());
// If Elemental Appeal was kicked, that creature gets +7/+0 until end of turn.
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
new BoostTargetEffect(7, 0, Duration.EndOfTurn),
new LockedInCondition(KickedCondition.instance),
"if this spell was kicked, that creature gets +7/+0 until end of turn"));
}
public ElementalAppeal(final ElementalAppeal card) {
@ -79,7 +79,9 @@ class ElementalAppealEffect extends OneShotEffect {
public ElementalAppealEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Create a 7/1 red Elemental creature token with trample and haste. Exile it at the beginning of the next end step";
this.staticText = "Create a 7/1 red Elemental creature token with trample and haste. "
+ "Exile it at the beginning of the next end step. "
+ "If this spell was kicked, that creature gets +7/+0 until end of turn";
}
public ElementalAppealEffect(final ElementalAppealEffect effect) {
@ -93,10 +95,20 @@ class ElementalAppealEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
CreateTokenEffect effect = new CreateTokenEffect(new ElementalAppealElementalToken());
if (effect.apply(game, source)) {
effect.exileTokensCreatedAtNextEndStep(game, source);
if (KickedCondition.instance.apply(game, source)) {
List<Predicate<MageObject>> predList = new ArrayList<>();
for (UUID tokenId : effect.getLastAddedTokenIds()) {
predList.add(new CardIdPredicate(tokenId));
}
if (predList.size() > 0) {
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(Predicates.or(predList));
game.addEffect(new BoostAllEffect(7, 0, Duration.EndOfTurn, filter, false), source);
}
}
return true;
}
return false;