* Fixed a problem with TapEnchantedEffect that could cause cast exceptions (fixes #5509).

This commit is contained in:
LevelX2 2019-01-12 15:18:53 +01:00
parent 6ea09f2c51
commit 0e19ffd173

View file

@ -1,10 +1,8 @@
package mage.abilities.effects.common;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -15,17 +13,17 @@ import mage.game.permanent.Permanent;
public class TapEnchantedEffect extends OneShotEffect {
public TapEnchantedEffect() {
super(Outcome.Tap);
staticText = "tap enchanted creature";
}
super(Outcome.Tap);
staticText = "tap enchanted creature";
}
public TapEnchantedEffect(final TapEnchantedEffect effect) {
super(effect);
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObject(game);
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent != null) {
Permanent attach = game.getPermanent(permanent.getAttachedTo());
if (attach != null) {
@ -41,4 +39,4 @@ public class TapEnchantedEffect extends OneShotEffect {
return new TapEnchantedEffect(this);
}
}
}