From b6cedee8545474fcffa4b0e96d5be27e5ce198d8 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:49:29 +0200 Subject: [PATCH] [LCI] Implement Ojer Taq, Deepest Foundation --- .../src/mage/cards/d/DoublingSeason.java | 2 +- .../cards/o/OjerTaqDeepestFoundation.java | 93 +++++++++++++++++++ Mage.Sets/src/mage/cards/p/PrimalVigor.java | 2 +- .../mage/cards/t/TempleOfCivilization.java | 74 +++++++++++++++ .../src/mage/sets/TheLostCavernsOfIxalan.java | 2 + .../CreateTwiceThatManyTokensEffect.java | 2 +- .../mage/game/events/CreateTokenEvent.java | 14 ++- 7 files changed, 184 insertions(+), 5 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/o/OjerTaqDeepestFoundation.java create mode 100644 Mage.Sets/src/mage/cards/t/TempleOfCivilization.java diff --git a/Mage.Sets/src/mage/cards/d/DoublingSeason.java b/Mage.Sets/src/mage/cards/d/DoublingSeason.java index f14fb54ac79..47408b9fa94 100644 --- a/Mage.Sets/src/mage/cards/d/DoublingSeason.java +++ b/Mage.Sets/src/mage/cards/d/DoublingSeason.java @@ -72,7 +72,7 @@ class DoublingSeasonTokenEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { if (event instanceof CreateTokenEvent) { - ((CreateTokenEvent) event).doubleTokens(); + ((CreateTokenEvent) event).multiplyTokens(2); } return false; } diff --git a/Mage.Sets/src/mage/cards/o/OjerTaqDeepestFoundation.java b/Mage.Sets/src/mage/cards/o/OjerTaqDeepestFoundation.java new file mode 100644 index 00000000000..b2f593543e5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OjerTaqDeepestFoundation.java @@ -0,0 +1,93 @@ +package mage.cards.o; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesSourceTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.keyword.TransformAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.CreateTokenEvent; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class OjerTaqDeepestFoundation extends CardImpl { + + public OjerTaqDeepestFoundation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); + this.secondSideCardClazz = mage.cards.t.TempleOfCivilization.class; + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.GOD); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // If one or more creature tokens would be created under your control, three times that many of those tokens are created instead. + this.addAbility(new SimpleStaticAbility(new OjerTaqDeepestFoundationTriplingEffect())); + + // When Ojer Taq dies, return it to the battlefield tapped and transformed under its owner's control. + this.addAbility(new TransformAbility()); + this.addAbility(new DiesSourceTriggeredAbility(new OjerAxonilDeepestMightTransformEffect())); + } + + private OjerTaqDeepestFoundation(final OjerTaqDeepestFoundation card) { + super(card); + } + + @Override + public OjerTaqDeepestFoundation copy() { + return new OjerTaqDeepestFoundation(this); + } +} + +class OjerTaqDeepestFoundationTriplingEffect extends ReplacementEffectImpl { + + OjerTaqDeepestFoundationTriplingEffect() { + super(Duration.WhileOnBattlefield, Outcome.Copy); + staticText = "If one or more creature tokens would be created under your control, " + + "three times that many of those tokens are created instead."; + } + + private OjerTaqDeepestFoundationTriplingEffect(final OjerTaqDeepestFoundationTriplingEffect effect) { + super(effect); + } + + @Override + public OjerTaqDeepestFoundationTriplingEffect copy() { + return new OjerTaqDeepestFoundationTriplingEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CREATE_TOKEN; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getPlayerId().equals(source.getControllerId()) + && (((CreateTokenEvent) event) + .getTokens() + .entrySet() + .stream() + .anyMatch(entry -> entry.getKey().isCreature(game) && entry.getValue() > 0)); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + if (event instanceof CreateTokenEvent) { + ((CreateTokenEvent) event).multiplyTokens(3, token -> token.isCreature(game)); + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/p/PrimalVigor.java b/Mage.Sets/src/mage/cards/p/PrimalVigor.java index ca03f315f17..4af593b80ca 100644 --- a/Mage.Sets/src/mage/cards/p/PrimalVigor.java +++ b/Mage.Sets/src/mage/cards/p/PrimalVigor.java @@ -77,7 +77,7 @@ class PrimalVigorTokenEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { if (event instanceof CreateTokenEvent) { - ((CreateTokenEvent) event).doubleTokens(); + ((CreateTokenEvent) event).multiplyTokens(2); } return false; } diff --git a/Mage.Sets/src/mage/cards/t/TempleOfCivilization.java b/Mage.Sets/src/mage/cards/t/TempleOfCivilization.java new file mode 100644 index 00000000000..822413abd75 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TempleOfCivilization.java @@ -0,0 +1,74 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.abilities.mana.WhiteManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TimingRule; +import mage.constants.Zone; +import mage.game.Game; +import mage.watchers.common.PlayerAttackedWatcher; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class TempleOfCivilization extends CardImpl { + + public TempleOfCivilization(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); + this.nightCard = true; + + // (Transforms from Ojer Taq, Deepest Foundation.) + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("(Transforms from Ojer Taq, Deepest Foundation.)")); + ability.setRuleAtTheTop(true); + this.addAbility(ability); + + // {T}: Add {W}. + this.addAbility(new WhiteManaAbility()); + + // {2}{W}, {T}: Transform Temple of Civilization. Activate only if you attacked with three or more creatures this turn and only as a sorcery. + ability = new ActivateIfConditionActivatedAbility( + Zone.BATTLEFIELD, + new TransformSourceEffect(), + new ManaCostsImpl("{2}{W}"), + TempleOfCivilizationCondition.instance, + TimingRule.SORCERY + ); + ability.addCost(new TapSourceCost()); + this.addAbility(ability, new PlayerAttackedWatcher()); + } + + private TempleOfCivilization(final TempleOfCivilization card) { + super(card); + } + + @Override + public TempleOfCivilization copy() { + return new TempleOfCivilization(this); + } +} + +enum TempleOfCivilizationCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + PlayerAttackedWatcher watcher = game.getState().getWatcher(PlayerAttackedWatcher.class); + return watcher != null && watcher.getNumberOfAttackersCurrentTurn(source.getControllerId()) >= 3; + } + + @Override + public String toString() { + return "you attacked with three or more creatures this turn"; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java index 0b589abfba9..7cb6258a02e 100644 --- a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java @@ -49,6 +49,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Mischievous Pup", 25, Rarity.UNCOMMON, mage.cards.m.MischievousPup.class)); cards.add(new SetCardInfo("Mountain", 399, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ojer Axonil, Deepest Might", 158, Rarity.MYTHIC, mage.cards.o.OjerAxonilDeepestMight.class)); + cards.add(new SetCardInfo("Ojer Taq, Deepest Foundation", 26, Rarity.MYTHIC, mage.cards.o.OjerTaqDeepestFoundation.class)); cards.add(new SetCardInfo("Oltec Cloud Guard", 28, Rarity.UNCOMMON, mage.cards.o.OltecCloudGuard.class)); cards.add(new SetCardInfo("Plains", 393, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Poison Dart Frog", 207, Rarity.COMMON, mage.cards.p.PoisonDartFrog.class)); @@ -60,6 +61,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Song of Stupefaction", 77, Rarity.COMMON, mage.cards.s.SongOfStupefaction.class)); cards.add(new SetCardInfo("Spyglass Siren", 78, Rarity.UNCOMMON, mage.cards.s.SpyglassSiren.class)); cards.add(new SetCardInfo("Swamp", 397, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Temple of Civilization", 26, Rarity.MYTHIC, mage.cards.t.TempleOfCivilization.class)); cards.add(new SetCardInfo("Temple of Power", 158, Rarity.MYTHIC, mage.cards.t.TempleOfPower.class)); cards.add(new SetCardInfo("The Skullspore Nexus", 212, Rarity.MYTHIC, mage.cards.t.TheSkullsporeNexus.class)); cards.add(new SetCardInfo("Thrashing Brontodon", 216, Rarity.UNCOMMON, mage.cards.t.ThrashingBrontodon.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/replacement/CreateTwiceThatManyTokensEffect.java b/Mage/src/main/java/mage/abilities/effects/common/replacement/CreateTwiceThatManyTokensEffect.java index 428c3cd34fa..042dfccd0a7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/replacement/CreateTwiceThatManyTokensEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/replacement/CreateTwiceThatManyTokensEffect.java @@ -44,7 +44,7 @@ public class CreateTwiceThatManyTokensEffect extends ReplacementEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { if (event instanceof CreateTokenEvent) { - ((CreateTokenEvent) event).doubleTokens(); + ((CreateTokenEvent) event).multiplyTokens(2); } return false; } diff --git a/Mage/src/main/java/mage/game/events/CreateTokenEvent.java b/Mage/src/main/java/mage/game/events/CreateTokenEvent.java index f6122b270b0..5033a7a4244 100644 --- a/Mage/src/main/java/mage/game/events/CreateTokenEvent.java +++ b/Mage/src/main/java/mage/game/events/CreateTokenEvent.java @@ -28,9 +28,19 @@ public class CreateTokenEvent extends GameEvent { return tokens; } - public void doubleTokens() { + public void multiplyTokens(int factor) { + multiplyTokens(factor, null); + } + + public interface ConditionOnToken { + boolean apply(Token token); + } + + public void multiplyTokens(int factor, ConditionOnToken condition) { for (Map.Entry entry : tokens.entrySet()) { - entry.setValue(entry.getValue() * 2); + if (condition == null || condition.apply(entry.getKey())) { + entry.setValue(entry.getValue() * factor); + } } }