* Harvest Mage - Fixed available mana generation (#6698).

This commit is contained in:
LevelX2 2020-08-03 21:26:47 +02:00
parent 244cf2a1e9
commit 985d4205bf
3 changed files with 54 additions and 5 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.h;
import java.util.UUID;
@ -84,9 +83,14 @@ class HarvestMageReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
new AddManaOfAnyColorEffect().apply(game,source);
mana.setToMana(new Mana(0,0,0,0,0,0,0,0));
return true;
if (game != null && game.inCheckPlayableState()) {
mana.setToMana(new Mana(0, 0, 0, 0, 0, 0, 1, 0));
return false;
} else {
new AddManaOfAnyColorEffect().apply(game, source);
mana.setToMana(new Mana(0, 0, 0, 0, 0, 0, 0, 0));
return true;
}
}
@Override

View file

@ -5,10 +5,13 @@
*/
package org.mage.test.cards.mana;
import mage.abilities.mana.ManaOptions;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
import static org.mage.test.utils.ManaOptionsTestUtils.assertManaOptions;
/**
*
@ -18,8 +21,11 @@ public class HarvestMageTest extends CardTestPlayerBase {
@Test
public void testOneInstance() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
// {G}, {T}, Discard a card: Until end of turn, if you tap a land for mana, it produces one mana of a color of your choice instead of any other type and amount.
addCard(Zone.HAND, playerA, "Harvest Mage", 1); // Creature 1/1 {G}
@ -27,9 +33,47 @@ public class HarvestMageTest extends CardTestPlayerBase {
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Harvest Mage");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{G}, {T}, Discard a card: Until end of turn");
setChoice(playerA, "Silvercoat Lion");
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Harvest Mage", 1);
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{Any}", manaOptions);
}
@Test
public void test_AncientTomb() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, "Ancient Tomb", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.HAND, playerA, "Silvercoat Lion");
// {G}, {T}, Discard a card: Until end of turn, if you tap a land for mana, it produces one mana of a color of your choice instead of any other type and amount.
addCard(Zone.HAND, playerA, "Harvest Mage", 1); // Creature 1/1 {G}
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Harvest Mage");
activateAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{G}, {T}, Discard a card: Until end of turn");
setChoice(playerA, "Silvercoat Lion");
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertAllCommandsUsed();
assertPermanentCount(playerA, "Harvest Mage", 1);
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit", 1, manaOptions.size());
assertManaOptions("{Any}{Any}", manaOptions);
}
}

View file

@ -12,6 +12,7 @@ import mage.target.TargetCard;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.filter.StaticFilters;
/**
* @author BetaSteward_at_googlemail.com
@ -19,7 +20,7 @@ import java.util.UUID;
public class TargetCardInHand extends TargetCard {
public TargetCardInHand() {
this(1, 1, new FilterCard());
this(1, 1, StaticFilters.FILTER_CARD_A);
}
public TargetCardInHand(FilterCard filter) {