Skip to content

Commit

Permalink
Fix Primal Wellspring trigger not working with Chun-Li (#6971)
Browse files Browse the repository at this point in the history
Co-authored-by: tool4EvEr <[email protected]>
  • Loading branch information
tool4ever and tool4EvEr authored Feb 6, 2025
1 parent cfd1822 commit 2443f14
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,16 +322,13 @@ public boolean getTriggersWhenSpent() {
return this.triggersWhenSpent != null;
}

public void addTriggersWhenSpent(SpellAbility saBeingPaid, Card card) {
if (this.triggersWhenSpent == null)
return;

TriggerHandler handler = card.getGame().getTriggerHandler();
public void addTriggersWhenSpent(SpellAbility saBeingPaid) {
Trigger trig = TriggerHandler.parseTrigger(sVarHolder.getSVar(this.triggersWhenSpent), sourceCard, false, sVarHolder);
if (sVarHolder instanceof SpellAbility) {
trig.setSpawningAbility((SpellAbility) sVarHolder);
trig.addRemembered(saBeingPaid);
if (getSourceSA() != null) {
trig.setSpawningAbility(getSourceSA());
}
handler.registerOneTrigger(trig);
saBeingPaid.getHostCard().getGame().getTriggerHandler().registerThisTurnDelayedTrigger(trig);
}

public SpellAbility getSourceSA() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ public final void applyPayingManaEffects() {

for (Mana mana : getPayingMana()) {
if (mana.triggersWhenSpent()) {
mana.getManaAbility().addTriggersWhenSpent(this, host);
mana.getManaAbility().addTriggersWhenSpent(this);
}

if (mana.addsCounters(this)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ public final boolean performTest(final Map<AbilityKey, Object> runParams) {
return false;
}
}

if (getSpawningAbility() != null && getSpawningAbility().hasParam("TriggersWhenSpent")) {
if (!getTriggerRemembered().contains(spellAbility)) {
return false;
}
}

return true;
}

Expand Down
4 changes: 2 additions & 2 deletions forge-gui/res/languages/en-US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1295,8 +1295,8 @@ lblFullControl=Full Control
lblFullControlDetails=This feature lets you skip different helpers that streamline gameplay by avoiding somewhat annoying GUI interactions and instead use AI logic to make reasonable decisions for beginners.\nUseful for certain corner cases or if you want to challenge yourself with the Comprehensive Rules:\ne.g. the opposite cost order is needed if activating an animated "Halo Fountain" that's also tapped.
lblChooseCostOrder=Choose cost order
lblChooseCostReductionOrder=Choose cost reduction order & amount
lblNoPaymentFromManaAbility=Don\'t attempt paying when generating mana
lblNoFreeCombatCostHandling=Don\'t accept attack/block costs of \{0\}
lblNoPaymentFromManaAbility=Don''t attempt paying when generating mana
lblNoFreeCombatCostHandling=Don''t accept attack/block costs of \{0\}
lblAllowPaymentStartWithMissingResources=Allow payment start when cost seems unaffordable
lblLayerTimestampOrder=Finetune layer timestamp order
lblOrderCosts=Order costs
Expand Down

0 comments on commit 2443f14

Please sign in to comment.