[LTR] Implement Fall of Cair Andros

This commit is contained in:
theelk801 2023-06-09 18:26:13 -04:00
parent 68cc6e96f1
commit 11c137603e
2 changed files with 91 additions and 0 deletions

View file

@ -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.";
}
}

View file

@ -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));