mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
XColor fixes
This commit is contained in:
@@ -1354,7 +1354,10 @@ public class ComputerUtilMana {
|
||||
manaToAdd = 1;
|
||||
}
|
||||
|
||||
String xColor = sa.getParamOrDefault("XColor", "1");
|
||||
String xColor = sa.getXColor();
|
||||
if (xColor == null) {
|
||||
xColor = "1";
|
||||
}
|
||||
if (card.hasKeyword("Spend only colored mana on X. No more than one mana of each color may be spent this way.")) {
|
||||
xColor = "WUBRGX";
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import forge.ai.ComputerUtilMana;
|
||||
import forge.ai.PlayerControllerAi;
|
||||
import forge.ai.SpecialCardAi;
|
||||
import forge.ai.SpellAbilityAi;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.Game;
|
||||
import forge.game.GameEntity;
|
||||
@@ -1011,7 +1012,7 @@ public class DamageDealAi extends DamageAiBase {
|
||||
Player opponent = ai.getWeakestOpponent();
|
||||
|
||||
// TODO: somehow account for the possible cost reduction?
|
||||
int dmg = ComputerUtilMana.determineLeftoverMana(sa, ai, saTgt.getParam("XColor"), false);
|
||||
int dmg = ComputerUtilMana.determineLeftoverMana(sa, ai, MagicColor.toShortString(saTgt.getParam("XColor")), false);
|
||||
|
||||
while (!ComputerUtilMana.canPayManaCost(sa, ai, dmg, false) && dmg > 0) {
|
||||
// TODO: ideally should never get here, currently put here as a precaution for complex mana base cases where the miscalculation might occur. Will remove later if it proves to never trigger.
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.google.common.collect.*;
|
||||
import forge.GameCommand;
|
||||
import forge.card.CardStateName;
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.game.CardTraitBase;
|
||||
import forge.game.ForgeScript;
|
||||
@@ -2417,6 +2418,23 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
xManaCostPaid = n;
|
||||
}
|
||||
|
||||
public String getXColor() {
|
||||
if (!hasParam("XColor")) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String parts[] = getParam("XColor").split(",");
|
||||
for (String col : parts) {
|
||||
// color word used
|
||||
if (col.length() > 2) {
|
||||
col = MagicColor.toShortString(col);
|
||||
}
|
||||
sb.append(col);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public boolean canCastTiming(Player activator) {
|
||||
return canCastTiming(getHostCard(), activator);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Atalya, Samite Master
|
||||
ManaCost:3 W W
|
||||
Types:Legendary Creature Human Cleric
|
||||
PT:2/3
|
||||
A:AB$ Charm | Cost$ X T | XColor$ W | Choices$ PreventDamage,GainLife | CharmNum$ 1
|
||||
A:AB$ Charm | Cost$ X T | XColor$ White | Choices$ PreventDamage,GainLife | CharmNum$ 1
|
||||
SVar:PreventDamage:DB$ PreventDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature | Amount$ X | SpellDescription$ Prevent the next X damage that would be dealt to target creature this turn.
|
||||
SVar:GainLife:DB$ GainLife | LifeAmount$ X | Defined$ You | SpellDescription$ You gain X life.
|
||||
SVar:X:Count$xPaid
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Name:Consume Spirit
|
||||
ManaCost:X 1 B
|
||||
Types:Sorcery
|
||||
A:SP$ DealDamage | Cost$ X 1 B | XColor$ B | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ X | SubAbility$ DBGainLife | SpellDescription$ Spend only black mana on X. Consume Spirit deals X damage to any target and you gain X life.
|
||||
A:SP$ DealDamage | Cost$ X 1 B | XColor$ Black | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | NumDmg$ X | SubAbility$ DBGainLife | SpellDescription$ Spend only black mana on X. Consume Spirit deals X damage to any target and you gain X life.
|
||||
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ X
|
||||
SVar:X:Count$xPaid
|
||||
Oracle:Spend only black mana on X.\nConsume Spirit deals X damage to any target and you gain X life.
|
||||
|
||||
@@ -2,7 +2,7 @@ Name:Crimson Hellkite
|
||||
ManaCost:6 R R R
|
||||
Types:Creature Dragon
|
||||
PT:6/6
|
||||
A:AB$ DealDamage | Cost$ T X | XColor$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ X | SpellDescription$ Crimson Hellkite deals X damage to target creature. Spend only red mana on X.
|
||||
A:AB$ DealDamage | Cost$ T X | XColor$ Red | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ X | SpellDescription$ Crimson Hellkite deals X damage to target creature. Spend only red mana on X.
|
||||
K:Flying
|
||||
SVar:X:Count$xPaid
|
||||
Oracle:Flying\n{X}, {T}: Crimson Hellkite deals X damage to target creature. Spend only red mana on X.
|
||||
|
||||
@@ -2,6 +2,6 @@ Name:Crypt Rats
|
||||
ManaCost:2 B
|
||||
Types:Creature Rat
|
||||
PT:1/1
|
||||
A:AB$ DamageAll | Cost$ X | XColor$ B | NumDmg$ X | ValidCards$ Creature | ValidPlayers$ Player | ValidDescription$ each creature and each player. | SpellDescription$ Crypt Rats deals X damage to each creature and each player. Spend only black mana on X.
|
||||
A:AB$ DamageAll | Cost$ X | XColor$ Black | NumDmg$ X | ValidCards$ Creature | ValidPlayers$ Player | ValidDescription$ each creature and each player. | SpellDescription$ Crypt Rats deals X damage to each creature and each player. Spend only black mana on X.
|
||||
SVar:X:Count$xPaid
|
||||
Oracle:{X}: Crypt Rats deals X damage to each creature and each player. Spend only black mana on X.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Name:Drain Life
|
||||
ManaCost:X 1 B
|
||||
Types:Sorcery
|
||||
A:SP$ StoreSVar | Cost$ X 1 B | XColor$ B | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black mana on X. CARDNAME deals X damage to any target. You gain life equal to the damage dealt, but not more life than the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness.
|
||||
A:SP$ StoreSVar | Cost$ X 1 B | XColor$ Black | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black mana on X. CARDNAME deals X damage to any target. You gain life equal to the damage dealt, but not more life than the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness.
|
||||
SVar:StoreTgtPW:DB$ StoreSVar | SVar$ Limit | Type$ Targeted | Expression$ CardCounters.LOYALTY | SubAbility$ StoreTgtP | ConditionDefined$ Targeted | ConditionPresent$ Card.Planeswalker | ConditionCheckSVar$ Loyalty | ConditionSVarCompare$ LTLimit
|
||||
SVar:StoreTgtP:DB$ StoreSVar | SVar$ Limit | Type$ Count | Expression$ TargetedLifeTotal | SubAbility$ DBDamage | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature,Card.Planeswalker | ConditionCompare$ EQ0
|
||||
SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | SubAbility$ DBGainLife | AILogic$ XLifeDrain
|
||||
|
||||
@@ -3,10 +3,10 @@ ManaCost:1 R
|
||||
Types:Sorcery
|
||||
A:SP$ Destroy | Cost$ X 1 R | XColor$ RG | AnnounceTitle$ how many times to pay the additional cost | Announce$ AdditionalCostPayTimes | ValidTgts$ Artifact | TgtPrompt$ Select target artifact | TargetMin$ TargetNum | TargetMax$ TargetNum | SubAbility$ DBGainLife | SpellDescription$ Destroy target artifact. For each additional {1}{R} you paid, destroy another target artifact. For each additional {1}{G} you paid, destroy another target artifact, and you gain 1 life.
|
||||
S:Mode$ RaiseCost | ValidCard$ Card.Self | Type$ Spell | Amount$ IncreaseCost | EffectZone$ All | Description$ As an additional cost to cast this spell, you may pay {1}{R} and/or {1}{G} any number of times.
|
||||
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ GreenManaPaid
|
||||
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ GManaPaid
|
||||
SVar:AdditionalCostPayTimes:Number$0
|
||||
SVar:TargetNum:SVar$AdditionalCostPayTimes/Plus.1
|
||||
SVar:IncreaseCost:SVar$AdditionalCostPayTimes
|
||||
SVar:X:SVar$AdditionalCostPayTimes
|
||||
SVar:GreenManaPaid:Count$xColorPaid G
|
||||
SVar:GManaPaid:Count$xColorPaid G
|
||||
Oracle:As an additional cost to cast this spell, you may pay {1}{R} and/or {1}{G} any number of times.\nDestroy target artifact. For each additional {1}{R} you paid, destroy another target artifact. For each additional {1}{G} you paid, destroy another target artifact, and you gain 1 life.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
Name:Soul Burn
|
||||
ManaCost:X 2 B
|
||||
Types:Sorcery
|
||||
A:SP$ StoreSVar | Cost$ X 2 B | XColor$ BR | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black and/or red mana on X. CARDNAME deals X damage to target creature or player. You gain life equal to the damage dealt, but not more than the amount of {B} spent on X, the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness.
|
||||
A:SP$ StoreSVar | Cost$ X 2 B | XColor$ Black,Red | ValidTgts$ Creature,Player,Planeswalker | TgtPrompt$ Select any target | SVar$ Limit | Type$ Targeted | Expression$ CardToughness | SubAbility$ StoreTgtPW | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature | ConditionCompare$ GE1 | SpellDescription$ Spend only black and/or red mana on X. CARDNAME deals X damage to target creature or player. You gain life equal to the damage dealt, but not more than the amount of {B} spent on X, the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness.
|
||||
SVar:StoreTgtPW:DB$ StoreSVar | SVar$ Limit | Type$ Targeted | Expression$ CardCounters.LOYALTY | SubAbility$ StoreTgtP | ConditionDefined$ Targeted | ConditionPresent$ Card.Planeswalker | ConditionCheckSVar$ Loyalty | ConditionSVarCompare$ LTLimit
|
||||
SVar:StoreTgtP:DB$ StoreSVar | SVar$ Limit | Type$ Count | Expression$ TargetedLifeTotal | SubAbility$ DBDamage | ConditionDefined$ Targeted | ConditionPresent$ Card.Creature,Card.Planeswalker | ConditionCompare$ EQ0
|
||||
SVar:DBDamage:DB$ DealDamage | Defined$ Targeted | NumDmg$ X | SubAbility$ DBGainLife | AILogic$ XLifeDrain
|
||||
SVar:DBGainLife:DB$ GainLife | Defined$ You | LifeAmount$ DrainedLifeCard
|
||||
SVar:X:Count$xPaid
|
||||
SVar:DrainedLifeCard:SVar$BlackManaPaid/LimitMax.Limit
|
||||
SVar:DrainedLifeCard:SVar$BManaPaid/LimitMax.Limit
|
||||
SVar:Limit:Count$xPaid
|
||||
SVar:Loyalty:Targeted$CardCounters.LOYALTY
|
||||
SVar:BlackManaPaid:Count$xColorPaid B
|
||||
SVar:BManaPaid:Count$xColorPaid B
|
||||
DeckHints:Color$Red
|
||||
Oracle:Spend only black and/or red mana on X.\nSoul Burn deals X damage to any target. You gain life equal to the damage dealt, but not more than the amount of {B} spent on X, the player's life total before the damage was dealt, the planeswalker's loyalty before the damage was dealt, or the creature's toughness.
|
||||
|
||||
@@ -634,7 +634,7 @@ public class HumanPlay {
|
||||
ManaCostBeingPaid toPay = new ManaCostBeingPaid(realCost, mc.getRestriction());
|
||||
|
||||
String xInCard = source.getSVar("X");
|
||||
String xColor = ability.getParam("XColor");
|
||||
String xColor = ability.getXColor();
|
||||
if (source.hasKeyword("Spend only colored mana on X. No more than one mana of each color may be spent this way.")) {
|
||||
xColor = "WUBRGX";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user