[LCI] Implement Ojer Kaslem, Deepest Growth

This commit is contained in:
Susucre 2023-11-02 15:16:59 +01:00
parent dcfbdd6e70
commit 3c837e9dff
4 changed files with 256 additions and 1 deletions

View file

@ -0,0 +1,138 @@
package mage.cards.o;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.*;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.UUID;
/**
* @author Susucr
*/
public final class OjerKaslemDeepestGrowth extends CardImpl {
public OjerKaslemDeepestGrowth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.secondSideCardClazz = mage.cards.t.TempleOfCultivation.class;
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.GOD);
this.power = new MageInt(6);
this.toughness = new MageInt(5);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Whenever Ojer Kaslem deals combat damage to a player, reveal that many cards from the top of your library. You may put a creature card and/or a land card from among them onto the battlefield. Put the rest on the bottom in a random order.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new OjerKaslemDeepestGrowthEffect(), false, true));
// When Ojer Kaslem dies, return it to the battlefield tapped and transformed under its owner's control.
this.addAbility(new TransformAbility());
this.addAbility(new DiesSourceTriggeredAbility(new OjerKaslemDeepestGrowthTransformEffect()));
}
private OjerKaslemDeepestGrowth(final OjerKaslemDeepestGrowth card) {
super(card);
}
@Override
public OjerKaslemDeepestGrowth copy() {
return new OjerKaslemDeepestGrowth(this);
}
}
class OjerKaslemDeepestGrowthTransformEffect extends OneShotEffect {
OjerKaslemDeepestGrowthTransformEffect() {
super(Outcome.Benefit);
staticText = "return it to the battlefield tapped and transformed under its owner's control";
}
private OjerKaslemDeepestGrowthTransformEffect(final OjerKaslemDeepestGrowthTransformEffect effect) {
super(effect);
}
@Override
public OjerKaslemDeepestGrowthTransformEffect copy() {
return new OjerKaslemDeepestGrowthTransformEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (!(sourceObject instanceof Card)) {
return false;
}
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
controller.moveCards((Card) sourceObject, Zone.BATTLEFIELD, source, game, true, false, true, null);
return true;
}
}
/**
* Inspired by {@link mage.cards.g.GishathSunsAvatar}
*/
class OjerKaslemDeepestGrowthEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("a creature card and/or a land card");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate()
));
}
OjerKaslemDeepestGrowthEffect() {
super(Outcome.Benefit);
this.staticText = "reveal that many cards from the top of your library. "
+ "Put may put a creature card and/or a land card from among them onto the battlefield. "
+ "Put the rest on the bottom in a random order";
}
private OjerKaslemDeepestGrowthEffect(final OjerKaslemDeepestGrowthEffect effect) {
super(effect);
}
@Override
public OjerKaslemDeepestGrowthEffect copy() {
return new OjerKaslemDeepestGrowthEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int xValue = (Integer) getValue("damage");
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, xValue));
if (!cards.isEmpty()) {
controller.revealCards(source, cards, game);
TargetCard target = new TargetCard(0, 1, Zone.LIBRARY, filter);
target.withNotTarget(true);
controller.choose(Outcome.PutCardInPlay, cards, target, source, game);
Cards toBattlefield = new CardsImpl(target.getTargets());
cards.removeAll(toBattlefield);
controller.moveCards(toBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, false, false, false, null);
controller.putCardsOnBottomOfLibrary(cards, game, source, false);
}
return true;
}
}

View file

