Compare commits

...

2 Commits

Author SHA1 Message Date
tool4EvEr
3ab6793eb8 Adjust from effect 2025-11-09 17:04:23 +01:00
tool4EvEr
26c05d3916 Adjust from effect 2025-11-09 17:01:17 +01:00
7 changed files with 30 additions and 17 deletions

View File

@@ -1345,9 +1345,7 @@ public class ComputerUtilMana {
} }
} }
if (!effect) { CostAdjustment.adjust(manaCost, sa, null, test, effect);
CostAdjustment.adjust(manaCost, sa, null, test);
}
if ("NumTimes".equals(sa.getParam("Announce"))) { // e.g. the Adversary cycle if ("NumTimes".equals(sa.getParam("Announce"))) { // e.g. the Adversary cycle
ManaCost mkCost = sa.getPayCosts().getTotalMana(); ManaCost mkCost = sa.getPayCosts().getTotalMana();

View File

@@ -15,6 +15,7 @@ import forge.game.*;
import forge.game.ability.AbilityFactory.AbilityRecordType; import forge.game.ability.AbilityFactory.AbilityRecordType;
import forge.game.card.*; import forge.game.card.*;
import forge.game.cost.Cost; import forge.game.cost.Cost;
import forge.game.cost.CostAdjustment;
import forge.game.cost.IndividualCostPaymentInstance; import forge.game.cost.IndividualCostPaymentInstance;
import forge.game.keyword.Keyword; import forge.game.keyword.Keyword;
import forge.game.keyword.KeywordInterface; import forge.game.keyword.KeywordInterface;
@@ -1527,6 +1528,7 @@ public class AbilityUtils {
else { else {
cost = new Cost(unlessCost, true); cost = new Cost(unlessCost, true);
} }
cost = CostAdjustment.adjust(cost, sa, true);
return cost; return cost;
} }

View File

@@ -37,6 +37,7 @@ public class CostAdjustment {
public static Cost adjust(final Cost cost, final SpellAbility sa, boolean effect) { public static Cost adjust(final Cost cost, final SpellAbility sa, boolean effect) {
if (sa.isTrigger() || cost == null || effect) { if (sa.isTrigger() || cost == null || effect) {
sa.setMaxWaterbend(cost);
return cost; return cost;
} }
@@ -101,7 +102,7 @@ public class CostAdjustment {
host.setFaceDown(false); host.setFaceDown(false);
} }
sa.setMaxWaterbend(result.getMaxWaterbend()); sa.setMaxWaterbend(result);
return result; return result;
} }
@@ -175,8 +176,11 @@ public class CostAdjustment {
// If cardsToDelveOut is null, will immediately exile the delved cards and remember them on the host card. // If cardsToDelveOut is null, will immediately exile the delved cards and remember them on the host card.
// Otherwise, will return them in cardsToDelveOut and the caller is responsible for doing the above. // Otherwise, will return them in cardsToDelveOut and the caller is responsible for doing the above.
public static boolean adjust(ManaCostBeingPaid cost, final SpellAbility sa, CardCollection cardsToDelveOut, boolean test) { public static boolean adjust(ManaCostBeingPaid cost, final SpellAbility sa, CardCollection cardsToDelveOut, boolean test, boolean effect) {
if (sa.isTrigger() || sa.isReplacementAbility()) { if (effect) {
adjustCostByWaterbend(cost, sa, test);
}
if (effect || sa.isTrigger() || sa.isReplacementAbility()) {
return true; return true;
} }
@@ -291,10 +295,7 @@ public class CostAdjustment {
adjustCostByConvokeOrImprovise(cost, sa, false, true, test); adjustCostByConvokeOrImprovise(cost, sa, false, true, test);
} }
Integer maxWaterbend = sa.getMaxWaterbend(); adjustCostByWaterbend(cost, sa, test);
if (maxWaterbend != null && maxWaterbend > 0) {
adjustCostByConvokeOrImprovise(cost, sa, true, true, test);
}
// Reset card state (if changed) // Reset card state (if changed)
if (isStateChangeToFaceDown) { if (isStateChangeToFaceDown) {
@@ -306,6 +307,13 @@ public class CostAdjustment {
} }
// GetSpellCostChange // GetSpellCostChange
private static void adjustCostByWaterbend(ManaCostBeingPaid cost, SpellAbility sa, boolean test) {
Integer maxWaterbend = sa.getMaxWaterbend();
if (maxWaterbend != null && maxWaterbend > 0) {
adjustCostByConvokeOrImprovise(cost, sa, true, true, test);
}
}
private static boolean adjustCostByAssist(ManaCostBeingPaid cost, final SpellAbility sa, boolean test) { private static boolean adjustCostByAssist(ManaCostBeingPaid cost, final SpellAbility sa, boolean test) {
// 702.132a Assist is a static ability that modifies the rules of paying for the spell with assist (see rules 601.2g-h). // 702.132a Assist is a static ability that modifies the rules of paying for the spell with assist (see rules 601.2g-h).
// If the total cost to cast a spell with assist includes a generic mana component, before you activate mana abilities while casting it, you may choose another player. // If the total cost to cast a spell with assist includes a generic mana component, before you activate mana abilities while casting it, you may choose another player.

View File

@@ -2697,10 +2697,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
public Integer getMaxWaterbend() { public Integer getMaxWaterbend() {
return maxWaterbend; return maxWaterbend;
} }
public void setMaxWaterbend(String max) { public void setMaxWaterbend(Cost cost) {
if (max == null) { if (cost == null || cost.getMaxWaterbend() == null) {
return; return;
} }
maxWaterbend = AbilityUtils.calculateAmount(getHostCard(), max, this); maxWaterbend = AbilityUtils.calculateAmount(getHostCard(), cost.getMaxWaterbend(), this);
} }
} }

View File

@@ -428,7 +428,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
game.getTriggerHandler().runTrigger(TriggerType.AbilityCast, runParams, true); game.getTriggerHandler().runTrigger(TriggerType.AbilityCast, runParams, true);
} }
if (sp.getPayCosts() != null && sp.getPayCosts().getMaxWaterbend() != null) { if (sp.getPayCosts() != null && sp.getMaxWaterbend() != null) {
activator.triggerElementalBend(TriggerType.Waterbend); activator.triggerElementalBend(TriggerType.Waterbend);
} }

View File

@@ -0,0 +1,7 @@
Name:Waterbending Lesson
ManaCost:3 U
Types:Sorcery Lesson
A:SP$ Draw | NumCards$ 3 | SubAbility$ DBDiscard | SpellDescription$ Draw three cards. Then discard a card unless you waterbend {2}. (While paying a waterbend cost, you can tap your artifacts and creatures to help. Each one pays for {1}.)
SVar:DBDiscard:DB$ Discard | Defined$ You | NumCards$ 1 | Mode$ TgtChoose | UnlessCost$ Waterbend<2> | UnlessPayer$ You
DeckHas:Ability$Discard
Oracle:Draw three cards. Then discard a card unless you waterbend {2}. (While paying a waterbend cost, you can tap your artifacts and creatures to help. Each one pays for {1}.)

View File

@@ -560,9 +560,7 @@ public class HumanPlay {
} }
CardCollection cardsToDelve = new CardCollection(); CardCollection cardsToDelve = new CardCollection();
if (!effect) { CostAdjustment.adjust(toPay, ability, cardsToDelve, false, effect);
CostAdjustment.adjust(toPay, ability, cardsToDelve, false);
}
Card offering = null; Card offering = null;
Card emerge = null; Card emerge = null;