MOM: Added card "Omnath, Locus of All" and its abilities and effects (#10029)

* MOM: Added card "Omnath, Locus of All" and its abilities and effects

* fixed rule text

* added art variant

* test

---------

Co-authored-by: Daniel Eberhard <daniel.h.e@gmx.de>
Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
Merlingilb 2023-04-15 19:16:51 +02:00 committed by GitHub
parent 3b909d7b2a
commit 0623f52f68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 161 additions and 4 deletions

View file

@ -0,0 +1,139 @@
package mage.cards.o;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.mana.AddManaInAnyCombinationEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.game.Game;
import mage.players.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class OmnathLocusOfAll extends CardImpl {
public OmnathLocusOfAll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B/P}{R}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.addSubType(SubType.PHYREXIAN);
this.addSubType(SubType.ELEMENTAL);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
//If you would lose unspent mana, that mana becomes black instead.
this.addAbility(new SimpleStaticAbility(new OmnathLocusOfAllManaEffect()));
//At the beginning of your precombat main phase, look at the top card of your library. You may reveal that card
//if it has three or more colored mana symbols in its mana cost. If you do, add three mana in any combination of
//colors and put it into your hand. If you dont reveal it, put it into your hand.
this.addAbility(new BeginningOfPreCombatMainTriggeredAbility(
new OmnathLocusOfAllCardEffect(), TargetController.YOU, false
));
}
private OmnathLocusOfAll(final OmnathLocusOfAll card) {
super(card);
}
@Override
public OmnathLocusOfAll copy() {
return new OmnathLocusOfAll(this);
}
}
class OmnathLocusOfAllManaEffect extends ContinuousEffectImpl {
OmnathLocusOfAllManaEffect() {
super(Duration.WhileOnBattlefield, Layer.RulesEffects, SubLayer.NA, Outcome.Benefit);
staticText = "if you would lose unspent mana, that mana becomes black instead";
}
private OmnathLocusOfAllManaEffect(final OmnathLocusOfAllManaEffect effect) {
super(effect);
}
@Override
public OmnathLocusOfAllManaEffect copy() {
return new OmnathLocusOfAllManaEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.getManaPool().setManaBecomesBlack(true);
}
return true;
}
}
class OmnathLocusOfAllCardEffect extends OneShotEffect {
public OmnathLocusOfAllCardEffect() {
super(Outcome.Benefit);
this.staticText = "look at the top card of your library. You may reveal that card if it has three or more " +
"colored mana symbols in its mana cost. If you do, add three mana in any combination of colors and " +
"put it into your hand. If you don't reveal it, put it into your hand.";
}
public OmnathLocusOfAllCardEffect(final OmnathLocusOfAllCardEffect effect) {
super(effect);
}
@Override
public OmnathLocusOfAllCardEffect copy() {
return new OmnathLocusOfAllCardEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Card card = player.getLibrary().getFromTop(game);
if (card == null) {
return false;
}
player.lookAtCards(null, card, game);
int amountOfDifferentManaColors = 0;
List<ColoredManaSymbol> manaList = new ArrayList<>();
if (card.getManaCost().containsColor(ColoredManaSymbol.W)) {
amountOfDifferentManaColors++;
manaList.add(ColoredManaSymbol.W);
}
if (card.getManaCost().containsColor(ColoredManaSymbol.U)) {
amountOfDifferentManaColors++;
manaList.add(ColoredManaSymbol.U);
}
if (card.getManaCost().containsColor(ColoredManaSymbol.B)) {
amountOfDifferentManaColors++;
manaList.add(ColoredManaSymbol.B);
}
if (card.getManaCost().containsColor(ColoredManaSymbol.R)) {
amountOfDifferentManaColors++;
manaList.add(ColoredManaSymbol.R);
}
if (card.getManaCost().containsColor(ColoredManaSymbol.G)) {
amountOfDifferentManaColors++;
manaList.add(ColoredManaSymbol.G);
}
if (amountOfDifferentManaColors > 2) {
if (!player.chooseUse(outcome, "Reveal " + card.getName() + '?', source, game)) {
player.moveCards(card, Zone.HAND, source, game);
return true;
}
player.revealCards(source, new CardsImpl(card), game);
new AddManaInAnyCombinationEffect(3, manaList.toArray(new ColoredManaSymbol[0])).apply(game, source);
}
player.moveCards(card, Zone.HAND, source, game);
return true;
}
}

View file