@ -1,18 +1,22 @@
package mage.cards.o;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.Card;
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 mage.players.Player;
import java.util.UUID;
@ -38,7 +42,7 @@ public final class OjerTaqDeepestFoundation extends CardImpl {
// 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()));
this.addAbility(new DiesSourceTriggeredAbility(new OjerTaqDeepestFoundationTransformEffect()));
}
private OjerTaqDeepestFoundation(final OjerTaqDeepestFoundation card) {
@ -51,6 +55,38 @@ public final class OjerTaqDeepestFoundation extends CardImpl {
}
}
class OjerTaqDeepestFoundationTransformEffect extends OneShotEffect {
OjerTaqDeepestFoundationTransformEffect() {
super(Outcome.Benefit);
staticText = "return it to the battlefield tapped and transformed under its owner's control";
}
private OjerTaqDeepestFoundationTransformEffect(final OjerTaqDeepestFoundationTransformEffect effect) {
super(effect);
}
@Override
public OjerTaqDeepestFoundationTransformEffect copy() {
return new OjerTaqDeepestFoundationTransformEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
MageObject sourceObject = source.getSourceObjectIfItStillExists(game);
if (!(sourceObject instanceof Card)) {
return false;
}
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
controller.moveCards((Card) sourceObject, Zone.BATTLEFIELD, source, game, true, false, true, null);
return true;
}
}
class OjerTaqDeepestFoundationTriplingEffect extends ReplacementEffectImpl {
OjerTaqDeepestFoundationTriplingEffect() {

View file

@ -0,0 +1,79 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.IntCompareCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.PermanentsYouControlCount;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.hint.ValueHint;
import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.game.Game;
import java.util.UUID;
/**
* @author Susucr
*/
public final class TempleOfCultivation extends CardImpl {
public TempleOfCultivation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
this.nightCard = true;
// (Transforms from Ojer Kaslem, Deepest Growth.)
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("<i>(Transforms from Ojer Kaslem, Deepest Growth.)</i>"));
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// {T}: Add {G}.
this.addAbility(new GreenManaAbility());
// {2}{G}, {T}: Transform Temple of Cultivation. Activate only if you control ten or more permanents and only as a sorcery.
ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new TransformSourceEffect(),
new ManaCostsImpl("{2}{G}"),
new TempleOfCultivationCondition(),
TimingRule.SORCERY
);
ability.addCost(new TapSourceCost());
ability.addHint(new ValueHint("controlled permanents", PermanentsYouControlCount.instance));
this.addAbility(ability);
}
private TempleOfCultivation(final TempleOfCultivation card) {
super(card);
}
@Override
public TempleOfCultivation copy() {
return new TempleOfCultivation(this);
}
}
class TempleOfCultivationCondition extends IntCompareCondition {
TempleOfCultivationCondition() {
super(ComparisonType.OR_GREATER, 10);
}
@Override
protected int getInputValue(Game game, Ability source) {
return PermanentsYouControlCount.instance.calculate(game, source, null);
}
@Override
public String toString() {
return "if you control ten or more permanents";
}
}

View file

@ -123,6 +123,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Nicanzil, Current Conductor", 236, Rarity.UNCOMMON, mage.cards.n.NicanzilCurrentConductor.class));
cards.add(new SetCardInfo("Nurturing Bristleback", 203, Rarity.COMMON, mage.cards.n.NurturingBristleback.class));
cards.add(new SetCardInfo("Ojer Axonil, Deepest Might", 158, Rarity.MYTHIC, mage.cards.o.OjerAxonilDeepestMight.class));
cards.add(new SetCardInfo("Ojer Kaslem, Deepest Growth", 204, Rarity.MYTHIC, mage.cards.o.OjerKaslemDeepestGrowth.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.COMMON, mage.cards.o.OltecCloudGuard.class));
cards.add(new SetCardInfo("Palani's Hatcher", 237, Rarity.RARE, mage.cards.p.PalanisHatcher.class));
@ -170,6 +171,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Synapse Necromage", 125, Rarity.UNCOMMON, mage.cards.s.SynapseNecromage.class));
cards.add(new SetCardInfo("Tarrian's Soulcleaver", 264, Rarity.RARE, mage.cards.t.TarriansSoulcleaver.class));
cards.add(new SetCardInfo("Temple of Civilization", 26, Rarity.MYTHIC, mage.cards.t.TempleOfCivilization.class));
cards.add(new SetCardInfo("Temple of Cultivation", 204, Rarity.MYTHIC, mage.cards.t.TempleOfCultivation.class));
cards.add(new SetCardInfo("Temple of Power", 158, Rarity.MYTHIC, mage.cards.t.TempleOfPower.class));
cards.add(new SetCardInfo("Temple of the Dead", 88, Rarity.MYTHIC, mage.cards.t.TempleOfTheDead.class));
cards.add(new SetCardInfo("Tendril of the Mycotyrant", 215, Rarity.UNCOMMON, mage.cards.t.TendrilOfTheMycotyrant.class));