diff --git a/Mage.Sets/src/mage/cards/t/TheoreticalDuplication.java b/Mage.Sets/src/mage/cards/t/TheoreticalDuplication.java new file mode 100644 index 0000000000..03b6b2b61f --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheoreticalDuplication.java @@ -0,0 +1,83 @@ +package mage.cards.t; + +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.CreateTokenCopyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.PermanentToken; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheoreticalDuplication extends CardImpl { + + public TheoreticalDuplication(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); + + // Whenever a nontoken creature enters the battlefield under an opponent's control this turn, create a token that's a copy of that creature. + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new TheoreticalDuplicationTriggeredAbility())); + } + + private TheoreticalDuplication(final TheoreticalDuplication card) { + super(card); + } + + @Override + public TheoreticalDuplication copy() { + return new TheoreticalDuplication(this); + } +} + +class TheoreticalDuplicationTriggeredAbility extends DelayedTriggeredAbility { + + private static final CreateTokenCopyTargetEffect makeEffect() { + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(); + effect.setUseLKI(true); + return effect; + } + + TheoreticalDuplicationTriggeredAbility() { + super(makeEffect(), Duration.EndOfTurn, false, false); + } + + private TheoreticalDuplicationTriggeredAbility(final TheoreticalDuplicationTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + EntersTheBattlefieldEvent eEvent = (EntersTheBattlefieldEvent) event; + if (!eEvent.getTarget().isCreature() + || eEvent.getTarget() instanceof PermanentToken + || !game.getOpponents(getControllerId()).contains(eEvent.getTarget().getControllerId())) { + return false; + } + getEffects().setTargetPointer(new FixedTarget(eEvent.getTarget(), game)); + return true; + } + + @Override + public TheoreticalDuplicationTriggeredAbility copy() { + return new TheoreticalDuplicationTriggeredAbility(this); + } + + @Override + public String getRule() { + return "Whenever a nontoken creature enters the battlefield under an opponent's control this turn, " + + "create a token that's a copy of that creature."; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index c243a6e987..bb028e5c15 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -300,6 +300,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Tempting Contract", 78, Rarity.RARE, mage.cards.t.TemptingContract.class)); cards.add(new SetCardInfo("Terastodon", 207, Rarity.RARE, mage.cards.t.Terastodon.class)); cards.add(new SetCardInfo("Teysa, Envoy of Ghosts", 230, Rarity.RARE, mage.cards.t.TeysaEnvoyOfGhosts.class)); + cards.add(new SetCardInfo("Theoretical Duplication", 34, Rarity.RARE, mage.cards.t.TheoreticalDuplication.class)); cards.add(new SetCardInfo("Thopter Engineer", 181, Rarity.UNCOMMON, mage.cards.t.ThopterEngineer.class)); cards.add(new SetCardInfo("Thousand-Year Elixir", 271, Rarity.RARE, mage.cards.t.ThousandYearElixir.class)); cards.add(new SetCardInfo("Tivash, Gloom Summoner", 45, Rarity.RARE, mage.cards.t.TivashGloomSummoner.class));