From 9ed4b92dc71235f2f0e66929c3d37237f77ecee6 Mon Sep 17 00:00:00 2001 From: Sloth Date: Fri, 19 Oct 2012 21:12:28 +0000 Subject: [PATCH] - Added Rotting Giant. --- .gitattributes | 1 + res/cardsfolder/l/lesser_gargadon.txt | 2 +- res/cardsfolder/r/rotting_giant.txt | 14 +++++++ res/cardsfolder/s/straw_golem.txt | 2 +- src/main/java/forge/GameActionUtil.java | 42 +++++++++++++++++--- src/main/java/forge/card/cost/CostExile.java | 6 +-- 6 files changed, 55 insertions(+), 12 deletions(-) create mode 100644 res/cardsfolder/r/rotting_giant.txt diff --git a/.gitattributes b/.gitattributes index 65e6aa84f56..3cedae507e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8090,6 +8090,7 @@ res/cardsfolder/r/roterothopter.txt svneol=native#text/plain res/cardsfolder/r/rotlung_reanimator.txt svneol=native#text/plain res/cardsfolder/r/rotted_hystrix.txt svneol=native#text/plain res/cardsfolder/r/rotting_fensnake.txt -text +res/cardsfolder/r/rotting_giant.txt -text res/cardsfolder/r/rotting_legion.txt svneol=native#text/plain res/cardsfolder/r/rotting_rats.txt svneol=native#text/plain res/cardsfolder/r/roughshod_mentor.txt svneol=native#text/plain diff --git a/res/cardsfolder/l/lesser_gargadon.txt b/res/cardsfolder/l/lesser_gargadon.txt index c6354d3199f..855012a36cd 100644 --- a/res/cardsfolder/l/lesser_gargadon.txt +++ b/res/cardsfolder/l/lesser_gargadon.txt @@ -5,7 +5,7 @@ Text:no text PT:6/4 T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigSac | TriggerDescription$ Whenever CARDNAME attacks or blocks, sacrifice a land. T:Mode$ Blocks | ValidCard$ Card.Self | Execute$ TrigSac | Secondary$ True | TriggerDescription$ Whenever CARDNAME attacks or blocks, sacrifice a land. -SVar:TrigSac:AB$Sacrifice | Cost$ 0 | SacValid$ Land | ChangeNum$ 1 +SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | SacValid$ Land SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/lesser_gargadon.jpg SetInfo:PCY|Uncommon|http://magiccards.info/scans/en/pr/97.jpg diff --git a/res/cardsfolder/r/rotting_giant.txt b/res/cardsfolder/r/rotting_giant.txt new file mode 100644 index 00000000000..ddf563337e3 --- /dev/null +++ b/res/cardsfolder/r/rotting_giant.txt @@ -0,0 +1,14 @@ +Name:Rotting Giant +ManaCost:1 B +Types:Creature Zombie Giant +Text:no text +PT:3/3 +T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigSac | TriggerDescription$ Whenever CARDNAME attacks or blocks, sacrifice it unless you exile a card from your graveyard. +T:Mode$ Blocks | ValidCard$ Card.Self | Execute$ TrigSac | Secondary$ True | TriggerDescription$ Whenever CARDNAME attacks or blocks, sacrifice it unless you exile a card from your graveyard. +SVar:TrigSac:AB$ Sacrifice | Cost$ 0 | Defined$ Self | UnlessCost$ ExileFromGrave<1/Card> | UnlessPayer$ You +SVar:RemAIDeck:True +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/rotting_giant.jpg +SetInfo:ODY|Uncommon|http://magiccards.info/scans/en/od/158.jpg +Oracle:Whenever Rotting Giant attacks or blocks, sacrifice it unless you exile a card from your graveyard. +End \ No newline at end of file diff --git a/res/cardsfolder/s/straw_golem.txt b/res/cardsfolder/s/straw_golem.txt index ea1d23578ea..f828d270d21 100644 --- a/res/cardsfolder/s/straw_golem.txt +++ b/res/cardsfolder/s/straw_golem.txt @@ -4,7 +4,7 @@ Types:Artifact Creature Golem Text:no text PT:2/3 T:Mode$ SpellCast | ValidCard$ Creature | ValidActivatingPlayer$ Opponent | TriggerZones$ Battlefield | Execute$ TrigSacrifice | TriggerDescription$ When an opponent casts a creature spell, sacrifice CARDNAME. -SVar:TrigSacrifice:AB$Sacrifice | Cost$ 0 | Defined$ Self +SVar:TrigSacrifice:AB$ Sacrifice | Cost$ 0 | Defined$ Self SVar:AntiBuffedBy:Creature SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/straw_golem.jpg diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 9359add2787..a9abefc86db 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -397,6 +397,7 @@ public final class GameActionUtil { p.payLife(amount, null); } else { hasPaid = false; + break; } remainingParts.remove(part); } @@ -410,6 +411,7 @@ public final class GameActionUtil { p.addDamage(amount, source); } else { hasPaid = false; + break; } remainingParts.remove(part); } @@ -428,22 +430,50 @@ public final class GameActionUtil { hasPaid = false; Singletons.getModel().getGameState().getGameLog().add("ResolveStack", "Trying to pay upkeep for " + source + " but it can't have " + counterType.getName() + " counters put on it.", 2); + break; } } else { hasPaid = false; + break; } remainingParts.remove(part); } - if (part instanceof CostExile && "All".equals(part.getType())) { + else if (part instanceof CostExile) { Player p = Singletons.getControl().getPlayer(); - if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) { - for (final Card card : p.getCardsIn(ZoneType.Graveyard)) { - Singletons.getModel().getGameAction().exile(card); + if ("All".equals(part.getType())) { + if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) { + for (final Card card : p.getCardsIn(ZoneType.Graveyard)) { + Singletons.getModel().getGameAction().exile(card); + } + } else { + hasPaid = false; + break; } + remainingParts.remove(part); } else { - hasPaid = false; + CostExile costExile = (CostExile) part; + ZoneType from = costExile.getFrom(); + List list = p.getCardsIn(from); + list = CardLists.getValidCards(list, part.getType().split(";"), p, source); + final int nNeeded = AbilityFactory.calculateAmount(source, part.getAmount(), ability); + if (list.size() >= nNeeded) { + for (int i = 0; i < nNeeded; i++) { + + final Card c = GuiChoose.oneOrNone("Exile from " + from, list); + + if (c != null) { + list.remove(c); + Singletons.getModel().getGameAction().exile(c); + } else { + hasPaid = false; + break; + } + } + } else { + hasPaid = false; + break; + } } - remainingParts.remove(part); } } if (!hasPaid) { diff --git a/src/main/java/forge/card/cost/CostExile.java b/src/main/java/forge/card/cost/CostExile.java index 17744f672a6..24d791633aa 100644 --- a/src/main/java/forge/card/cost/CostExile.java +++ b/src/main/java/forge/card/cost/CostExile.java @@ -360,11 +360,9 @@ public class CostExile extends CostPartWithList { this.cancel(); } - final Card o = GuiChoose - .oneOrNone("Exile from " + part.getFrom(), this.typeList); + final Card c = GuiChoose.oneOrNone("Exile from " + part.getFrom(), this.typeList); - if (o != null) { - final Card c = o; + if (c != null) { this.typeList.remove(c); part.addToList(c); Singletons.getModel().getGameAction().exile(c);