Fixed not able to be enchanted by auras.

This commit is contained in:
dragonfyre23 2020-01-27 20:40:28 -05:00
parent ee2b904cca
commit c4d048b5bb

View file

@ -1,9 +1,7 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CantBeTargetedAttachedEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
@ -12,17 +10,13 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author dragonfyre23
* effect based on AntiMagicAura
*/
public final class SpectralShield extends CardImpl {
@ -39,12 +33,11 @@ public final class SpectralShield extends CardImpl {
this.addAbility(ability);
// Enchanted creature get's +0/+2
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(0,2, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(0, 2, Duration.WhileOnBattlefield)));
// Enchanted creature can't be the target of spells and can't be enchanted by other Auras.
// Enchanted creature can't be the target of spells.
CantBeTargetedAttachedEffect cantTargetEffect = new CantBeTargetedAttachedEffect(new FilterSpell("spells"), Duration.WhileOnBattlefield, AttachmentType.AURA, TargetController.ANY);
Ability ability2 = new SimpleStaticAbility(Zone.BATTLEFIELD, cantTargetEffect);
ability2.addEffect(new mage.cards.s.SpectralShieldRuleEffect());
this.addAbility(ability2);
@ -59,37 +52,3 @@ public final class SpectralShield extends CardImpl {
return new mage.cards.s.SpectralShield(this);
}
}
// 9/25/2006 ruling: If Consecrate Land enters the battlefield attached to a land that's enchanted by other Auras, those Auras are put into their owners' graveyards.
class SpectralShieldRuleEffect extends ContinuousRuleModifyingEffectImpl {
public SpectralShieldRuleEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "and can't be enchanted by other Auras";
}
public SpectralShieldRuleEffect(final mage.cards.s.SpectralShieldRuleEffect effect) {
super(effect);
}
@Override
public mage.cards.s.SpectralShieldRuleEffect copy() {
return new mage.cards.s.SpectralShieldRuleEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACH || event.getType() == EventType.STAY_ATTACHED;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent sourceObject = game.getPermanent(source.getSourceId());
if (sourceObject != null && sourceObject.getAttachedTo() != null) {
if (event.getTargetId().equals(sourceObject.getAttachedTo())) {
return !event.getSourceId().equals(source.getSourceId());
}
}
return false;
}
}