mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- They do nothing. (Added Pyromancer's Goggles)
This commit is contained in:
@@ -113,6 +113,10 @@ public class Mana {
|
||||
return this.manaAbility.getKeywords();
|
||||
}
|
||||
|
||||
public final boolean triggersWhenSpent() {
|
||||
return this.manaAbility != null && manaAbility.getTriggersWhenSpent();
|
||||
}
|
||||
|
||||
public final byte getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public class ManaPool implements Iterable<Mana> {
|
||||
|
||||
paidAbs.add(saPayment); // assumes some part on the mana produced by the ability will get used
|
||||
for (final Mana mana : abManaPart.getLastManaProduced()) {
|
||||
if (tryPayCostWithMana(saPaidFor, manaCost, mana)) {
|
||||
if (tryPayCostWithMana(saPaidFor, manaCost, mana, false)) {
|
||||
saPaidFor.getPayingMana().add(0, mana);
|
||||
}
|
||||
}
|
||||
@@ -218,19 +218,25 @@ public class ManaPool implements Iterable<Mana> {
|
||||
break;
|
||||
}
|
||||
|
||||
if (manaFound != null && tryPayCostWithMana(saPaidFor, manaCost, manaFound)) {
|
||||
if (manaFound != null && tryPayCostWithMana(saPaidFor, manaCost, manaFound, false)) {
|
||||
saPaidFor.getPayingMana().add(0, manaFound);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean tryPayCostWithMana(final SpellAbility sa, ManaCostBeingPaid manaCost, final Mana mana) {
|
||||
public boolean tryPayCostWithMana(final SpellAbility sa, ManaCostBeingPaid manaCost, final Mana mana, boolean test) {
|
||||
if (!manaCost.isNeeded(mana, this)) {
|
||||
return false;
|
||||
}
|
||||
manaCost.payMana(mana, this);
|
||||
removeMana(mana);
|
||||
|
||||
if (test) {
|
||||
// If just testing, should I be running special mana bonuses?
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mana.addsNoCounterMagic(sa) && sa.getHostCard() != null) {
|
||||
sa.getHostCard().setCanCounter(false);
|
||||
}
|
||||
@@ -267,6 +273,9 @@ public class ManaPool implements Iterable<Mana> {
|
||||
if (mana.addsCounters(sa)) {
|
||||
mana.getManaAbility().createETBCounters(sa.getHostCard());
|
||||
}
|
||||
if (mana.triggersWhenSpent()) {
|
||||
mana.getManaAbility().addTriggersWhenSpent(sa, sa.getHostCard());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import forge.card.mana.ManaAtom;
|
||||
import forge.game.trigger.Trigger;
|
||||
import forge.game.trigger.TriggerHandler;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
@@ -59,6 +61,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
private final String addsKeyowrdsType;
|
||||
private final String addsKeywordsUntil;
|
||||
private final String addsCounters;
|
||||
private final String triggersWhenSpent;
|
||||
private final boolean persistentMana;
|
||||
private String manaReplaceType;
|
||||
|
||||
@@ -88,6 +91,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
this.addsKeyowrdsType = params.get("AddsKeywordsType");
|
||||
this.addsKeywordsUntil = params.get("AddsKeywordsUntil");
|
||||
this.addsCounters = params.get("AddsCounters");
|
||||
this.triggersWhenSpent = params.get("TriggersWhenSpent");
|
||||
this.persistentMana = (null == params.get("PersistentMana")) ? false :
|
||||
"True".equalsIgnoreCase(params.get("PersistentMana"));
|
||||
this.manaReplaceType = params.containsKey("ManaReplaceType") ? params.get("ManaReplaceType") : "";
|
||||
@@ -268,6 +272,19 @@ public class AbilityManaPart implements java.io.Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getTriggersWhenSpent() {
|
||||
return this.triggersWhenSpent != null;
|
||||
}
|
||||
|
||||
public void addTriggersWhenSpent(SpellAbility saBeingPaid, Card card) {
|
||||
if (this.triggersWhenSpent == null)
|
||||
return;
|
||||
|
||||
TriggerHandler handler = card.getGame().getTriggerHandler();
|
||||
Trigger trig = TriggerHandler.parseTrigger(sourceCard.getSVar(this.triggersWhenSpent), sourceCard, false);
|
||||
handler.registerOneTrigger(trig);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* getManaRestrictions.
|
||||
|
||||
@@ -241,6 +241,14 @@ public class TriggerHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean registerOneTrigger(final Trigger t) {
|
||||
if (isTriggerActive(t)) {
|
||||
activeTriggers.add(t);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public final void runTrigger(final TriggerType mode, final Map<String, Object> runParams, boolean holdTrigger) {
|
||||
if (suppressedModes.contains(mode)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user