From 3fe7d3adf345adbce65666d11e10f6d66ee11152 Mon Sep 17 00:00:00 2001 From: Sloth Date: Fri, 9 Aug 2013 18:40:26 +0000 Subject: [PATCH] - Added Rasputin Dreamweaver. --- .gitattributes | 1 + res/cardsfolder/r/rasputin_dreamweaver.txt | 12 +++++++++ src/main/java/forge/Card.java | 30 +++++++++++++++++++++- src/main/java/forge/game/GameAction.java | 7 ++++- src/main/java/forge/game/phase/Untap.java | 3 +++ 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 res/cardsfolder/r/rasputin_dreamweaver.txt diff --git a/.gitattributes b/.gitattributes index 18b6b04b652..6c926e70d62 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8740,6 +8740,7 @@ res/cardsfolder/r/rapid_hybridization.txt -text res/cardsfolder/r/rappelling_scouts.txt svneol=native#text/plain res/cardsfolder/r/rashida_scalebane.txt svneol=native#text/plain res/cardsfolder/r/rashka_the_slayer.txt svneol=native#text/plain +res/cardsfolder/r/rasputin_dreamweaver.txt -text res/cardsfolder/r/ratcatcher.txt svneol=native#text/plain res/cardsfolder/r/ratchet_bomb.txt svneol=native#text/plain res/cardsfolder/r/rathi_assassin.txt svneol=native#text/plain diff --git a/res/cardsfolder/r/rasputin_dreamweaver.txt b/res/cardsfolder/r/rasputin_dreamweaver.txt new file mode 100644 index 00000000000..90226e790c7 --- /dev/null +++ b/res/cardsfolder/r/rasputin_dreamweaver.txt @@ -0,0 +1,12 @@ +Name:Rasputin Dreamweaver +ManaCost:4 W U +Types:Legendary Creature Human Wizard +PT:4/1 +K:etbCounter:DREAM:7 +K:CARDNAME can't have more than seven dream counters on it. +A:AB$ Mana | Cost$ SubCounter<1/DREAM> | Produced$ 1 | SpellDescription$ Add 1 to your mana pool. +A:AB$ PreventDamage | Cost$ SubCounter<1/DREAM> | Defined$ Self | Amount$ 1 | SpellDescription$ Prevent the next 1 damage that would be dealt to CARDNAME this turn. +T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | IsPresent$ Card.Self+startedTheTurnUntapped | TriggerDescription$ At the beginning of your upkeep, if CARDNAME started the turn untapped, put a dream counter on it. +SVar:TrigPutCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ DREAM | CounterNum$ 1 +SVar:Picture:http://www.wizards.com/global/images/magic/general/rasputin_dreamweaver.jpg +Oracle:Rasputin Dreamweaver enters the battlefield with seven dream counters on it.\nRemove a dream counter from Rasputin: Add {1} to your mana pool.\nRemove a dream counter from Rasputin: Prevent the next 1 damage that would be dealt to Rasputin this turn.\nAt the beginning of your upkeep, if Rasputin started the turn untapped, put a dream counter on it.\nRasputin can't have more than seven dream counters on it. \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 0495d27dc66..18d3137089f 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -153,6 +153,7 @@ public class Card extends GameEntity implements Comparable { private boolean startsGameInPlay = false; private boolean drawnThisTurn = false; private boolean becameTargetThisTurn = false; + private boolean startedTheTurnUntapped = false; private boolean tapped = false; private boolean sickness = true; // summoning sickness private boolean token = false; @@ -1106,6 +1107,10 @@ public class Card extends GameEntity implements Comparable { return false; } } + } else if (type == CounterType.DREAM) { + if (this.hasKeyword("CARDNAME can't have more than seven dream counters on it.") && this.getCounters(CounterType.DREAM) > 6) { + return false; + } } return true; } @@ -1113,7 +1118,11 @@ public class Card extends GameEntity implements Comparable { public final int getTotalCountersToAdd(final CounterType counterType, final int baseAmount, final boolean applyMultiplier) { if (this.canReceiveCounters(counterType)) { final int multiplier = applyMultiplier ? this.getController().getCounterDoublersMagnitude(counterType) : 1; - return multiplier * baseAmount; + int result = multiplier * baseAmount; + if (counterType == CounterType.DREAM && this.hasKeyword("CARDNAME can't have more than seven dream counters on it.")) { + result = Math.min(7 - this.getCounters(CounterType.DREAM), result); + } + return result; } return 0; } @@ -3050,6 +3059,21 @@ public class Card extends GameEntity implements Comparable { } + /** + * @return the startedTheTurnUntapped + */ + public boolean hasStartedTheTurnUntapped() { + return startedTheTurnUntapped; + } + + /** + * @param startedTheTurnUntapped0 the startedTheTurnUntapped to set + */ + public void setStartedTheTurnUntapped(boolean untapped) { + this.startedTheTurnUntapped = untapped; + } + + /** *

* Getter for the field owner. @@ -6133,6 +6157,10 @@ public class Card extends GameEntity implements Comparable { if (this.isFirstTurnControlled()) { return false; } + } else if (property.startsWith("startedTheTurnUntapped")) { + if (!this.hasStartedTheTurnUntapped()) { + return false; + } } else if (property.equals("attackedOrBlockedSinceYourLastUpkeep")) { if (!this.getDamageHistory().hasAttackedSinceLastUpkeepOf(sourceController) && !this.getDamageHistory().hasBlockedSinceLastUpkeepOf(sourceController)) { diff --git a/src/main/java/forge/game/GameAction.java b/src/main/java/forge/game/GameAction.java index 335d3bebea7..8d6ec92f8e4 100644 --- a/src/main/java/forge/game/GameAction.java +++ b/src/main/java/forge/game/GameAction.java @@ -858,7 +858,12 @@ public class GameAction { checkAgain = true; } - checkAgain |= stateBasedAction704_5r(c); // annihilatie +1/+1 counters with -1/-1 ones + checkAgain |= stateBasedAction704_5r(c); // annihilate +1/+1 counters with -1/-1 ones + + if (c.getCounters(CounterType.DREAM) > 7 && c.hasKeyword("CARDNAME can't have more than seven dream counters on it.")) { + c.subtractCounter(CounterType.DREAM, c.getCounters(CounterType.DREAM) - 7); + checkAgain = true; + } } if (game.getTriggerHandler().runWaitingTriggers()) { diff --git a/src/main/java/forge/game/phase/Untap.java b/src/main/java/forge/game/phase/Untap.java index 6497e14fc06..4fb39fd3a4a 100644 --- a/src/main/java/forge/game/phase/Untap.java +++ b/src/main/java/forge/game/phase/Untap.java @@ -124,6 +124,9 @@ public class Untap extends Phase { final Predicate tappedCanUntap = Predicates.and(Presets.TAPPED, CANUNTAP); List list = new ArrayList(player.getCardsIn(ZoneType.Battlefield)); + for (Card c : list) { + c.setStartedTheTurnUntapped(c.isUntapped()); + } List bounceList = CardLists.getKeyword(list, "During your next untap step, as you untap your permanents, return CARDNAME to its owner's hand."); for (final Card c : bounceList) {