mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
Remove duplicate code for X costs (#12551)
* Replace "([a-zA-Z]+).getManaCostsToPay().getX()" with CardUtil.getSourceCostsTag(game, $1, "X", 0) Fix Disrupting Shoal * Change final card .getX() calls * Condense all ManacostVariableValue enum values into "instance" * Further removal of getX, Display X symbol for non-mana X cards * Fix test * Fully remove ManaCosts.getX * Replace all different X dynamic values with GetXValue * Remove individual cards checking getAmount for X values (leaving cost reduction that does not use X) * Add null check for game object inside getSourceCostsTagsMap * fix build errors * fix Vicious Betrayal * text fix
This commit is contained in:
parent
1cb902fc43
commit
e8808c3ae3
509 changed files with 1322 additions and 1571 deletions
|
|
@ -4,7 +4,7 @@ import mage.Mana;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.mana.AddConditionalManaEffect;
|
||||
|
|
@ -221,7 +221,7 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
public void test_MultipleMana_OneXAbility() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(GetXValue.instance), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
|
||||
|
|
@ -252,7 +252,7 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
new AddConditionalManaEffect(Mana.RedMana(10), new SimpleActivatedAbilityManaBuilder()),
|
||||
new ManaCostsImpl<>("")));
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(GetXValue.instance), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
|
||||
|
|
@ -279,12 +279,12 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Lightning Bolt"); // {R}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1 + 3 + 1);
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>(""));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(GetXValue.instance), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
//
|
||||
// {X}: Counter target spell
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(GetXValue.instance), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetSpell());
|
||||
addCustomCardWithAbility("counter until pay X", playerB, ability);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
|
||||
|
|
@ -327,12 +327,12 @@ public class ManaPoolTest extends CardTestPlayerBase {
|
|||
new AddConditionalManaEffect(Mana.RedMana(10), new SimpleActivatedAbilityManaBuilder()),
|
||||
new ManaCostsImpl<>("")));
|
||||
//
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>(""));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.ALL, new DamageTargetEffect(GetXValue.instance), new ManaCostsImpl<>(""));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
addCustomCardWithAbility("damage X", playerA, ability);
|
||||
//
|
||||
// {X}: Counter target spell
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(ManacostVariableValue.REGULAR), new ManaCostsImpl<>("{X}"));
|
||||
ability = new SimpleActivatedAbility(Zone.ALL, new CounterUnlessPaysEffect(GetXValue.instance), new ManaCostsImpl<>("{X}"));
|
||||
ability.addTarget(new TargetSpell());
|
||||
addCustomCardWithAbility("counter until pay X", playerB, ability);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 3);
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ public class CardIconsTest extends CardTestPlayerBase {
|
|||
GameView gameView = getGameView(player);
|
||||
Assert.assertEquals("ability activated - must have 1 card in stack", 1, gameView.getStack().values().size());
|
||||
CardView cardView = gameView.getStack().values().stream().findFirst().get();
|
||||
Assert.assertEquals("ability activated - must have x cost card icons in stack", 1, cardView.getCardIcons().size());
|
||||
Assert.assertTrue("ability activated - must have x cost card icons in stack", cardView.getCardIcons().stream().anyMatch(x -> x.getText().equals("x=2")));
|
||||
});
|
||||
|
||||
// battlefield (ability activated, not visible)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue