[LCI] Implement Matzalantli, the Great Door

This commit is contained in:
Susucre 2023-10-29 12:07:34 +01:00
parent 385471d27b
commit 73d12d1652
3 changed files with 179 additions and 0 deletions

View file

@ -0,0 +1,121 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.IntCompareCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.SuperType;
import mage.game.Game;
import mage.players.Player;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author Susucr
*/
public final class MatzalantliTheGreatDoor extends CardImpl {
private static final Hint hint = new ValueHint("Permanent types in graveyard", MatzalantliTheGreatDoorValue.instance);
public MatzalantliTheGreatDoor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
this.secondSideCardClazz = mage.cards.t.TheCore.class;
this.supertype.add(SuperType.LEGENDARY);
// {T}: Draw a card, then discard a card.
this.addAbility(new SimpleActivatedAbility(new DrawDiscardControllerEffect(), new TapSourceCost()));
// {4}, {T}: Transform Matzalantli, the Great Door. Activate only if there are four or more permanent types among cards in your graveyard.
this.addAbility(new TransformAbility());
Ability ability = new ConditionalActivatedAbility(
new TransformSourceEffect(),
new GenericManaCost(4),
new MatzalantliTheGreatDoorCondition()
);
ability.addCost(new TapSourceCost());
ability.addHint(hint);
this.addAbility(ability);
}
private MatzalantliTheGreatDoor(final MatzalantliTheGreatDoor card) {
super(card);
}
@Override
public MatzalantliTheGreatDoor copy() {
return new MatzalantliTheGreatDoor(this);
}
}
class MatzalantliTheGreatDoorCondition extends IntCompareCondition {
MatzalantliTheGreatDoorCondition() {
super(ComparisonType.OR_GREATER, 4);
}
@Override
protected int getInputValue(Game game, Ability source) {
return MatzalantliTheGreatDoorValue.instance.calculate(game, source, null);
}
@Override
public String toString() {
return "if there are four or more permanent types among cards in your graveyard";
}
}
enum MatzalantliTheGreatDoorValue implements DynamicValue {
instance;
MatzalantliTheGreatDoorValue() {
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller == null) {
return 0;
}
return controller
.getGraveyard()
.getCards(game)
.stream()
.filter(Objects::nonNull)
.flatMap(card -> card.getCardType(game).stream())
.filter(CardType::isPermanentType)
.collect(Collectors.toSet())
.size();
}
@Override
public MatzalantliTheGreatDoorValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -0,0 +1,56 @@
package mage.cards.t;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.DescendCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.mana.DynamicManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
* @author Susucr
*/
public final class TheCore extends CardImpl {
private static final DynamicValue xValue = new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_PERMANENT);
public TheCore(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
this.supertype.add(SuperType.LEGENDARY);
// (Transforms from Matzalantli.)
this.nightCard = true;
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect("<i>(Transforms from Matzalantli.)</i>"));
ability.setRuleAtTheTop(true);
this.addAbility(ability);
// Fathomless descent -- {T}: Add X mana of any one color, where X is the number of permanent cards in your graveyard.
this.addAbility(new DynamicManaAbility(
Mana.AnyMana(1), xValue, new TapSourceCost(),
"Add X mana of any one color, where X is the number of permanent cards in your graveyard.",
true
).setAbilityWord(AbilityWord.FATHOMLESS_DESCENT).addHint(DescendCondition.getHint()));
}
private TheCore(final TheCore card) {
super(card);
}
@Override
public TheCore copy() {
return new TheCore(this);
}
}

View file

@ -77,6 +77,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Malamet War Scribe", 21, Rarity.UNCOMMON, mage.cards.m.MalametWarScribe.class));
cards.add(new SetCardInfo("Master's Guide-Mural", 233, Rarity.UNCOMMON, mage.cards.m.MastersGuideMural.class));
cards.add(new SetCardInfo("Master's Manufactory", 233, Rarity.UNCOMMON, mage.cards.m.MastersManufactory.class));
cards.add(new SetCardInfo("Matzalantli, the Great Door", 256, Rarity.RARE, mage.cards.m.MatzalantliTheGreatDoor.class));
cards.add(new SetCardInfo("Miner's Guidewing", 24, Rarity.COMMON, mage.cards.m.MinersGuidewing.class));
cards.add(new SetCardInfo("Mischievous Pup", 25, Rarity.UNCOMMON, mage.cards.m.MischievousPup.class));
cards.add(new SetCardInfo("Mountain", 290, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS));
@ -117,6 +118,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Temple of the Dead", 88, Rarity.MYTHIC, mage.cards.t.TempleOfTheDead.class));
cards.add(new SetCardInfo("Terror Tide", 127, Rarity.RARE, mage.cards.t.TerrorTide.class));
cards.add(new SetCardInfo("The Belligerent", 225, Rarity.RARE, mage.cards.t.TheBelligerent.class));
cards.add(new SetCardInfo("The Core", 256, Rarity.RARE, mage.cards.t.TheCore.class));
cards.add(new SetCardInfo("The Grim Captain", 266, Rarity.RARE, mage.cards.t.TheGrimCaptain.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));