mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix Unbound Flourishing triggering for additional X costs (#1581)
* Fix Unbound Flourishing triggering for additional X costs
This commit is contained in:
@@ -258,7 +258,7 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
|
||||
|
||||
// intervening if check, make sure to use right controller
|
||||
if (game.getStack().isResolving(getHostCard())) {
|
||||
SpellAbility sa = game.getStack().peekAbility();
|
||||
SpellAbility sa = game.getStack().peek().getSpellAbility(false);
|
||||
if (sa.isTrigger()) {
|
||||
hostController = sa.getActivatingPlayer();
|
||||
}
|
||||
|
||||
@@ -1723,12 +1723,12 @@ public class AbilityUtils {
|
||||
&& ZoneType.Battlefield.name().equals(t.getParam("Destination"))) {
|
||||
return doXMath(c.getXManaCostPaid(), expr, c, ctb);
|
||||
} else if (TriggerType.SpellCast.equals(t.getMode())) {
|
||||
// Cast Trigger like Hydroid Krasis
|
||||
SpellAbility castSA = (SpellAbility) root.getTriggeringObject(AbilityKey.SpellAbility);
|
||||
if (castSA == null || castSA.getXManaCostPaid() == null) {
|
||||
// Cast Trigger like Hydroid Krasis, use SI because Unbound Flourishing might change X
|
||||
SpellAbilityStackInstance castSI = (SpellAbilityStackInstance) root.getTriggeringObject(AbilityKey.StackInstance);
|
||||
if (castSI == null) {
|
||||
return doXMath(0, expr, c, ctb);
|
||||
}
|
||||
return doXMath(castSA.getXManaCostPaid(), expr, c, ctb);
|
||||
return doXMath(castSI.getXManaPaid(), expr, c, ctb);
|
||||
} else if (TriggerType.Cycled.equals(t.getMode())) {
|
||||
SpellAbility cycleSA = (SpellAbility) sa.getTriggeringObject(AbilityKey.Cause);
|
||||
if (cycleSA == null || cycleSA.getXManaCostPaid() == null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ChangeXEffect extends SpellAbilityEffect {
|
||||
for (final SpellAbility tgtSA : sas) {
|
||||
// for Unbound Flourishing, can't go over SpellAbilityStackInstances because the x is in cast SA copy
|
||||
SpellAbility castSA = tgtSA.getHostCard().getCastSA();
|
||||
if (castSA != null && tgtSA.equals(castSA)) {
|
||||
if (castSA != null && tgtSA.equals(castSA) && castSA.getXManaCostPaid() != null) {
|
||||
castSA.setXManaCostPaid(castSA.getXManaCostPaid() * 2);
|
||||
}
|
||||
// fall back to other potential cards
|
||||
|
||||
@@ -269,6 +269,7 @@ public final class CardUtil {
|
||||
}
|
||||
newCopy.addRemembered(in.getRemembered());
|
||||
newCopy.addImprintedCards(in.getImprintedCards());
|
||||
newCopy.setChosenCards(new CardCollection(in.getChosenCards()));
|
||||
|
||||
for (Table.Cell<Player, CounterType, Integer> cl : in.getEtbCounters()) {
|
||||
newCopy.addEtbCounter(cl.getColumnKey(), cl.getValue(), cl.getRowKey());
|
||||
|
||||
@@ -212,7 +212,7 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView {
|
||||
}
|
||||
|
||||
public final int getXManaPaid() {
|
||||
return xManaPaid;
|
||||
return xManaPaid == null ? 0 : xManaPaid;
|
||||
}
|
||||
public final void setXManaPaid(int x) {
|
||||
xManaPaid = x;
|
||||
|
||||
@@ -192,11 +192,13 @@ public class TriggerSpellAbilityCastOrCopy extends Trigger {
|
||||
}
|
||||
|
||||
if (hasParam("HasXManaCost")) {
|
||||
final Cost cost = (Cost) (runParams.get(AbilityKey.Cost));
|
||||
if (cost.hasNoManaCost()) {
|
||||
return false;
|
||||
final int numX;
|
||||
if (spellAbility.isActivatedAbility()) {
|
||||
numX = spellAbility.getPayCosts().hasManaCost() ? spellAbility.getPayCosts().getCostMana().getAmountOfX() : 0;
|
||||
} else {
|
||||
numX = cast.getManaCost().countX();
|
||||
}
|
||||
if (cost.getCostMana().getAmountOfX() <= 0) {
|
||||
if (numX == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user