From 55e4be568babd25ca3db2f91fd92996bd31c7baa Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 5 Jun 2018 22:24:12 -0400 Subject: [PATCH] Implemented Ferocity --- Mage.Sets/src/mage/cards/f/Ferocity.java | 96 +++++++++++++++++++ Mage.Sets/src/mage/sets/MercadianMasques.java | 1 + 2 files changed, 97 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/Ferocity.java diff --git a/Mage.Sets/src/mage/cards/f/Ferocity.java b/Mage.Sets/src/mage/cards/f/Ferocity.java new file mode 100644 index 00000000000..e607d59004c --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/Ferocity.java @@ -0,0 +1,96 @@ +package mage.cards.f; + +import java.util.UUID; +import mage.constants.SubType; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.counter.AddCountersAttachedEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author TheElk801 + */ +public final class Ferocity extends CardImpl { + + public Ferocity(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{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); + + // Whenever enchanted creature blocks or becomes blocked, you may put a +1/+1 counter on it. + this.addAbility(new FerocityTriggeredAbility()); + } + + public Ferocity(final Ferocity card) { + super(card); + } + + @Override + public Ferocity copy() { + return new Ferocity(this); + } +} + +class FerocityTriggeredAbility extends TriggeredAbilityImpl { + + public FerocityTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersAttachedEffect(CounterType.P1P1.createInstance(), "it"), true); + } + + public FerocityTriggeredAbility(final FerocityTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.BLOCKER_DECLARED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent aura = game.getPermanent(sourceId); + if (aura == null || aura.getAttachedTo() == null) { + return false; + } + if (event.getSourceId().equals(aura.getAttachedTo())) { + Permanent blocks = game.getPermanent(event.getTargetId()); + return blocks != null; + } + if (event.getTargetId().equals(aura.getAttachedTo())) { + Permanent blockedBy = game.getPermanent(event.getSourceId()); + return blockedBy != null; + } + return false; + } + + @Override + public String getRule() { + return "Whenever enchanted creature blocks or becomes blocked, " + + "you may put a +1/+1 counter on it"; + } + + @Override + public FerocityTriggeredAbility copy() { + return new FerocityTriggeredAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/MercadianMasques.java b/Mage.Sets/src/mage/sets/MercadianMasques.java index d6cc0d7ffc6..17e4fd6dcc2 100644 --- a/Mage.Sets/src/mage/sets/MercadianMasques.java +++ b/Mage.Sets/src/mage/sets/MercadianMasques.java @@ -121,6 +121,7 @@ public final class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Extortion", 135, Rarity.RARE, mage.cards.e.Extortion.class)); cards.add(new SetCardInfo("Eye of Ramos", 294, Rarity.RARE, mage.cards.e.EyeOfRamos.class)); cards.add(new SetCardInfo("False Demise", 80, Rarity.UNCOMMON, mage.cards.f.FalseDemise.class)); + cards.add(new SetCardInfo("Ferocity", 245, Rarity.COMMON, mage.cards.f.Ferocity.class)); cards.add(new SetCardInfo("Flailing Manticore", 187, Rarity.RARE, mage.cards.f.FlailingManticore.class)); cards.add(new SetCardInfo("Flailing Ogre", 188, Rarity.UNCOMMON, mage.cards.f.FlailingOgre.class)); cards.add(new SetCardInfo("Flailing Soldier", 189, Rarity.COMMON, mage.cards.f.FlailingSoldier.class));