* 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()) {
case "Black":
player.getManaPool().addMana(Mana.BlackMana(1), game, source);
//player.getManaPool().addMana(Mana.BlackMana(1), game, source);
mana.add(Mana.BlackMana(1));
break;
case "Blue":
player.getManaPool().addMana(Mana.BlueMana(1), game, source);
//player.getManaPool().addMana(Mana.BlueMana(1), game, source);
mana.add(Mana.BlueMana(1));
break;
case "Red":
player.getManaPool().addMana(Mana.RedMana(1), game, source);
//player.getManaPool().addMana(Mana.RedMana(1), game, source);
mana.add(Mana.RedMana(1));
break;
case "Green":
player.getManaPool().addMana(Mana.GreenMana(1), game, source);
//player.getManaPool().addMana(Mana.GreenMana(1), game, source);
mana.add(Mana.GreenMana(1));
break;
case "White":
player.getManaPool().addMana(Mana.WhiteMana(1), game, source);
//player.getManaPool().addMana(Mana.WhiteMana(1), game, source);
mana.add(Mana.WhiteMana(1));
break;
default:
break;
}
}
return mana;
}

View file

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

View file

@ -69,4 +69,68 @@ public class TappedForManaFromMultipleEffects extends CardTestPlayerBase {
assertPermanentCount(playerA, "Nyxbloom Ancient", 2);
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
* 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)