From ac17f7b92b9782dba7fad4dca41ec252a30bef6e Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 15 Apr 2020 22:03:17 -0400 Subject: [PATCH] Implemented Predatory Impetus --- .../src/mage/cards/p/PredatoryImpetus.java | 108 ++++++++++++++++++ .../src/mage/sets/Commander2020Edition.java | 1 + 2 files changed, 109 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PredatoryImpetus.java diff --git a/Mage.Sets/src/mage/cards/p/PredatoryImpetus.java b/Mage.Sets/src/mage/cards/p/PredatoryImpetus.java new file mode 100644 index 00000000000..4422d7bacb9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PredatoryImpetus.java @@ -0,0 +1,108 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.common.GoadAttachedAbility; +import mage.abilities.effects.RequirementEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PredatoryImpetus extends CardImpl { + + public PredatoryImpetus(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +3/+3, must be blocked if able, and is goaded. + this.addAbility(new GoadAttachedAbility( + new BoostEnchantedEffect(3, 3) + .setText("Enchanted creature gets +3/+3,"), + new PredatoryImpetusEffect() + )); + } + + private PredatoryImpetus(final PredatoryImpetus card) { + super(card); + } + + @Override + public PredatoryImpetus copy() { + return new PredatoryImpetus(this); + } +} + +class PredatoryImpetusEffect extends RequirementEffect { + + PredatoryImpetusEffect() { + super(Duration.WhileOnBattlefield); + staticText = "must be blocked if able,"; + } + + private PredatoryImpetusEffect(final PredatoryImpetusEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + Permanent attachment = game.getPermanent(source.getSourceId()); + if (attachment != null && attachment.getAttachedTo() != null) { + Permanent attachedCreature = game.getPermanent(attachment.getAttachedTo()); + if (attachedCreature != null && attachedCreature.isAttacking()) { + return permanent.canBlock(attachment.getAttachedTo(), game); + } + } + return false; + } + + @Override + public boolean mustAttack(Game game) { + return false; + } + + @Override + public boolean mustBlock(Game game) { + return false; + } + + @Override + public UUID mustBlockAttacker(Ability source, Game game) { + Permanent attachment = game.getPermanent(source.getSourceId()); + if (attachment != null && attachment.getAttachedTo() != null) { + return attachment.getAttachedTo(); + } + return null; + } + + @Override + public int getMinNumberOfBlockers() { + return 1; + } + + @Override + public PredatoryImpetusEffect copy() { + return new PredatoryImpetusEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index d1cd37b9028..7bf9810cf5c 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -223,6 +223,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Portal Mage", 122, Rarity.RARE, mage.cards.p.PortalMage.class)); cards.add(new SetCardInfo("Prairie Stream", 299, Rarity.RARE, mage.cards.p.PrairieStream.class)); cards.add(new SetCardInfo("Predator Ooze", 185, Rarity.RARE, mage.cards.p.PredatorOoze.class)); + cards.add(new SetCardInfo("Predatory Impetus", 62, Rarity.UNCOMMON, mage.cards.p.PredatoryImpetus.class)); cards.add(new SetCardInfo("Profane Command", 135, Rarity.RARE, mage.cards.p.ProfaneCommand.class)); cards.add(new SetCardInfo("Propaganda", 123, Rarity.UNCOMMON, mage.cards.p.Propaganda.class)); cards.add(new SetCardInfo("Prophetic Bolt", 227, Rarity.RARE, mage.cards.p.PropheticBolt.class));