implement [MH3] Drowner of Truth // Drowned Jungle

This commit is contained in:
Susucre 2024-05-23 16:49:13 +02:00
parent 263c836375
commit f30ec10846
4 changed files with 152 additions and 4 deletions

View file

@ -0,0 +1,68 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.DevoidAbility;
import mage.abilities.mana.BlueManaAbility;
import mage.abilities.mana.GreenManaAbility;
import mage.cards.CardSetInfo;
import mage.cards.ModalDoubleFacedCard;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.game.permanent.token.EldraziSpawnToken;
import java.util.UUID;
/**
* @author Susucr
*/
public final class DrownerOfTruth extends ModalDoubleFacedCard {
public DrownerOfTruth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo,
new CardType[]{CardType.CREATURE}, new SubType[]{SubType.ELDRAZI}, "{5}{G/U}{G/U}",
"Drowned Jungle", new CardType[]{CardType.LAND}, new SubType[]{}, ""
);
// 1.
// Drowner of Truth
// Creature Eldrazi
this.getLeftHalfCard().setPT(new MageInt(7), new MageInt(6));
// Devoid
this.getLeftHalfCard().addAbility(new DevoidAbility(this.color));
// When you cast this spell, if {C} was spent to cast it, create two 0/1 colorless Eldrazi Spawn creature tokens with "Sacrifice this creature: Add {C}."
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new CastSourceTriggeredAbility(new CreateTokenEffect(new EldraziSpawnToken(), 2)),
ManaWasSpentCondition.COLORLESS,
"When you cast this spell, if {C} was spent to cast it, "
+ "create two 0/1 colorless Eldrazi Spawn creature tokens with \"Sacrifice this creature: Add {C}.");
this.getLeftHalfCard().addAbility(ability);
// 2.
// Drowned Jungle
// Land
// Drowned Jungle enters the battlefield tapped.
this.getRightHalfCard().addAbility(new EntersBattlefieldTappedAbility());
// {T}: Add {G} or {U}.
this.getRightHalfCard().addAbility(new GreenManaAbility());
this.getRightHalfCard().addAbility(new BlueManaAbility());
}
private DrownerOfTruth(final DrownerOfTruth card) {
super(card);
}
@Override
public DrownerOfTruth copy() {
return new DrownerOfTruth(this);
}
}

View file

@ -37,6 +37,7 @@ public final class ModernHorizons3 extends ExpansionSet {
cards.add(new SetCardInfo("Deserted Temple", 301, Rarity.RARE, mage.cards.d.DesertedTemple.class));
cards.add(new SetCardInfo("Devourer of Destiny", 2, Rarity.RARE, mage.cards.d.DevourerOfDestiny.class));
cards.add(new SetCardInfo("Drossclaw", 89, Rarity.COMMON, mage.cards.d.Drossclaw.class));
cards.add(new SetCardInfo("Drowner of Truth", 253, Rarity.UNCOMMON, mage.cards.d.DrownerOfTruth.class));
cards.add(new SetCardInfo("Echoes of Eternity", 4, Rarity.RARE, mage.cards.e.EchoesOfEternity.class));
cards.add(new SetCardInfo("Eladamri, Korvecdal", 149, Rarity.MYTHIC, mage.cards.e.EladamriKorvecdal.class));
cards.add(new SetCardInfo("Eldrazi Ravager", 5, Rarity.UNCOMMON, mage.cards.e.EldraziRavager.class));

View file

@ -0,0 +1,58 @@
package org.mage.test.cards.single.mh3;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author Susucr
*/
public class DrownerOfTruthTest extends CardTestPlayerBase {
/**
* {@link mage.cards.d.DrownerOfTruth Drowner of Truth} {5}{G/U}{G/U}
* Creature Eldrazi
* Devoid (This card has no color.)
* When you cast this spell, if {C} was spent to cast it, create two 0/1 colorless Eldrazi Spawn creature tokens with Sacrifice this creature: Add {C}.
* 7/6
* Drowned Jungle
* Land
* Drowned Jungle enters the battlefield tapped.
* {T}: Add {G} or {U}.
*/
private static final String drowner = "Drowner of Truth";
@Test
public void test_Cast_NoColorless() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, drowner);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, drowner);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, 7 + 1);
}
@Test
public void test_Cast_Colorless() {
setStrictChooseMode(true);
addCard(Zone.HAND, playerA, drowner);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Wastes", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, drowner);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, 7 + 1 + 2);
}
}

View file

@ -5,6 +5,7 @@ import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.constants.AbilityType;
import mage.constants.ColoredManaSymbol;
import mage.constants.ManaType;
import mage.game.Game;
import mage.util.CardUtil;
import mage.watchers.common.ManaSpentToCastWatcher;
@ -19,12 +20,23 @@ public enum ManaWasSpentCondition implements Condition {
BLUE(ColoredManaSymbol.U),
BLACK(ColoredManaSymbol.B),
RED(ColoredManaSymbol.R),
GREEN(ColoredManaSymbol.G);
GREEN(ColoredManaSymbol.G),
COLORLESS(ManaType.COLORLESS);
protected ColoredManaSymbol coloredManaSymbol;
protected final ColoredManaSymbol coloredManaSymbol;
protected final ManaType manaType;
ManaWasSpentCondition(ColoredManaSymbol coloredManaSymbol) {
this(coloredManaSymbol, null);
}
ManaWasSpentCondition(ManaType manaType) {
this(null, manaType);
}
ManaWasSpentCondition(ColoredManaSymbol coloredManaSymbol, ManaType manaType) {
this.coloredManaSymbol = coloredManaSymbol;
this.manaType = manaType;
}
@Override
@ -36,7 +48,11 @@ public enum ManaWasSpentCondition implements Condition {
if (watcher != null) {
Mana payment = watcher.getManaPayment(CardUtil.getSourceStackMomentReference(game, source));
if (payment != null) {
return payment.getColor(coloredManaSymbol) > 0;
if (coloredManaSymbol != null) {
return payment.getColor(coloredManaSymbol) > 0;
} else if (manaType != null) {
return payment.get(manaType) > 0;
}
}
}
return false;
@ -44,7 +60,12 @@ public enum ManaWasSpentCondition implements Condition {
@Override
public String toString() {
return "{" + coloredManaSymbol.toString() + "} was spent to cast it";
if (coloredManaSymbol != null) {
return "{" + coloredManaSymbol + "} was spent to cast it";
} else if (manaType != null) {
return "{" + manaType + "} was spent to cast it";
}
return "";
}
@Override