From fada7d7cb36c476ee61c35a10f76f44bf60e2b7f Mon Sep 17 00:00:00 2001 From: moomarc Date: Fri, 15 Feb 2013 08:22:55 +0000 Subject: [PATCH] - Added Bounty of the Hunt and Shambling Swarm --- .gitattributes | 2 + res/cardsfolder/b/blessings_of_nature.txt | 1 + res/cardsfolder/b/bounty_of_the_hunt.txt | 14 +++++ res/cardsfolder/s/shambling_swarm.txt | 15 +++++ src/main/java/forge/Card.java | 60 ++++++++++++++++--- .../ability/effects/CountersPutEffect.java | 5 ++ .../ability/effects/CountersRemoveEffect.java | 4 +- 7 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 res/cardsfolder/b/bounty_of_the_hunt.txt create mode 100644 res/cardsfolder/s/shambling_swarm.txt diff --git a/.gitattributes b/.gitattributes index e953292e66c..900db678ab8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1210,6 +1210,7 @@ res/cardsfolder/b/boundless_realms.txt -text res/cardsfolder/b/bounteous_kirin.txt svneol=native#text/plain res/cardsfolder/b/bountiful_harvest.txt svneol=native#text/plain res/cardsfolder/b/bounty_hunter.txt svneol=native#text/plain +res/cardsfolder/b/bounty_of_the_hunt.txt -text res/cardsfolder/b/bower_passage.txt -text res/cardsfolder/b/brace_for_impact.txt -text res/cardsfolder/b/brackwater_elemental.txt svneol=native#text/plain @@ -9210,6 +9211,7 @@ res/cardsfolder/s/shambleshark.txt -text res/cardsfolder/s/shambling_remains.txt svneol=native#text/plain res/cardsfolder/s/shambling_shell.txt svneol=native#text/plain res/cardsfolder/s/shambling_strider.txt svneol=native#text/plain +res/cardsfolder/s/shambling_swarm.txt -text res/cardsfolder/s/shanodin_dryads.txt svneol=native#text/plain res/cardsfolder/s/shape_anew.txt -text res/cardsfolder/s/shape_stealer.txt -text svneol=unset#text/plain diff --git a/res/cardsfolder/b/blessings_of_nature.txt b/res/cardsfolder/b/blessings_of_nature.txt index ccf82791b96..4416c7026cf 100644 --- a/res/cardsfolder/b/blessings_of_nature.txt +++ b/res/cardsfolder/b/blessings_of_nature.txt @@ -4,6 +4,7 @@ Types:Sorcery Text:no text K:Miracle:G A:SP$ PutCounter | Cost$ 4 G | ValidTgts$ Creature | TgtPrompt$ Select target creature to distribute counters to | CounterType$ P1P1 | CounterNum$ 4 | TargetMin$ 1 | TargetMax$ 4 | DividedAsYouChoose$ 4 | SpellDescription$ Distribute four +1+1 counters among any number of target creatures. +SVar:RemAIDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/blessings_of_nature.jpg SetInfo:AVR|Uncommon|http://magiccards.info/scans/en/avr/168.jpg diff --git a/res/cardsfolder/b/bounty_of_the_hunt.txt b/res/cardsfolder/b/bounty_of_the_hunt.txt new file mode 100644 index 00000000000..c648b41149d --- /dev/null +++ b/res/cardsfolder/b/bounty_of_the_hunt.txt @@ -0,0 +1,14 @@ +Name:Bounty of the Hunt +ManaCost:3 G G +Types:Instant +Text:no text +A:SP$ PutCounter | Cost$ 3 G G | ValidTgts$ Creature | TgtPrompt$ Select target creature to distribute counters to | CounterType$ P1P1 | CounterNum$ 3 | TargetMin$ 1 | TargetMax$ 3 | DividedAsYouChoose$ 3 | RememberCounters$ True | SubAbility$ DelayedRemoveCounters | RememberTargets$ True | SpellDescription$ Distribute three +1/+1 counters among one, two, or three target creatures. For each +1/+1 counter you put on a creature this way, remove a +1/+1 counter from that creature at the beginning of the next cleanup step. +A:SP$ PutCounter | Cost$ ExileFromHand<1/Card.Green> | CostDesc$ You may exile a green card from your hand | ValidTgts$ Creature | TgtPrompt$ Select target creature to distribute counters to | CounterType$ P1P1 | CounterNum$ 3 | TargetMin$ 1 | TargetMax$ 3 | DividedAsYouChoose$ 3 | RememberCounters$ True | SubAbility$ DelayedRemoveCounters | RememberTargets$ True | SpellDescription$ rather than pay CARDNAME's mana cost. +SVar:DelayedRemoveCounters:DB$ DelayedTrigger | Mode$ Phase | Phase$ Cleanup | Execute$ TrigRemoveCounter | Secondary$ True | TriggerDescription$ For each +1/+1 counter you put on a creature this way, remove a +1/+1 counter from that creature at the beginning of the next cleanup step. +SVar:TrigRemoveCounter:AB$ RemoveCounter | Cost$ 0 | Defined$ Remembered | CounterType$ P1P1 | CounterNum$ Remembered | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/bounty_of_the_hunt.jpg +SetInfo:ALL|Uncommon|http://magiccards.info/scans/en/ai/63.jpg +Oracle:You may exile a green card from your hand rather than pay Bounty of the Hunt's mana cost.\nDistribute three +1/+1 counters among one, two, or three target creatures. For each +1/+1 counter you put on a creature this way, remove a +1/+1 counter from that creature at the beginning of the next cleanup step. +End \ No newline at end of file diff --git a/res/cardsfolder/s/shambling_swarm.txt b/res/cardsfolder/s/shambling_swarm.txt new file mode 100644 index 00000000000..9c22692fbac --- /dev/null +++ b/res/cardsfolder/s/shambling_swarm.txt @@ -0,0 +1,15 @@ +Name:Shambling Swarm +ManaCost:1 B B B +Types:Creature Horror +Text:no text +PT:3/3 +T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ SwarmSpread | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME dies, distribute three -1/-1 counters among one, two, or three target creatures. For each -1/-1 counter you put on a creature this way, remove a -1/-1 counter from that creature at the beginning of the next end step. +SVar:SwarmSpread:AB$ PutCounter | Cost$ 0 | ValidTgts$ Creature | TgtPrompt$ Select target creature to distribute counters to | IsCurse$ True | CounterType$ M1M1 | CounterNum$ 3 | TargetMin$ 1 | TargetMax$ 3 | DividedAsYouChoose$ 3 | RememberCounters$ True | SubAbility$ DelayedRemoveCounters | RememberTargets$ True +SVar:DelayedRemoveCounters:DB$ DelayedTrigger | Mode$ Phase | Phase$ End of Turn | Execute$ TrigRemoveCounter | Secondary$ True | TriggerDescription$ For each -1/-1 counter you put on a creature this way, remove a -1/-1 counter from that creature at the beginning of the next end step. +SVar:TrigRemoveCounter:AB$ RemoveCounter | Cost$ 0 | Defined$ Remembered | CounterType$ M1M1 | CounterNum$ Remembered | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/shambling_swarm.jpg +SetInfo:TOR|Rare|http://magiccards.info/scans/en/tr/82.jpg +Oracle:When Shambling Swarm dies, distribute three -1/-1 counters among one, two, or three target creatures. For each -1/-1 counter you put on a creature this way, remove a -1/-1 counter from that creature at the beginning of the next end step. +End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index b777fb03690..f2d2dccbe0a 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -98,6 +98,7 @@ public class Card extends GameEntity implements Comparable { private final CardDamageHistory damageHistory = new CardDamageHistory(); private Map counters = new TreeMap(); + private Map> countersAddedBy = new TreeMap>(); private final Map triggeringObjects = new TreeMap(); private ArrayList extrinsicKeyword = new ArrayList(); // Hidden keywords won't be displayed on the card @@ -347,7 +348,7 @@ public class Card extends GameEntity implements Comparable { public void setPreFaceDownCharacteristic(CardCharacteristicName preCharacteristic) { this.preTFDCharacteristic = preCharacteristic; } - + /** * Turn face down. * @@ -700,7 +701,7 @@ public class Card extends GameEntity implements Comparable { public final void clearImprinted() { this.imprintedCards.clear(); } - + /** *

