diff --git a/.gitattributes b/.gitattributes index 48f197e001c..822d0b5d061 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7058,6 +7058,7 @@ res/cardsfolder/r/ridgetop_raptor.txt svneol=native#text/plain res/cardsfolder/r/riding_red_hare.txt svneol=native#text/plain res/cardsfolder/r/riding_the_dilu_horse.txt svneol=native#text/plain res/cardsfolder/r/rift_bolt.txt svneol=native#text/plain +res/cardsfolder/r/riftmarked_knight.txt -text res/cardsfolder/r/riftstone_portal.txt svneol=native#text/plain res/cardsfolder/r/riftwing_cloudskate.txt svneol=native#text/plain res/cardsfolder/r/righteous_avengers.txt svneol=native#text/plain @@ -10991,6 +10992,7 @@ src/main/java/forge/card/trigger/TriggerChampioned.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerChangesZone.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerClashed.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerCounterAdded.java svneol=native#text/plain +src/main/java/forge/card/trigger/TriggerCounterRemoved.java -text src/main/java/forge/card/trigger/TriggerCycled.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerDamageDone.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerDiscarded.java svneol=native#text/plain diff --git a/res/cardsfolder/r/riftmarked_knight.txt b/res/cardsfolder/r/riftmarked_knight.txt new file mode 100644 index 00000000000..a4a4fc5dcf1 --- /dev/null +++ b/res/cardsfolder/r/riftmarked_knight.txt @@ -0,0 +1,15 @@ +Name:Riftmarked Knight +ManaCost:1 W W +Types:Creature Human Rebel Knight +Text:no text +PT:2/2 +K:Flanking +K:Protection from black +K:Suspend:3:1 W W +T:Mode$ CounterRemoved | ValidCard$ Card.Self | TriggerZones$ Exile | CounterType$ TIME | Execute$ TrigToken | IsPresent$ Card.Self+counters_GE1_TIME | PresentZone$ Exile | PresentCompare$ EQ0 | TriggerDescription$ When the last time counter is removed from CARDNAME while it's exiled, put a 2/2 black Knight creature token with flanking, protection from white, and haste onto the battlefield. +SVar:TrigToken:AB$Token | Cost$ 0 | TokenAmount$ 1 | TokenName$ Knight | TokenTypes$ Creature,Knight | TokenOwner$ You | TokenColors$ Black | TokenPower$ 2 | TokenToughness$ 2 | TokenKeywords$ Flanking<>Protection from white<>Haste +SVar:Rarity:Uncommon +SVar:Picture:http://www.wizards.com/global/images/magic/general/riftmarked_knight.jpg +SetInfo:PLC|Uncommon|http://magiccards.info/scans/en/pc/14.jpg +Oracle:Protection from black, flanking (Whenever a creature without flanking blocks this creature, the blocking creature gets -1/-1 until end of turn.)\nSuspend 3-{1}{W}{W} (Rather than cast this card from your hand, you may pay {1}{W}{W} and exile it with three time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost. It has haste.)\nWhen the last time counter is removed from Riftmarked Knight while it's exiled, put a 2/2 black Knight creature token with flanking, protection from white, and haste onto the battlefield. +End \ No newline at end of file diff --git a/res/cardsfolder/v/veiled_sentry.txt b/res/cardsfolder/v/veiled_sentry.txt index 3edb21647d4..c07474044ad 100644 --- a/res/cardsfolder/v/veiled_sentry.txt +++ b/res/cardsfolder/v/veiled_sentry.txt @@ -7,4 +7,6 @@ SVar:TrigAnimate:AB$ Animate | Cost$ 0 | Defined$ Self | Power$ X | Toughness$ X SVar:X:TriggeredCard$CardManaCost SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/veiled_sentry.jpg +SetInfo:USG|Uncommon|http://magiccards.info/scans/en/us/109.jpg +Oracle:When an opponent casts a spell, if Veiled Sentry is an enchantment, Veiled Sentry becomes an Illusion creature with power and toughness each equal to that spell's converted mana cost. End \ No newline at end of file diff --git a/res/cardsfolder/w/wild_dogs.txt b/res/cardsfolder/w/wild_dogs.txt index 1f6a4827a4e..4886fb205ca 100644 --- a/res/cardsfolder/w/wild_dogs.txt +++ b/res/cardsfolder/w/wild_dogs.txt @@ -10,4 +10,6 @@ SVar:X:Count$YourLifeTotal SVar:Y:Count$OppLifeTotal SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/wild_dogs.jpg +SetInfo:USG|Common|http://magiccards.info/scans/en/us/284.jpg +Oracle:At the beginning of your upkeep, if a player has more life than each other player, the player with the most life gains control of Wild Dogs.\nCycling {2} ({2}, Discard this card: Draw a card.) End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 04ece468bdb..4681c3d7c55 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -1524,8 +1524,6 @@ public class Card extends GameEntity implements Comparable { AllZone.getTriggerHandler().runTrigger("CounterAdded", runParams); } - AllZone.getGameAction().checkStateEffects(); - this.updateObservers(); } @@ -1546,6 +1544,15 @@ public class Card extends GameEntity implements Comparable { aux = 0; } this.counters.put(counterName, aux); + + // Run triggers + final Map runParams = new TreeMap(); + runParams.put("Card", this); + runParams.put("CounterType", counterName); + for (int i = 0; i < n; i++) { + AllZone.getTriggerHandler().runTrigger("CounterRemoved", runParams); + } + if (counterName.equals(Counters.TIME) && (aux == 0)) { final boolean hasVanish = CardFactoryUtil.hasKeyword(this, "Vanishing") != -1; @@ -1584,9 +1591,6 @@ public class Card extends GameEntity implements Comparable { } } } - - AllZone.getGameAction().checkStateEffects(); - this.updateObservers(); } } diff --git a/src/main/java/forge/card/trigger/TriggerCounterRemoved.java b/src/main/java/forge/card/trigger/TriggerCounterRemoved.java new file mode 100644 index 00000000000..7022f996416 --- /dev/null +++ b/src/main/java/forge/card/trigger/TriggerCounterRemoved.java @@ -0,0 +1,93 @@ +/* + * Forge: Play Magic: the Gathering. + * Copyright (C) 2011 Forge Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package forge.card.trigger; + +import java.util.HashMap; + +import forge.Card; +import forge.Counters; +import forge.card.spellability.SpellAbility; + +/** + *

