mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
DefinedCost and DefinedManaCost
This commit is contained in:
@@ -1496,17 +1496,45 @@ public class AbilityUtils {
|
|||||||
else if (unlessCost.equals("ChosenNumber")) {
|
else if (unlessCost.equals("ChosenNumber")) {
|
||||||
cost = new Cost(new ManaCost(new ManaCostParser(String.valueOf(source.getChosenNumber()))), true);
|
cost = new Cost(new ManaCost(new ManaCostParser(String.valueOf(source.getChosenNumber()))), true);
|
||||||
}
|
}
|
||||||
else if (unlessCost.equals("RememberedCostMinus2")) {
|
else if (unlessCost.startsWith("DefinedCost")) {
|
||||||
Card rememberedCard = (Card) source.getFirstRemembered();
|
CardCollection definedCards = AbilityUtils.getDefinedCards(sa.getHostCard(), unlessCost.split("_")[1], sa);
|
||||||
if (rememberedCard == null) {
|
if (definedCards.isEmpty()) {
|
||||||
sa.resolve();
|
sa.resolve();
|
||||||
resolveSubAbilities(sa, game);
|
resolveSubAbilities(sa, game);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ManaCostBeingPaid newCost = new ManaCostBeingPaid(rememberedCard.getManaCost());
|
Card card = definedCards.getFirst();
|
||||||
newCost.decreaseGenericMana(2);
|
ManaCostBeingPaid newCost = new ManaCostBeingPaid(card.getManaCost());
|
||||||
|
// Check if there's a third underscore for cost modifying
|
||||||
|
if (unlessCost.split("_").length == 3) {
|
||||||
|
String modifier = unlessCost.split("_")[2];
|
||||||
|
if (modifier.startsWith("Minus")) {
|
||||||
|
newCost.decreaseGenericMana(Integer.parseInt(modifier.substring(5)));
|
||||||
|
} else {
|
||||||
|
newCost.increaseGenericMana(Integer.parseInt(modifier.substring(4)));
|
||||||
|
}
|
||||||
|
}
|
||||||
cost = new Cost(newCost.toManaCost(), true);
|
cost = new Cost(newCost.toManaCost(), true);
|
||||||
}
|
}
|
||||||
|
else if (unlessCost.startsWith("DefinedSACost")) {
|
||||||
|
FCollection<SpellAbility> definedSAs = AbilityUtils.getDefinedSpellAbilities(sa.getHostCard(), unlessCost.split("_")[1], sa);
|
||||||
|
if (definedSAs.isEmpty()) {
|
||||||
|
sa.resolve();
|
||||||
|
resolveSubAbilities(sa, game);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Card host = definedSAs.getFirst().getHostCard();
|
||||||
|
if (host.getManaCost() == null) {
|
||||||
|
cost = new Cost(ManaCost.ZERO, true);
|
||||||
|
} else {
|
||||||
|
int xCount = host.getManaCost().countX();
|
||||||
|
int xPaid = host.getXManaCostPaid() * xCount;
|
||||||
|
ManaCostBeingPaid toPay = new ManaCostBeingPaid(host.getManaCost());
|
||||||
|
toPay.decreaseShard(ManaCostShard.X, xCount);
|
||||||
|
toPay.increaseGenericMana(xPaid);
|
||||||
|
cost = new Cost(toPay.toManaCost(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!StringUtils.isBlank(sa.getSVar(unlessCost)) || !StringUtils.isBlank(source.getSVar(unlessCost))) {
|
else if (!StringUtils.isBlank(sa.getSVar(unlessCost)) || !StringUtils.isBlank(source.getSVar(unlessCost))) {
|
||||||
// check for X costs (stored in SVars
|
// check for X costs (stored in SVars
|
||||||
int xCost = calculateAmount(source, TextUtil.fastReplace(sa.getParam("UnlessCost"),
|
int xCost = calculateAmount(source, TextUtil.fastReplace(sa.getParam("UnlessCost"),
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ Name:Flash
|
|||||||
ManaCost:1 U
|
ManaCost:1 U
|
||||||
Types:Instant
|
Types:Instant
|
||||||
A:SP$ ChangeZone | Cost$ 1 U | Origin$ Hand | Destination$ Battlefield | ChangeType$ Creature | ChangeNum$ 1 | SubAbility$ DBSac | RememberChanged$ True | SpellDescription$ You may put a creature card from your hand onto the battlefield. If you do, sacrifice it unless you pay its mana cost reduced by up to {2}.
|
A:SP$ ChangeZone | Cost$ 1 U | Origin$ Hand | Destination$ Battlefield | ChangeType$ Creature | ChangeNum$ 1 | SubAbility$ DBSac | RememberChanged$ True | SpellDescription$ You may put a creature card from your hand onto the battlefield. If you do, sacrifice it unless you pay its mana cost reduced by up to {2}.
|
||||||
SVar:DBSac:DB$ SacrificeAll | Defined$ Remembered | UnlessCost$ RememberedCostMinus2 | UnlessPayer$ You | SubAbility$ DBCleanup
|
SVar:DBSac:DB$ SacrificeAll | Defined$ Remembered | UnlessCost$ DefinedCost_Remembered_Minus2 | UnlessPayer$ You | SubAbility$ DBCleanup
|
||||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
AI:RemoveDeck:All
|
AI:RemoveDeck:All
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/flash.jpg
|
|
||||||
Oracle:You may put a creature card from your hand onto the battlefield. If you do, sacrifice it unless you pay its mana cost reduced by up to {2}.
|
Oracle:You may put a creature card from your hand onto the battlefield. If you do, sacrifice it unless you pay its mana cost reduced by up to {2}.
|
||||||
|
|||||||
@@ -2,6 +2,5 @@ Name:Ice Cave
|
|||||||
ManaCost:3 U U
|
ManaCost:3 U U
|
||||||
Types:Enchantment
|
Types:Enchantment
|
||||||
T:Mode$ SpellCast | ValidCard$ Card | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell, any other player may pay that spell's mana cost. If a player does, counter the spell. (Mana cost includes color.)
|
T:Mode$ SpellCast | ValidCard$ Card | TriggerZones$ Battlefield | Execute$ TrigCounter | TriggerDescription$ Whenever a player casts a spell, any other player may pay that spell's mana cost. If a player does, counter the spell. (Mana cost includes color.)
|
||||||
SVar:TrigCounter:DB$ Counter | Defined$ TriggeredSpellAbility | UnlessCost$ TriggeredSpellManaCost | UnlessPayer$ NonTriggeredCardController | UnlessSwitched$ True
|
SVar:TrigCounter:DB$ Counter | Defined$ TriggeredSpellAbility | UnlessCost$ DefinedSACost_TriggeredSpellAbility | UnlessPayer$ NonTriggeredCardController | UnlessSwitched$ True
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/ice_cave.jpg
|
|
||||||
Oracle:Whenever a player casts a spell, any other player may pay that spell's mana cost. If a player does, counter the spell. (Mana cost includes color.)
|
Oracle:Whenever a player casts a spell, any other player may pay that spell's mana cost. If a player does, counter the spell. (Mana cost includes color.)
|
||||||
|
|||||||
Reference in New Issue
Block a user