Pulse Tracker

Fixes optional Copperhorn Trigger
Vampire Lacerator upkeep now only triggers on its controllers turn.
This commit is contained in:
maurer.it 2011-01-02 00:35:56 -05:00
parent d3e297c651
commit 6c5e1b6553
4 changed files with 148 additions and 7 deletions

View file

@ -76,7 +76,7 @@ public class CopperhornScout extends CardImpl<CopperhornScout> {
class CopperhornScoutTriggeredAbility extends TriggeredAbilityImpl<CopperhornScoutTriggeredAbility> { class CopperhornScoutTriggeredAbility extends TriggeredAbilityImpl<CopperhornScoutTriggeredAbility> {
public CopperhornScoutTriggeredAbility() { public CopperhornScoutTriggeredAbility() {
super(Zone.BATTLEFIELD, new CopperhornScoutUntapEffect(), true); super(Zone.BATTLEFIELD, new CopperhornScoutUntapEffect(), false);
} }
public CopperhornScoutTriggeredAbility(final CopperhornScoutTriggeredAbility ability) { public CopperhornScoutTriggeredAbility(final CopperhornScoutTriggeredAbility ability) {

View file

@ -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<PulseTracker> {
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<PulseTrackerTriggeredAbility> {
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> {
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);
}
}

View file

@ -27,13 +27,13 @@
*/ */
package mage.sets.zendikar; package mage.sets.zendikar;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.common.MyTurn; import mage.abilities.condition.common.MyTurn;
import java.util.UUID; import java.util.UUID;
import mage.Constants.CardType; import mage.Constants.CardType;
import mage.Constants.Rarity; import mage.Constants.Rarity;
import mage.Constants.Zone; import mage.Constants.Zone;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleTriggeredAbility;
import mage.abilities.condition.common.Unless; import mage.abilities.condition.common.Unless;
import mage.abilities.condition.common.TenOrLessLife; import mage.abilities.condition.common.TenOrLessLife;
import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.decorator.ConditionalOneShotEffect;
@ -74,23 +74,32 @@ public class VampireLacerator extends CardImpl<VampireLacerator> {
} }
} }
class VampireLaceratorTriggeredAbility extends SimpleTriggeredAbility { class VampireLaceratorTriggeredAbility extends TriggeredAbilityImpl<VampireLaceratorTriggeredAbility> {
VampireLaceratorTriggeredAbility ( ) { VampireLaceratorTriggeredAbility ( ) {
super(Zone.BATTLEFIELD, EventType.UPKEEP_STEP_PRE, super(Zone.BATTLEFIELD,
new ConditionalOneShotEffect( new ConditionalOneShotEffect(
new LoseLifeSourceEffect(1), new LoseLifeSourceEffect(1),
new Unless( new TenOrLessLife(AN_OPPONENT)), new Unless( new TenOrLessLife(AN_OPPONENT) ),
"At the beginning of your upkeep, you lose 1 " "At the beginning of your upkeep, you lose 1 "
+ "life unless an opponent has 10 or less life.")); + "life unless an opponent has 10 or less life."));
} }
VampireLaceratorTriggeredAbility ( VampireLaceratorTriggeredAbility ability ) {
super(ability);
}
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { 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 @Override
public String getRule() { public String getRule() {
return super.getRule(); return super.getRule();
} }
@Override
public VampireLaceratorTriggeredAbility copy() {
return new VampireLaceratorTriggeredAbility(this);
}
} }

View file

@ -52,7 +52,7 @@ public class ConditionalOneShotEffect extends OneShotEffect<ConditionalOneShotEf
} }
public ConditionalOneShotEffect ( ConditionalOneShotEffect effect ) { public ConditionalOneShotEffect ( ConditionalOneShotEffect effect ) {
this(effect, effect.condition, effect.text); this(effect.effect, effect.condition, effect.text);
} }
@Override @Override