[MH3] Implement Echoes of Eternity

This commit is contained in:
theelk801 2024-05-17 18:49:52 -04:00
parent d3e530e00e
commit 1247cb204b
3 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.e;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CopyTargetStackObjectEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorlessPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.NumberOfTriggersEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EchoesOfEternity extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a colorless spell");
static {
filter.add(ColorlessPredicate.instance);
}
public EchoesOfEternity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.TRIBAL, CardType.ENCHANTMENT}, "{3}{C}{C}{C}");
this.subtype.add(SubType.ELDRAZI);
// If a triggered ability of a colorless spell you control or another colorless permanent you control triggers, that ability triggers an additional time.
this.addAbility(new SimpleStaticAbility(new EchoesOfEternityEffect()));
// Whenever you cast a colorless spell, copy it. You may choose new targets for the copy.
this.addAbility(new SpellCastControllerTriggeredAbility(new CopyTargetStackObjectEffect(
false, false, true
).withText("it"), filter, false, SetTargetPointer.SPELL));
}
private EchoesOfEternity(final EchoesOfEternity card) {
super(card);
}
@Override
public EchoesOfEternity copy() {
return new EchoesOfEternity(this);
}
}
class EchoesOfEternityEffect extends ReplacementEffectImpl {
EchoesOfEternityEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "if a triggered ability of a colorless spell you control or another " +
"colorless permanent you control triggers, that ability triggers an additional time";
}
private EchoesOfEternityEffect(final EchoesOfEternityEffect effect) {
super(effect);
}
@Override
public EchoesOfEternityEffect copy() {
return new EchoesOfEternityEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!(event instanceof NumberOfTriggersEvent)
|| !source.isControlledBy(game.getControllerId(event.getSourceId()))) {
return false;
}
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null && permanent.getColor(game).isColorless()) {
return true;
}
Spell spell = game.getSpell(event.getSourceId());
return spell != null && spell.getColor(game).isColorless();
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.overflowInc(event.getAmount(), 1));
return false;
}
}

View file

@ -28,6 +28,7 @@ public final class ModernHorizons3 extends ExpansionSet {
cards.add(new SetCardInfo("Breaker of Creation", 1, Rarity.UNCOMMON, mage.cards.b.BreakerOfCreation.class));
cards.add(new SetCardInfo("Chthonian Nightmare", 83, Rarity.RARE, mage.cards.c.ChthonianNightmare.class));
cards.add(new SetCardInfo("Devourer of Destiny", 2, Rarity.RARE, mage.cards.d.DevourerOfDestiny.class));
cards.add(new SetCardInfo("Echoes of Eternity", 4, Rarity.RARE, mage.cards.e.EchoesOfEternity.class));
cards.add(new SetCardInfo("Emrakul, the World Anew", 6, Rarity.MYTHIC, mage.cards.e.EmrakulTheWorldAnew.class));
cards.add(new SetCardInfo("Flare of Cultivation", 154, Rarity.RARE, mage.cards.f.FlareOfCultivation.class));
cards.add(new SetCardInfo("Flare of Denial", 62, Rarity.RARE, mage.cards.f.FlareOfDenial.class));

View file

@ -136,6 +136,7 @@ public class VerifyCardDataTest {
// supertype
// skipListAddName(SKIP_LIST_SUPERTYPE, set, cardName);
skipListAddName(SKIP_LIST_SUPERTYPE, "MH3", "Echoes of Eternity"); // waiting for tribal -> kindred change
// type
// skipListAddName(SKIP_LIST_TYPE, set, cardName);