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:
ssk97 2024-07-22 22:57:47 -07:00 committed by GitHub
parent 1cb902fc43
commit e8808c3ae3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
509 changed files with 1322 additions and 1571 deletions

View file

@ -272,7 +272,7 @@ public abstract class AbilityImpl implements Ability {
// For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability
if (noMana) {
if (!this.getManaCostsToPay().getVariableCosts().isEmpty()) {
int xValue = this.getManaCostsToPay().getX();
int xValue = CardUtil.getSourceCostsTag(game, this, "X", 0);
this.clearManaCostsToPay();
VariableManaCost xCosts = new VariableManaCost(VariableCostType.ADDITIONAL);
// no x events - rules from Unbound Flourishing:
@ -438,7 +438,7 @@ public abstract class AbilityImpl implements Ability {
game.informPlayers(announceString);
}
if (variableManaCost != null) {
int xValue = getManaCostsToPay().getX();
int xValue = CardUtil.getSourceCostsTag(game, this, "X", 0);
game.informPlayers(controller.getLogName() + " announces a value of " + xValue + " for " + variableManaCost.getText()
+ CardUtil.getSourceLogName(game, this));
}