From 6c5e1b655395d918cc5d7e79d6cc8f79376742ad Mon Sep 17 00:00:00 2001 From: "maurer.it" Date: Sun, 2 Jan 2011 00:35:56 -0500 Subject: [PATCH] Pulse Tracker Fixes optional Copperhorn Trigger Vampire Lacerator upkeep now only triggers on its controllers turn. --- .../sets/scarsofmirrodin/CopperhornScout.java | 2 +- .../src/mage/sets/worldwake/PulseTracker.java | 132 ++++++++++++++++++ .../mage/sets/zendikar/VampireLacerator.java | 19 ++- .../decorator/ConditionalOneShotEffect.java | 2 +- 4 files changed, 148 insertions(+), 7 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/worldwake/PulseTracker.java diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java index a8dc2e0875..beb4fd16b6 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/CopperhornScout.java @@ -76,7 +76,7 @@ public class CopperhornScout extends CardImpl { class CopperhornScoutTriggeredAbility extends TriggeredAbilityImpl { public CopperhornScoutTriggeredAbility() { - super(Zone.BATTLEFIELD, new CopperhornScoutUntapEffect(), true); + super(Zone.BATTLEFIELD, new CopperhornScoutUntapEffect(), false); } public CopperhornScoutTriggeredAbility(final CopperhornScoutTriggeredAbility ability) { diff --git a/Mage.Sets/src/mage/sets/worldwake/PulseTracker.java b/Mage.Sets/src/mage/sets/worldwake/PulseTracker.java new file mode 100644 index 0000000000..fe40f4473f --- /dev/null +++ b/Mage.Sets/src/mage/sets/worldwake/PulseTracker.java @@ -0,0 +1,132 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.worldwake; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; +import mage.players.Players; + +/** + * + * @author maurer.it_at_gmail.com + */ +public class PulseTracker extends CardImpl { + + public PulseTracker(UUID ownerId) { + super(ownerId, 62, "Pulse Tracker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}"); + this.expansionSetCode = "WWK"; + this.subtype.add("Vampire"); + this.subtype.add("Rogue"); + + this.color.setBlack(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + this.addAbility(new PulseTrackerTriggeredAbility()); + } + + public PulseTracker(final PulseTracker card) { + super(card); + } + + @Override + public PulseTracker copy() { + return new PulseTracker(this); + } +} + +class PulseTrackerTriggeredAbility extends TriggeredAbilityImpl { + + public PulseTrackerTriggeredAbility() { + super(Zone.BATTLEFIELD, new PulseTrackerLoseLifeEffect(), false); + } + + public PulseTrackerTriggeredAbility(final PulseTrackerTriggeredAbility ability) { + super(ability); + } + + @Override + public PulseTrackerTriggeredAbility copy() { + return new PulseTrackerTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever Pulse Tracker attacks, each opponent loses 1 life."; + } +} + +class PulseTrackerLoseLifeEffect extends OneShotEffect { + + PulseTrackerLoseLifeEffect ( ) { + super(Outcome.Damage); + } + + PulseTrackerLoseLifeEffect ( PulseTrackerLoseLifeEffect effect ) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Players players = game.getPlayers(); + + for ( Player player : players.values() ) { + if ( !player.getId().equals(source.getControllerId()) ) { + player.loseLife(1, game); + } + } + + return true; + } + + @Override + public PulseTrackerLoseLifeEffect copy() { + return new PulseTrackerLoseLifeEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java b/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java index 248eb8b805..a7065edfaa 100644 --- a/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java +++ b/Mage.Sets/src/mage/sets/zendikar/VampireLacerator.java @@ -27,13 +27,13 @@ */ package mage.sets.zendikar; +import mage.abilities.TriggeredAbilityImpl; import mage.abilities.condition.common.MyTurn; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.Constants.Zone; import mage.MageInt; -import mage.abilities.common.SimpleTriggeredAbility; import mage.abilities.condition.common.Unless; import mage.abilities.condition.common.TenOrLessLife; import mage.abilities.decorator.ConditionalOneShotEffect; @@ -74,23 +74,32 @@ public class VampireLacerator extends CardImpl { } } -class VampireLaceratorTriggeredAbility extends SimpleTriggeredAbility { +class VampireLaceratorTriggeredAbility extends TriggeredAbilityImpl { VampireLaceratorTriggeredAbility ( ) { - super(Zone.BATTLEFIELD, EventType.UPKEEP_STEP_PRE, + super(Zone.BATTLEFIELD, new ConditionalOneShotEffect( new LoseLifeSourceEffect(1), - new Unless( new TenOrLessLife(AN_OPPONENT)), + new Unless( new TenOrLessLife(AN_OPPONENT) ), "At the beginning of your upkeep, you lose 1 " + "life unless an opponent has 10 or less life.")); } + VampireLaceratorTriggeredAbility ( VampireLaceratorTriggeredAbility ability ) { + super(ability); + } + @Override public boolean checkTrigger(GameEvent event, Game game) { - return super.checkTrigger(event, game) && MyTurn.getInstance().apply(game, this); + return MyTurn.getInstance().apply(game, this) && event.getType() == EventType.UPKEEP_STEP_PRE; } @Override public String getRule() { return super.getRule(); } + + @Override + public VampireLaceratorTriggeredAbility copy() { + return new VampireLaceratorTriggeredAbility(this); + } } diff --git a/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java b/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java index 180dc9c17f..93e92b23cd 100644 --- a/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java +++ b/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java @@ -52,7 +52,7 @@ public class ConditionalOneShotEffect extends OneShotEffect