mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -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
|
|
@ -8,7 +8,7 @@ import mage.abilities.Abilities;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.dynamicvalue.common.GetXValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
|
|
@ -743,18 +743,10 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
// icon - x cost
|
||||
if (showCard != null
|
||||
&& showCard.getManaCost().containsX()
|
||||
&& showAbility != null
|
||||
if (showCard != null && showAbility != null
|
||||
&& (showCard.getManaCost().containsX() || CardUtil.checkSourceCostsTagExists(game, showAbility, "X"))
|
||||
&& (showZone.match(Zone.BATTLEFIELD) || showZone.match(Zone.STACK))) {
|
||||
int costX;
|
||||
if (showCard instanceof Permanent) {
|
||||
// permanent on battlefield (can show x icon multiple turns, so use end_game source)
|
||||
costX = ManacostVariableValue.END_GAME.calculate(game, showAbility, null);
|
||||
} else {
|
||||
// other like Stack (can show x icon on stack only, so use normal source)
|
||||
costX = ManacostVariableValue.REGULAR.calculate(game, showAbility, null);
|
||||
}
|
||||
int costX = GetXValue.instance.calculate(game, showAbility, null);
|
||||
this.cardIcons.add(CardIconImpl.variableCost(costX));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ package mage.view;
|
|||
import mage.MageObject;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.Modes;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.HintUtils;
|
||||
import mage.abilities.icon.CardIconImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
|
|
@ -16,7 +14,6 @@ import mage.game.Game;
|
|||
import mage.game.stack.StackAbility;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.Target;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.target.targetpointer.TargetPointer;
|
||||
import mage.util.GameLog;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue