mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Compare commits
2 Commits
8a8bff26c0
...
3ab6793eb8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ab6793eb8 | ||
|
|
26c05d3916 |
@@ -1345,9 +1345,7 @@ public class ComputerUtilMana {
|
||||
}
|
||||
}
|
||||
|
||||
if (!effect) {
|
||||
CostAdjustment.adjust(manaCost, sa, null, test);
|
||||
}
|
||||
CostAdjustment.adjust(manaCost, sa, null, test, effect);
|
||||
|
||||
if ("NumTimes".equals(sa.getParam("Announce"))) { // e.g. the Adversary cycle
|
||||
ManaCost mkCost = sa.getPayCosts().getTotalMana();
|
||||
|
||||
@@ -15,6 +15,7 @@ import forge.game.*;
|
||||
import forge.game.ability.AbilityFactory.AbilityRecordType;
|
||||
import forge.game.card.*;
|
||||
import forge.game.cost.Cost;
|
||||
import forge.game.cost.CostAdjustment;
|
||||
import forge.game.cost.IndividualCostPaymentInstance;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.keyword.KeywordInterface;
|
||||
@@ -1527,6 +1528,7 @@ public class AbilityUtils {
|
||||
else {
|
||||
cost = new Cost(unlessCost, true);
|
||||
}
|
||||
cost = CostAdjustment.adjust(cost, sa, true);
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ public class CostAdjustment {
|
||||
|
||||
public static Cost adjust(final Cost cost, final SpellAbility sa, boolean effect) {
|
||||
if (sa.isTrigger() || cost == null || effect) {
|
||||
sa.setMaxWaterbend(cost);
|
||||
return cost;
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ public class CostAdjustment {
|
||||
host.setFaceDown(false);
|
||||
}
|
||||
|
||||
sa.setMaxWaterbend(result.getMaxWaterbend());
|
||||
sa.setMaxWaterbend(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.
|
||||
// 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) {
|
||||
if (sa.isTrigger() || sa.isReplacementAbility()) {
|
||||
public static boolean adjust(ManaCostBeingPaid cost, final SpellAbility sa, CardCollection cardsToDelveOut, boolean test, boolean effect) {
|
||||
if (effect) {
|
||||
adjustCostByWaterbend(cost, sa, test);
|
||||
}
|
||||
if (effect || sa.isTrigger() || sa.isReplacementAbility()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -291,10 +295,7 @@ public class CostAdjustment {
|
||||
adjustCostByConvokeOrImprovise(cost, sa, false, true, test);
|
||||
}
|
||||
|
||||
Integer maxWaterbend = sa.getMaxWaterbend();
|
||||
if (maxWaterbend != null && maxWaterbend > 0) {
|
||||
adjustCostByConvokeOrImprovise(cost, sa, true, true, test);
|
||||
}
|
||||
adjustCostByWaterbend(cost, sa, test);
|
||||
|
||||
// Reset card state (if changed)
|
||||
if (isStateChangeToFaceDown) {
|
||||
@@ -306,6 +307,13 @@ public class CostAdjustment {
|
||||
}
|
||||
// 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) {
|
||||
// 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.
|
||||
|
||||
@@ -2697,10 +2697,10 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
public Integer getMaxWaterbend() {
|
||||
return maxWaterbend;
|
||||
}
|
||||
public void setMaxWaterbend(String max) {
|
||||
if (max == null) {
|
||||
public void setMaxWaterbend(Cost cost) {
|
||||
if (cost == null || cost.getMaxWaterbend() == null) {
|
||||
return;
|
||||
}
|
||||
maxWaterbend = AbilityUtils.calculateAmount(getHostCard(), max, this);
|
||||
maxWaterbend = AbilityUtils.calculateAmount(getHostCard(), cost.getMaxWaterbend(), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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}.)
|
||||
@@ -560,9 +560,7 @@ public class HumanPlay {
|
||||
}
|
||||
|
||||
CardCollection cardsToDelve = new CardCollection();
|
||||
if (!effect) {
|
||||
CostAdjustment.adjust(toPay, ability, cardsToDelve, false);
|
||||
}
|
||||
CostAdjustment.adjust(toPay, ability, cardsToDelve, false, effect);
|
||||
|
||||
Card offering = null;
|
||||
Card emerge = null;
|
||||
|
||||
Reference in New Issue
Block a user