* addEncoded. @@ -750,7 +751,7 @@ public class Card extends GameEntity implements Comparable { */ public final void clearEncoded() { this.encodedCards.clear(); - } + } /** *

@@ -1260,6 +1261,15 @@ public class Card extends GameEntity implements Comparable { return true; } + public final int getTotalCountersToAdd(final CounterType counterType, final int baseAmount, final boolean applyMultiplier) { + if (!this.canHaveCountersPlacedOnIt(counterType)) { + return 0; + } + final int multiplier = applyMultiplier ? this.getController().getCounterDoublersMagnitude(counterType) : 1; + + return multiplier * baseAmount; + } + public final void addCounter(final CounterType counterType, final int n, final boolean applyMultiplier) { if (!this.canHaveCountersPlacedOnIt(counterType)) { return; @@ -1285,6 +1295,38 @@ public class Card extends GameEntity implements Comparable { this.updateObservers(); } + /** + *

+ * addCountersAddedBy. + *

+ * @param source the card adding the counters to this card + * @param counterType the counter type added + * @param counterAmount the amount of counters added + */ + public final void addCountersAddedBy(final Card source, final CounterType counterType, final int counterAmount) { + final Map counterMap = new TreeMap(); + counterMap.put(counterType, counterAmount); + this.countersAddedBy.put(source, counterMap); + } + + /** + *

+ * getCountersAddedBy. + *

+ * @param source the card the counters were added by + * @param counterType the counter type added + * @return the amount of counters added. + */ + public final int getCountersAddedBy(final Card source, final CounterType counterType) { + int counterAmount = 0; + if (this.countersAddedBy.containsKey(source)) { + final Map counterMap = this.countersAddedBy.get(source); + counterAmount = counterMap.containsKey(counterType) ? counterMap.get(counterType) : 0; + this.countersAddedBy.remove(source); + } + return counterAmount; + } + /** *

* subtractCounter. @@ -9076,11 +9118,11 @@ public class Card extends GameEntity implements Comparable { if (tr.getMode() != TriggerType.ChangesZone) { continue; } - + if (!params.get("Destination").equals(ZoneType.Battlefield.toString())) { continue; } - + if (params.containsKey("ValidCard") && !params.get("ValidCard").contains("Self")) { continue; } @@ -9102,11 +9144,11 @@ public class Card extends GameEntity implements Comparable { if (!(re instanceof ReplaceMoved)) { continue; } - + if (!params.get("Destination").equals(ZoneType.Battlefield.toString())) { continue; } - + if (params.containsKey("ValidCard") && !params.get("ValidCard").contains("Self")) { continue; } @@ -9130,9 +9172,9 @@ public class Card extends GameEntity implements Comparable { if (isToken() && !isCopiedToken()) { return 0; } - + int xPaid = 0; - + // 2012-07-22 - If a card is on the stack, count the xManaCost in with it's CMC if (Singletons.getModel().getGame().getCardsIn(ZoneType.Stack).contains(this) && getManaCost() != null) { xPaid = getXManaCostPaid() * getManaCost().countX(); diff --git a/src/main/java/forge/card/ability/effects/CountersPutEffect.java b/src/main/java/forge/card/ability/effects/CountersPutEffect.java index d9c0f7dfed4..bade8dfdd88 100644 --- a/src/main/java/forge/card/ability/effects/CountersPutEffect.java +++ b/src/main/java/forge/card/ability/effects/CountersPutEffect.java @@ -74,6 +74,7 @@ public class CountersPutEffect extends SpellEffect { return; } + final boolean remember = sa.hasParam("RememberCounters"); int counterAmount = AbilityUtils.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa); final int max = sa.hasParam("MaxFromEffect") ? Integer.parseInt(sa.getParam("MaxFromEffect")) : -1; @@ -109,6 +110,10 @@ public class CountersPutEffect extends SpellEffect { if (zone == null) { // Do nothing, token disappeared } else if (zone.is(ZoneType.Battlefield) || zone.is(ZoneType.Stack)) { + if (remember) { + final int value = tgtCard.getTotalCountersToAdd(counterType, counterAmount, true); + tgtCard.addCountersAddedBy(card, counterType, value); + } tgtCard.addCounter(counterType, counterAmount, true); } else { // adding counters to something like re-suspend cards diff --git a/src/main/java/forge/card/ability/effects/CountersRemoveEffect.java b/src/main/java/forge/card/ability/effects/CountersRemoveEffect.java index 3382525837a..6202943d018 100644 --- a/src/main/java/forge/card/ability/effects/CountersRemoveEffect.java +++ b/src/main/java/forge/card/ability/effects/CountersRemoveEffect.java @@ -57,7 +57,7 @@ public class CountersRemoveEffect extends SpellEffect { final Card card = sa.getSourceCard(); final String type = sa.getParam("CounterType"); int counterAmount = 0; - if (!sa.getParam("CounterNum").equals("All")) { + if (!sa.getParam("CounterNum").equals("All") && !sa.getParam("CounterNum").equals("Remembered")) { counterAmount = AbilityUtils.calculateAmount(sa.getSourceCard(), sa.getParam("CounterNum"), sa); } @@ -83,6 +83,8 @@ public class CountersRemoveEffect extends SpellEffect { final Zone zone = Singletons.getModel().getGame().getZoneOf(tgtCard); if (sa.getParam("CounterNum").equals("All")) { counterAmount = tgtCard.getCounters(counterType); + } else if (sa.getParam("CounterNum").equals("Remembered")) { + counterAmount = tgtCard.getCountersAddedBy(card, counterType); } if (type.matches("Any")) {