diff --git a/.gitattributes b/.gitattributes index 8dd7b9b4ed0..f2bbeedc7c2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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_ranger.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/junkyo_bell.txt -text res/cardsfolder/j/juntu_stakes.txt svneol=native#text/plain diff --git a/res/cardsfolder/j/junk_golem.txt b/res/cardsfolder/j/junk_golem.txt new file mode 100644 index 00000000000..788776c6e21 --- /dev/null +++ b/res/cardsfolder/j/junk_golem.txt @@ -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 \ No newline at end of file diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 1cc8055ef16..f3a069a7358 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -38,6 +38,7 @@ import forge.card.cost.CostPart; import forge.card.cost.CostPayLife; import forge.card.cost.CostMana; import forge.card.cost.CostPutCounter; +import forge.card.cost.CostRemoveCounter; import forge.card.cost.CostReturn; import forge.card.cost.CostSacrifice; import forge.card.cost.CostUtil; @@ -377,6 +378,7 @@ public final class GameActionUtil { final Command unpaid, SpellAbility sourceAbility) { final Card source = ability.getSourceCard(); final ArrayList parts = cost.getCostParts(); + Player p = Singletons.getControl().getPlayer(); ArrayList remainingParts = new ArrayList(cost.getCostParts()); CostPart costPart = null; if (!parts.isEmpty()) { @@ -402,7 +404,6 @@ public final class GameActionUtil { final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) : AbilityFactory.calculateAmount(source, amountString, sourceAbility); - Player p = Singletons.getControl().getPlayer(); if (p.canPayLife(amount) && showYesNoDialog(source, "Do you want to pay " + amount + " life?" + orString)) { p.payLife(amount, null); } else { @@ -416,7 +417,6 @@ public final class GameActionUtil { String amountString = part.getAmount(); final int amount = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(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?")) { p.addDamage(amount, source); } else { @@ -449,8 +449,24 @@ public final class GameActionUtil { 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) { - Player p = Singletons.getControl().getPlayer(); if ("All".equals(part.getType())) { if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) { List cards = new ArrayList(p.getCardsIn(ZoneType.Graveyard)); @@ -488,9 +504,7 @@ public final class GameActionUtil { } else if (part instanceof CostSacrifice) { - CostSacrifice sacCost = (CostSacrifice) part; - Player p = Singletons.getControl().getPlayer(); String valid = sacCost.getType(); int amount = Integer.parseInt(sacCost.getAmount()); List list = AbilityFactory.filterListByType(p.getCardsIn(ZoneType.Battlefield), valid, ability);