* Chrom Mox - fixed that tapped for mana replacement effects ignore his mana;

This commit is contained in:
Oleg Agafonov 2020-01-12 10:09:51 +04:00
parent 589142aeb5
commit 860c57d9d9
4 changed files with 80 additions and 17 deletions

View file

@ -192,24 +192,28 @@ class ChromeMoxManaEffect extends ManaEffect {
} }
switch (choice.getChoice()) { switch (choice.getChoice()) {
case "Black": case "Black":
player.getManaPool().addMana(Mana.BlackMana(1), game, source); //player.getManaPool().addMana(Mana.BlackMana(1), game, source);
mana.add(Mana.BlackMana(1));
break; break;
case "Blue": case "Blue":
player.getManaPool().addMana(Mana.BlueMana(1), game, source); //player.getManaPool().addMana(Mana.BlueMana(1), game, source);
mana.add(Mana.BlueMana(1));
break; break;
case "Red": case "Red":
player.getManaPool().addMana(Mana.RedMana(1), game, source); //player.getManaPool().addMana(Mana.RedMana(1), game, source);
mana.add(Mana.RedMana(1));
break; break;
case "Green": case "Green":
player.getManaPool().addMana(Mana.GreenMana(1), game, source); //player.getManaPool().addMana(Mana.GreenMana(1), game, source);
mana.add(Mana.GreenMana(1));
break; break;
case "White": case "White":
player.getManaPool().addMana(Mana.WhiteMana(1), game, source); //player.getManaPool().addMana(Mana.WhiteMana(1), game, source);
mana.add(Mana.WhiteMana(1));
break; break;
default: default:
break; break;
} }
} }
return mana; return mana;
} }

View file

@ -1,24 +1,19 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.ManaType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ManaEvent; import mage.game.events.ManaEvent;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class ManaReflection extends CardImpl { public final class ManaReflection extends CardImpl {
@ -28,7 +23,6 @@ public final class ManaReflection extends CardImpl {
// If you tap a permanent for mana, it produces twice as much of that mana instead. // If you tap a permanent for mana, it produces twice as much of that mana instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ManaReflectionReplacementEffect())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ManaReflectionReplacementEffect()));
} }
public ManaReflection(final ManaReflection card) { public ManaReflection(final ManaReflection card) {

View file

@ -69,4 +69,68 @@ public class TappedForManaFromMultipleEffects extends CardTestPlayerBase {
assertPermanentCount(playerA, "Nyxbloom Ancient", 2); assertPermanentCount(playerA, "Nyxbloom Ancient", 2);
assertPermanentCount(playerA, "Chlorophant", 1); assertPermanentCount(playerA, "Chlorophant", 1);
} }
@Test
public void test_ChromeMox_Direct() {
// Imprint When Chrome Mox enters the battlefield, you may exile a nonartifact, nonland card from your hand.
// {T}: Add one mana of any of the exiled cards colors.
addCard(Zone.HAND, playerA, "Chrome Mox", 1); // {0}
addCard(Zone.HAND, playerA, "Balduvian Bears", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chrome Mox");
setChoice(playerA, "Yes"); // use imprint
setChoice(playerA, "Balduvian Bears"); // discard
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add one");
checkManaPool("must produce green", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "G", 1);
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Chrome Mox", 1);
assertExileCount(playerA, "Balduvian Bears", 1);
}
@Test
public void test_ManaReflect_Direct() {
// If you tap a permanent for mana, it produces twice as much of that mana instead.
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G}");
checkManaPool("must produce green", 1, PhaseStep.PRECOMBAT_MAIN, playerA, "G", 2); // double by reflection
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
}
@Test
public void test_ChromeMox_WithManaReflect() {
// Imprint When Chrome Mox enters the battlefield, you may exile a nonartifact, nonland card from your hand.
// {T}: Add one mana of any of the exiled cards colors.
addCard(Zone.HAND, playerA, "Chrome Mox", 1); // {0}
addCard(Zone.HAND, playerA, "Balduvian Bears", 1);
//
// If you tap a permanent for mana, it produces twice as much of that mana instead.
addCard(Zone.BATTLEFIELD, playerA, "Mana Reflection", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Chrome Mox");
setChoice(playerA, "Yes"); // use imprint
setChoice(playerA, "Balduvian Bears"); // discard
activateManaAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add one");
checkManaPool("must produce green", 1, PhaseStep.POSTCOMBAT_MAIN, playerA, "G", 2); // double by reflection
setStrictChooseMode(true);
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Chrome Mox", 1);
assertExileCount(playerA, "Balduvian Bears", 1);
}
} }

View file

@ -72,7 +72,8 @@ public abstract class ManaEffect extends OneShotEffect {
} }
/** /**
* Produced the mana the effect can produce * Produced the mana the effect can produce (DO NOT add it to mana pool -- return all added as mana object to process by replace events)
* <p>
* WARNING, produceMana can be called multiple times for mana and spell available calculations * WARNING, produceMana can be called multiple times for mana and spell available calculations
* if you don't want it then overide getNetMana to return max possible mana values * if you don't want it then overide getNetMana to return max possible mana values
* (if you have choose dialogs or extra effects like new counters in produceMana) * (if you have choose dialogs or extra effects like new counters in produceMana)