diff --git a/Mage.Sets/src/mage/cards/f/FallOfCairAndros.java b/Mage.Sets/src/mage/cards/f/FallOfCairAndros.java new file mode 100644 index 00000000000..55c252915be --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FallOfCairAndros.java @@ -0,0 +1,90 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.keyword.AmassEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.DamagedPermanentEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FallOfCairAndros extends CardImpl { + + public FallOfCairAndros(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + + // Whenever a creature an opponent controls is dealt excess noncombat damage, amass Orcs X, where X is that excess damage. + this.addAbility(new FallOfCairAndrosTriggeredAbility()); + + // {7}{R}: Fall of Cair Andros deals 7 damage to target creature. + Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(7), new ManaCostsImpl("{7}{R}")); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + private FallOfCairAndros(final FallOfCairAndros card) { + super(card); + } + + @Override + public FallOfCairAndros copy() { + return new FallOfCairAndros(this); + } +} + +class FallOfCairAndrosTriggeredAbility extends TriggeredAbilityImpl { + + FallOfCairAndrosTriggeredAbility() { + super(Zone.BATTLEFIELD, null); + } + + private FallOfCairAndrosTriggeredAbility(final FallOfCairAndrosTriggeredAbility ability) { + super(ability); + } + + @Override + public FallOfCairAndrosTriggeredAbility copy() { + return new FallOfCairAndrosTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent == null || !permanent.isCreature(game) + || !game.getOpponents(getControllerId()).contains(permanent.getControllerId())) { + return false; + } + DamagedPermanentEvent dEvent = (DamagedPermanentEvent) event; + if (dEvent.isCombatDamage() || dEvent.getExcess() < 1) { + return false; + } + this.getEffects().clear(); + this.addEffect(new AmassEffect(dEvent.getExcess(), SubType.ORC)); + return true; + } + + @Override + public String getRule() { + return "Whenever a creature an opponent controls is dealt excess noncombat damage, " + + "amass Orcs X, where X is that excess damage."; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 9bcaff154e5..304358bbbe5 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -50,6 +50,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Ent-Draught Basin", 238, Rarity.UNCOMMON, mage.cards.e.EntDraughtBasin.class)); cards.add(new SetCardInfo("Eowyn, Fearless Knight", 201, Rarity.RARE, mage.cards.e.EowynFearlessKnight.class)); cards.add(new SetCardInfo("Erkenbrand, Lord of Westfold", 123, Rarity.UNCOMMON, mage.cards.e.ErkenbrandLordOfWestfold.class)); + cards.add(new SetCardInfo("Fall of Cair Andros", 124, Rarity.RARE, mage.cards.f.FallOfCairAndros.class)); cards.add(new SetCardInfo("Fall of Gil-galad", 165, Rarity.RARE, mage.cards.f.FallOfGilGalad.class)); cards.add(new SetCardInfo("Fangorn, Tree Shepherd", 166, Rarity.RARE, mage.cards.f.FangornTreeShepherd.class)); cards.add(new SetCardInfo("Fiery Inscription", 126, Rarity.UNCOMMON, mage.cards.f.FieryInscription.class));