fix cost reduction not controller specific for [MH3] It That Heralds the End and [MH3] Ral, Leyline Prodify

fix #12503
This commit is contained in:
Susucre 2024-06-22 14:47:47 +02:00
parent 073637257f
commit 64e08b49b1
7 changed files with 93 additions and 40 deletions

View file

@ -0,0 +1,46 @@
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 ItThatHeraldsTheEndTest extends CardTestPlayerBase {
/**
* {@link mage.cards.i.ItThatHeraldsTheEnd It That Heralds the End} {1}{C}
* Creature Eldrazi Drone
* Colorless spells you cast with mana value 7 or greater cost {1} less to cast.
* Other colorless creatures you control get +1/+1.
* 2/2
*/
private static final String it = "It That Heralds the End";
@Test
public void test_Simple() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, it);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 6);
addCard(Zone.BATTLEFIELD, playerB, "Forest", 7);
addCard(Zone.HAND, playerA, "Ebony Rhino");
addCard(Zone.HAND, playerB, "Ebony Rhino");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ebony Rhino");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Ebony Rhino");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertTappedCount("Swamp", true, 6);
assertTappedCount("Forest", true, 7);
assertPermanentCount(playerA, "Ebony Rhino", 1);
assertPowerToughness(playerA, "Ebony Rhino", 5, 6);
assertPermanentCount(playerB, "Ebony Rhino", 1);
assertPowerToughness(playerB, "Ebony Rhino", 4, 5);
}
}

View file

@ -11,7 +11,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.*;
import mage.abilities.effects.common.cost.SpellsCostIncreasingAllEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionAllEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -31,7 +31,6 @@ import mage.server.managers.ConfigSettings;
import mage.server.util.ConfigFactory;
import mage.server.util.ConfigWrapper;
import mage.server.util.PluginClassLoader;
import mage.utils.SystemUtil;
import mage.server.util.config.GamePlugin;
import mage.server.util.config.Plugin;
import mage.target.TargetPermanent;
@ -40,6 +39,7 @@ import mage.target.common.TargetCardInExile;
import mage.target.common.TargetCardInGraveyard;
import mage.target.common.TargetCardInLibrary;
import mage.util.Copier;
import mage.utils.SystemUtil;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
@ -241,10 +241,18 @@ public abstract class MageTestPlayerBase {
* @param enable
*/
protected void setStrictChooseMode(boolean enable) {
if (playerA != null) playerA.setChooseStrictMode(enable);
if (playerB != null) playerB.setChooseStrictMode(enable);
if (playerC != null) playerC.setChooseStrictMode(enable);
if (playerD != null) playerD.setChooseStrictMode(enable);
if (playerA != null) {
playerA.setChooseStrictMode(enable);
}
if (playerB != null) {
playerB.setChooseStrictMode(enable);
}
if (playerC != null) {
playerC.setChooseStrictMode(enable);
}
if (playerD != null) {
playerD.setChooseStrictMode(enable);
}
}
protected void addCustomCardWithSpell(TestPlayer controllerPlayer, SpellAbility spellAbility, Ability extraAbility, CardType cardType) {
@ -319,7 +327,7 @@ public abstract class MageTestPlayerBase {
if (modificationAmount >= 0) {
effect = new SpellsCostIncreasingAllEffect(modificationAmount, StaticFilters.FILTER_CARD, TargetController.YOU);
} else {
effect = new SpellsCostReductionAllEffect(StaticFilters.FILTER_CARD, -1 * modificationAmount, false, true);
effect = new SpellsCostReductionControllerEffect(StaticFilters.FILTER_CARD, -1 * modificationAmount, false);
}
addCustomCardWithAbility(
@ -439,7 +447,9 @@ class CustomTestCard extends CardImpl {
abilitiesList.put(cardName, new AbilitiesImpl<>());
}
Abilities<Ability> oldAbilities = abilitiesList.get(cardName);
if (ability != null) oldAbilities.add(ability);
if (ability != null) {
oldAbilities.add(ability);
}
spellAbilitiesList.put(cardName, spellAbility);
}