[LCI] Implement Ojer Taq, Deepest Foundation

This commit is contained in:
Susucre 2023-10-26 19:49:29 +02:00
parent 79013a880a
commit b6cedee854
7 changed files with 184 additions and 5 deletions

View file

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

View file

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

View file

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

View file

@ -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("<i>(Transforms from Ojer Taq, Deepest Foundation.)</i>"));
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";
}
}

View file

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

View file

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

View file

@ -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<Token, Integer> entry : tokens.entrySet()) {
entry.setValue(entry.getValue() * 2);
if (condition == null || condition.apply(entry.getKey())) {
entry.setValue(entry.getValue() * factor);
}
}
}