+ * Trigger_CounterRemoved class. + *

+ * + * @author Forge + * @version $Id: TriggerCounterAdded.java 12297 2011-11-28 19:56:47Z jendave $ + */ +public class TriggerCounterRemoved extends Trigger { + + /** + *

+ * Constructor for Trigger_CounterRemoved. + *

+ * + * @param params + * a {@link java.util.HashMap} object. + * @param host + * a {@link forge.Card} object. + * @param intrinsic + * the intrinsic + */ + public TriggerCounterRemoved(final HashMap params, final Card host, final boolean intrinsic) { + super(params, host, intrinsic); + } + + /** {@inheritDoc} */ + @Override + public final boolean performTest(final java.util.Map runParams2) { + final Card addedTo = (Card) runParams2.get("Card"); + final Counters addedType = (Counters) runParams2.get("CounterType"); + + if (this.getMapParams().containsKey("ValidCard")) { + if (!addedTo.isValid(this.getMapParams().get("ValidCard").split(","), this.getHostCard().getController(), + this.getHostCard())) { + return false; + } + } + + if (this.getMapParams().containsKey("CounterType")) { + final String type = this.getMapParams().get("CounterType"); + if (!type.equals(addedType.toString())) { + return false; + } + } + + return true; + } + + /** {@inheritDoc} */ + @Override + public final Trigger getCopy() { + final Trigger copy = new TriggerCounterRemoved(this.getMapParams(), this.getHostCard(), this.isIntrinsic()); + if (this.getOverridingAbility() != null) { + copy.setOverridingAbility(this.getOverridingAbility()); + } + copy.setName(this.getName()); + copy.setID(this.getId()); + + return copy; + } + + /** {@inheritDoc} */ + @Override + public final void setTriggeringObjects(final SpellAbility sa) { + sa.setTriggeringObject("Card", this.getRunParams().get("Card")); + } +} diff --git a/src/main/java/forge/card/trigger/TriggerHandler.java b/src/main/java/forge/card/trigger/TriggerHandler.java index 250403ebf0b..8b86e32d4d7 100644 --- a/src/main/java/forge/card/trigger/TriggerHandler.java +++ b/src/main/java/forge/card/trigger/TriggerHandler.java @@ -225,6 +225,8 @@ public class TriggerHandler { ret = new TriggerClashed(mapParams, host, intrinsic); } else if (mode.equals("CounterAdded")) { ret = new TriggerCounterAdded(mapParams, host, intrinsic); + } else if (mode.equals("CounterRemoved")) { + ret = new TriggerCounterRemoved(mapParams, host, intrinsic); } else if (mode.equals("Cycled")) { ret = new TriggerCycled(mapParams, host, intrinsic); } else if (mode.equals("DamageDone")) {