diff --git a/Mage.Sets/src/mage/cards/i/IntercessorsArrest.java b/Mage.Sets/src/mage/cards/i/IntercessorsArrest.java new file mode 100644 index 0000000000..f3c78031a5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IntercessorsArrest.java @@ -0,0 +1,97 @@ +package mage.cards.i; + +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.combat.CantAttackBlockAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class IntercessorsArrest extends CardImpl { + + public IntercessorsArrest(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + + this.subtype.add(SubType.AURA); + + // Enchant permanent + TargetPermanent auraTarget = new TargetPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Enchanted permanent can't attack, block, or crew Vehicles. Its activated abilities can't be activated unless they're mana abilities. + Ability ability = new SimpleStaticAbility(new CantAttackBlockAttachedEffect(AttachmentType.AURA) + .setText("Enchanted permanent can't attack, block")); + ability.addEffect(new IntercessorsArrestEffect()); + this.addAbility(ability); + } + + private IntercessorsArrest(final IntercessorsArrest card) { + super(card); + } + + @Override + public IntercessorsArrest copy() { + return new IntercessorsArrest(this); + } +} + +class IntercessorsArrestEffect extends ContinuousRuleModifyingEffectImpl { + + public IntercessorsArrestEffect() { + super(Duration.WhileOnBattlefield, Outcome.Detriment); + staticText = ", or crew Vehicles. Its activated abilities can't be activated unless they're mana abilities"; + } + + private IntercessorsArrestEffect(final IntercessorsArrestEffect effect) { + super(effect); + } + + @Override + public IntercessorsArrestEffect copy() { + return new IntercessorsArrestEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + switch (event.getType()) { + case CREW_VEHICLE: + case ACTIVATE_ABILITY: + return true; + default: + return false; + } + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment == null) { + return false; + } + switch (event.getType()) { + case CREW_VEHICLE: + return enchantment.isAttachedTo(event.getTargetId()); + case ACTIVATE_ABILITY: + if (enchantment.isAttachedTo(event.getSourceId())) { + Optional ability = game.getAbility(event.getTargetId(), event.getSourceId()); + return ability.isPresent() && ability.get().getAbilityType() != AbilityType.MANA; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index dbcc3435aa..965e26a612 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -125,6 +125,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Imperial Recovery Unit", 18, Rarity.UNCOMMON, mage.cards.i.ImperialRecoveryUnit.class)); cards.add(new SetCardInfo("Imperial Subduer", 19, Rarity.COMMON, mage.cards.i.ImperialSubduer.class)); cards.add(new SetCardInfo("Inkrise Infiltrator", 100, Rarity.COMMON, mage.cards.i.InkriseInfiltrator.class)); + cards.add(new SetCardInfo("Intercessor's Arrest", 20, Rarity.COMMON, mage.cards.i.IntercessorsArrest.class)); cards.add(new SetCardInfo("Inventive Iteration", 57, Rarity.RARE, mage.cards.i.InventiveIteration.class)); cards.add(new SetCardInfo("Invigorating Hot Spring", 223, Rarity.UNCOMMON, mage.cards.i.InvigoratingHotSpring.class)); cards.add(new SetCardInfo("Invoke Despair", 101, Rarity.RARE, mage.cards.i.InvokeDespair.class));