* Estrid, the Masked - fixed problems with with first and second ability (fixes #5223).

This commit is contained in:
LevelX2 2018-08-25 14:30:31 +02:00
parent 2f8b8c7f06
commit 9e88d847ed
3 changed files with 15 additions and 7 deletions

View file

@ -9,12 +9,12 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect; import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect;
import mage.abilities.effects.common.UntapAllControllerEffect; import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterEnchantmentCard; import mage.filter.common.FilterEnchantmentCard;
@ -107,7 +107,9 @@ class EstridTheMaskedTokenEffect extends OneShotEffect {
if (token == null) { if (token == null) {
continue; continue;
} }
token.attachTo(source.getFirstTarget(), game); token.getAbilities().get(0).getTargets().get(0).add(source.getFirstTarget(), game);
token.getAbilities().get(0).getEffects().get(0).apply(game, token.getAbilities().get(0));
// token.attachTo(source.getFirstTarget(), game);
} }
return true; return true;
} }

View file

@ -1410,7 +1410,7 @@ public abstract class GameImpl implements Game, Serializable {
} }
} }
} }
@Override @Override
public void resetControlAfterSpellResolve(UUID topId) { public void resetControlAfterSpellResolve(UUID topId) {
// for Word of Command // for Word of Command
@ -1958,7 +1958,12 @@ public abstract class GameImpl implements Game, Serializable {
} }
} }
} else { } else {
SpellAbility spellAbility = perm.getSpellAbility(); Ability spellAbility = perm.getSpellAbility();
if (spellAbility == null) {
if (!perm.getAbilities().isEmpty()) {
spellAbility = perm.getAbilities().get(0); // Can happen for created tokens (e.g. Estrid, the Masked)
}
}
if (spellAbility.getTargets().isEmpty()) { if (spellAbility.getTargets().isEmpty()) {
for (Ability ability : perm.getAbilities(this)) { for (Ability ability : perm.getAbilities(this)) {
if ((ability instanceof SpellAbility) if ((ability instanceof SpellAbility)

View file

@ -1,12 +1,12 @@
package mage.game.permanent.token; package mage.game.permanent.token;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.TotemArmorAbility; import mage.abilities.keyword.TotemArmorAbility;
import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
/** /**
@ -27,6 +27,7 @@ public final class MaskToken extends TokenImpl {
TargetPermanent auraTarget = new TargetPermanent(); TargetPermanent auraTarget = new TargetPermanent();
Ability ability = new EnchantAbility(auraTarget.getTargetName()); Ability ability = new EnchantAbility(auraTarget.getTargetName());
ability.addTarget(auraTarget);
ability.addEffect(new AttachEffect(Outcome.BoostCreature)); ability.addEffect(new AttachEffect(Outcome.BoostCreature));
this.addAbility(ability); this.addAbility(ability);