@ -179,6 +179,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Jin-Gitaxias", 65, Rarity.MYTHIC, mage.cards.j.JinGitaxias.class)); cards.add(new SetCardInfo("Jin-Gitaxias", 65, Rarity.MYTHIC, mage.cards.j.JinGitaxias.class));
cards.add(new SetCardInfo("Joyful Stormsculptor", 243, Rarity.UNCOMMON, mage.cards.j.JoyfulStormsculptor.class)); cards.add(new SetCardInfo("Joyful Stormsculptor", 243, Rarity.UNCOMMON, mage.cards.j.JoyfulStormsculptor.class));
cards.add(new SetCardInfo("Jungle Hollow", 270, Rarity.COMMON, mage.cards.j.JungleHollow.class)); cards.add(new SetCardInfo("Jungle Hollow", 270, Rarity.COMMON, mage.cards.j.JungleHollow.class));
cards.add(new SetCardInfo("Omnath, Locus of All", 249, Rarity.RARE, mage.cards.o.OmnathLocusOfAll.class));
cards.add(new SetCardInfo("Moment of Truth", 67, Rarity.COMMON, mage.cards.m.MomentOfTruth.class)); cards.add(new SetCardInfo("Moment of Truth", 67, Rarity.COMMON, mage.cards.m.MomentOfTruth.class));
cards.add(new SetCardInfo("Kami of Whispered Hopes", 196, Rarity.UNCOMMON, mage.cards.k.KamiOfWhisperedHopes.class)); cards.add(new SetCardInfo("Kami of Whispered Hopes", 196, Rarity.UNCOMMON, mage.cards.k.KamiOfWhisperedHopes.class));
cards.add(new SetCardInfo("Karsus Depthguard", 150, Rarity.COMMON, mage.cards.k.KarsusDepthguard.class)); cards.add(new SetCardInfo("Karsus Depthguard", 150, Rarity.COMMON, mage.cards.k.KarsusDepthguard.class));

View file

@ -38,6 +38,7 @@ public class ManaPool implements Serializable {
private final List<ManaPoolItem> poolBookmark = new ArrayList<>(); // mana pool bookmark for rollback purposes private final List<ManaPoolItem> poolBookmark = new ArrayList<>(); // mana pool bookmark for rollback purposes
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>(); private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>();
private boolean manaBecomesBlack = false;
private boolean manaBecomesColorless = false; private boolean manaBecomesColorless = false;
private static final class ConditionalManaInfo { private static final class ConditionalManaInfo {
@ -71,6 +72,7 @@ public class ManaPool implements Serializable {
poolBookmark.add(item.copy()); poolBookmark.add(item.copy());
} }
this.doNotEmptyManaTypes.addAll(pool.doNotEmptyManaTypes); this.doNotEmptyManaTypes.addAll(pool.doNotEmptyManaTypes);
this.manaBecomesBlack = pool.manaBecomesBlack;
this.manaBecomesColorless = pool.manaBecomesColorless; this.manaBecomesColorless = pool.manaBecomesColorless;
} }
@ -225,6 +227,7 @@ public class ManaPool implements Serializable {
public void clearEmptyManaPoolRules() { public void clearEmptyManaPoolRules() {
doNotEmptyManaTypes.clear(); doNotEmptyManaTypes.clear();
this.manaBecomesBlack = false;
this.manaBecomesColorless = false; this.manaBecomesColorless = false;
} }
@ -232,6 +235,14 @@ public class ManaPool implements Serializable {
doNotEmptyManaTypes.add(manaType); doNotEmptyManaTypes.add(manaType);
} }
public void setManaBecomesBlack(boolean manaBecomesBlack) {
this.manaBecomesBlack = manaBecomesBlack;
}
public boolean isManaBecomesBlack() {
return manaBecomesBlack;
}
public void setManaBecomesColorless(boolean manaBecomesColorless) { public void setManaBecomesColorless(boolean manaBecomesColorless) {
this.manaBecomesColorless = manaBecomesColorless; this.manaBecomesColorless = manaBecomesColorless;
} }
@ -274,15 +285,21 @@ public class ManaPool implements Serializable {
&& game.getTurnPhaseType() != TurnPhase.END) { && game.getTurnPhaseType() != TurnPhase.END) {
return 0; return 0;
} }
if (!manaBecomesColorless) { if (manaBecomesBlack) {
int amount = toEmpty.get(manaType); int amount = toEmpty.get(manaType);
toEmpty.clear(manaType); toEmpty.clear(manaType);
return amount; toEmpty.add(ManaType.BLACK, amount);
return 0;
}
if (manaBecomesColorless) {
int amount = toEmpty.get(manaType);
toEmpty.clear(manaType);
toEmpty.add(ManaType.COLORLESS, amount);
return 0;
} }
int amount = toEmpty.get(manaType); int amount = toEmpty.get(manaType);
toEmpty.clear(manaType); toEmpty.clear(manaType);
toEmpty.add(ManaType.COLORLESS, amount); return amount;
return 0;
} }
public Mana getMana() { public Mana getMana() {