- Added CostRemoveCounter to payCostDuringAbilityResolve.

- Added Junk Golem by swordshine.
This commit is contained in:
Sloth
2012-12-04 14:22:13 +00:00
parent e727723abc
commit 7c987b3b0d
3 changed files with 35 additions and 5 deletions

1
.gitattributes vendored
View File

@@ -5189,6 +5189,7 @@ res/cardsfolder/j/juniper_order_advocate.txt svneol=native#text/plain
res/cardsfolder/j/juniper_order_druid.txt svneol=native#text/plain res/cardsfolder/j/juniper_order_druid.txt svneol=native#text/plain
res/cardsfolder/j/juniper_order_ranger.txt svneol=native#text/plain res/cardsfolder/j/juniper_order_ranger.txt svneol=native#text/plain
res/cardsfolder/j/junk_diver.txt svneol=native#text/plain res/cardsfolder/j/junk_diver.txt svneol=native#text/plain
res/cardsfolder/j/junk_golem.txt -text
res/cardsfolder/j/junktroller.txt svneol=native#text/plain res/cardsfolder/j/junktroller.txt svneol=native#text/plain
res/cardsfolder/j/junkyo_bell.txt -text res/cardsfolder/j/junkyo_bell.txt -text
res/cardsfolder/j/juntu_stakes.txt svneol=native#text/plain res/cardsfolder/j/juntu_stakes.txt svneol=native#text/plain

View File

@@ -0,0 +1,15 @@
Name:Junk Golem
ManaCost:4
Types:Artifact Creature Golem
Text:no text
PT:0/0
K:etbCounter:P1P1:3
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigSac | TriggerDescription$ At the beginning of your upkeep, sacrifice CARDNAME unless you remove a +1/+1 counter from it.
SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | Defined$ Self | UnlessCost$ SubCounter<1/P1P1> | UnlessPayer$ You
A:AB$ PutCounter | Cost$ 1 Discard<1/Card> | CounterType$ P1P1 | CounterNum$ 1 | SpellDescription$ Put a +1/+1 counter on CARDNAME.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/junk_golem.jpg
SetInfo:ODY|Rare|http://magiccards.info/scans/en/od/300.jpg
Oracle:Junk Golem enters the battlefield with three +1/+1 counters on it.\nAt the beginning of your upkeep, sacrifice Junk Golem unless you remove a +1/+1 counter from it.\n{1}, Discard a card: Put a +1/+1 counter on Junk Golem.
End

View File

@@ -38,6 +38,7 @@ import forge.card.cost.CostPart;
import forge.card.cost.CostPayLife; import forge.card.cost.CostPayLife;
import forge.card.cost.CostMana; import forge.card.cost.CostMana;
import forge.card.cost.CostPutCounter; import forge.card.cost.CostPutCounter;
import forge.card.cost.CostRemoveCounter;
import forge.card.cost.CostReturn; import forge.card.cost.CostReturn;
import forge.card.cost.CostSacrifice; import forge.card.cost.CostSacrifice;
import forge.card.cost.CostUtil; import forge.card.cost.CostUtil;
@@ -377,6 +378,7 @@ public final class GameActionUtil {
final Command unpaid, SpellAbility sourceAbility) { final Command unpaid, SpellAbility sourceAbility) {
final Card source = ability.getSourceCard(); final Card source = ability.getSourceCard();
final ArrayList<CostPart> parts = cost.getCostParts(); final ArrayList<CostPart> parts = cost.getCostParts();
Player p = Singletons.getControl().getPlayer();
ArrayList<CostPart> remainingParts = new ArrayList<CostPart>(cost.getCostParts()); ArrayList<CostPart> remainingParts = new ArrayList<CostPart>(cost.getCostParts());
CostPart costPart = null; CostPart costPart = null;
if (!parts.isEmpty()) { if (!parts.isEmpty()) {
@@ -402,7 +404,6 @@ public final class GameActionUtil {
final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: AbilityFactory.calculateAmount(source, amountString, sourceAbility); : AbilityFactory.calculateAmount(source, amountString, sourceAbility);
Player p = Singletons.getControl().getPlayer();
if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want to pay " + amount + " life?" + orString)) { if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want to pay " + amount + " life?" + orString)) {
p.payLife(amount, null); p.payLife(amount, null);
} else { } else {
@@ -416,7 +417,6 @@ public final class GameActionUtil {
String amountString = part.getAmount(); String amountString = part.getAmount();
final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: CardFactoryUtil.xCount(source, source.getSVar(amountString)); : CardFactoryUtil.xCount(source, source.getSVar(amountString));
Player p = Singletons.getControl().getPlayer();
if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want " + source + " to deal " + amount + " damage to you?")) { if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want " + source + " to deal " + amount + " damage to you?")) {
p.addDamage(amount, source); p.addDamage(amount, source);
} else { } else {
@@ -449,8 +449,24 @@ public final class GameActionUtil {
remainingParts.remove(part); remainingParts.remove(part);
} }
else if (part instanceof CostRemoveCounter) {
String amountString = part.getAmount();
CounterType counterType = ((CostRemoveCounter) part).getCounter();
int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString)
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
String plural = amount > 1 ? "s" : "";
if (part.canPay(sourceAbility, source, p, cost) &&
showYesNoDialog(source, "Do you want to remove " + amount + " " + counterType.getName()
+ " counter" + plural + " from " + source + "?")) {
source.subtractCounter(counterType, amount);
} else {
hasPaid = false;
break;
}
remainingParts.remove(part);
}
else if (part instanceof CostExile) { else if (part instanceof CostExile) {
Player p = Singletons.getControl().getPlayer();
if ("All".equals(part.getType())) { if ("All".equals(part.getType())) {
if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) { if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) {
List<Card> cards = new ArrayList<Card>(p.getCardsIn(ZoneType.Graveyard)); List<Card> cards = new ArrayList<Card>(p.getCardsIn(ZoneType.Graveyard));
@@ -488,9 +504,7 @@ public final class GameActionUtil {
} }
else if (part instanceof CostSacrifice) { else if (part instanceof CostSacrifice) {
CostSacrifice sacCost = (CostSacrifice) part; CostSacrifice sacCost = (CostSacrifice) part;
Player p = Singletons.getControl().getPlayer();
String valid = sacCost.getType(); String valid = sacCost.getType();
int amount = Integer.parseInt(sacCost.getAmount()); int amount = Integer.parseInt(sacCost.getAmount());
List<Card> list = AbilityFactory.filterListByType(p.getCardsIn(ZoneType.Battlefield), valid, ability); List<Card> list = AbilityFactory.filterListByType(p.getCardsIn(ZoneType.Battlefield), valid, ability);