1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 09:11:04 -09:00

Changed a lot of cards to use ENTERS_THE_BATTLEFIELD event instead of ZONE_CHANGE event.

This commit is contained in:
LevelX2 2013-02-17 01:14:42 +01:00
parent 50bb73fa08
commit 01a3660cf2
53 changed files with 358 additions and 935 deletions

View file

@ -31,18 +31,19 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.Constants.TargetController;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.UnblockableSourceEffect;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.CyclingAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -50,6 +51,13 @@ import mage.game.permanent.Permanent;
*/
public class GlassdustHulk extends CardImpl<GlassdustHulk> {
private static final FilterPermanent filter = new FilterArtifactPermanent("another artifact");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new AnotherPredicate());
}
public GlassdustHulk(UUID ownerId) {
super(ownerId, 7, "Glassdust Hulk", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}{W}{U}");
this.expansionSetCode = "ARB";
@ -61,7 +69,11 @@ public class GlassdustHulk extends CardImpl<GlassdustHulk> {
this.toughness = new MageInt(4);
// Whenever another artifact enters the battlefield under your control, Glassdust Hulk gets +1/+1 until end of turn and is unblockable this turn.
this.addAbility(new GlassdustHulkTriggeredAbility());
Ability ability = new EntersBattlefieldControlledTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), filter,
"Whenever another artifact enters the battlefield under your control, Glassdust Hulk gets +1/+1 until end of turn and is unblockable this turn.");
ability.addEffect(new UnblockableSourceEffect(Duration.EndOfTurn));
this.addAbility(ability);
this.addAbility(new CyclingAbility(new ManaCostsImpl("{W/U}")));
}
@ -74,40 +86,3 @@ public class GlassdustHulk extends CardImpl<GlassdustHulk> {
return new GlassdustHulk(this);
}
}
class GlassdustHulkTriggeredAbility extends TriggeredAbilityImpl<GlassdustHulkTriggeredAbility> {
GlassdustHulkTriggeredAbility() {
super(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn));
this.addEffect(new UnblockableSourceEffect(Duration.EndOfTurn));
}
GlassdustHulkTriggeredAbility(final GlassdustHulkTriggeredAbility ability) {
super(ability);
}
@Override
public GlassdustHulkTriggeredAbility copy() {
return new GlassdustHulkTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.ARTIFACT)
&& permanent.getControllerId().equals(this.controllerId)) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another artifact enters the battlefield under your control, {this} gets +1/+1 until end of turn and is unblockable this turn.";
}
}

View file

@ -27,26 +27,25 @@
*/
package mage.sets.avacynrestored;
import mage.Constants;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.MayTapOrUntapTargetEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
@ -54,6 +53,13 @@ import java.util.UUID;
*/
public class CaptainOfTheMists extends CardImpl<CaptainOfTheMists> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another Human");
static {
filter.add(new AnotherPredicate());
filter.add(new SubtypePredicate("Human"));
}
public CaptainOfTheMists(UUID ownerId) {
super(ownerId, 45, "Captain of the Mists", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.expansionSetCode = "AVR";
@ -65,10 +71,10 @@ public class CaptainOfTheMists extends CardImpl<CaptainOfTheMists> {
this.toughness = new MageInt(3);
// Whenever another Human enters the battlefield under your control, untap Captain of the Mists.
this.addAbility(new HumanEntersBattlefieldTriggeredAbility(new UntapSourceEffect(), false));
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new UntapSourceEffect(), filter));
// {1}{U}, {tap}: You may tap or untap target permanent.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new MayTapOrUntapTargetEffect(), new ManaCostsImpl("{1}{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MayTapOrUntapTargetEffect(), new ManaCostsImpl("{1}{U}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent());
this.addAbility(ability);
@ -83,39 +89,3 @@ public class CaptainOfTheMists extends CardImpl<CaptainOfTheMists> {
return new CaptainOfTheMists(this);
}
}
class HumanEntersBattlefieldTriggeredAbility extends TriggeredAbilityImpl {
public HumanEntersBattlefieldTriggeredAbility(Effect effect, boolean optional) {
super(Constants.Zone.BATTLEFIELD, effect, optional);
}
public HumanEntersBattlefieldTriggeredAbility(HumanEntersBattlefieldTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getControllerId().equals(this.controllerId)
&& (permanent.hasSubtype("Human") && !targetId.equals(this.getSourceId()))) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another Human enters the battlefield under your control, " + super.getRule();
}
@Override
public HumanEntersBattlefieldTriggeredAbility copy() {
return new HumanEntersBattlefieldTriggeredAbility(this);
}
}

View file

@ -28,20 +28,19 @@
package mage.sets.avacynrestored;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -49,6 +48,11 @@ import mage.game.permanent.Permanent;
*/
public class KruinStriker extends CardImpl<KruinStriker> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature");
static {
filter.add(new AnotherPredicate());
}
public KruinStriker(UUID ownerId) {
super(ownerId, 143, "Kruin Striker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "AVR";
@ -60,7 +64,10 @@ public class KruinStriker extends CardImpl<KruinStriker> {
this.toughness = new MageInt(1);
// Whenever another creature enters the battlefield under your control, Kruin Striker gets +1/+0 and gains trample until end of turn.
this.addAbility(new KruinStrikerAbility());
Ability ability = new EntersBattlefieldAllTriggeredAbility(new BoostSourceEffect(1, 0, Duration.EndOfTurn), filter,
"Whenever another creature enters the battlefield under your control, Kruin Striker gets +1/+0 and gains trample until end of turn.");
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn));
this.addAbility(ability);
}
public KruinStriker(final KruinStriker card) {
@ -72,40 +79,3 @@ public class KruinStriker extends CardImpl<KruinStriker> {
return new KruinStriker(this);
}
}
class KruinStrikerAbility extends TriggeredAbilityImpl<KruinStrikerAbility> {
public KruinStrikerAbility() {
super(Constants.Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Constants.Duration.EndOfTurn));
this.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Constants.Duration.EndOfTurn));
}
public KruinStrikerAbility(final KruinStrikerAbility ability) {
super(ability);
}
@Override
public KruinStrikerAbility copy() {
return new KruinStrikerAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another creature enters the battlefield under your control, {this} gets +1/+0 and gains trample until end of turn.";
}
}

View file

@ -32,10 +32,14 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -48,6 +52,10 @@ import mage.game.permanent.Permanent;
*/
public class SeraphSanctuary extends CardImpl<SeraphSanctuary> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("an Angel");
static {
filter.add(new SubtypePredicate("Angel"));
}
public SeraphSanctuary(UUID ownerId) {
super(ownerId, 228, "Seraph Sanctuary", Rarity.COMMON, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "AVR";
@ -55,7 +63,7 @@ public class SeraphSanctuary extends CardImpl<SeraphSanctuary> {
// When Seraph Sanctuary enters the battlefield, you gain 1 life.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect(1)));
// Whenever an Angel enters the battlefield under your control, you gain 1 life.
this.addAbility(new SeraphSanctuaryTriggeredAbility());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GainLifeEffect(1), filter));
// {tap}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
}
@ -69,37 +77,3 @@ public class SeraphSanctuary extends CardImpl<SeraphSanctuary> {
return new SeraphSanctuary(this);
}
}
class SeraphSanctuaryTriggeredAbility extends TriggeredAbilityImpl<SeraphSanctuaryTriggeredAbility> {
public SeraphSanctuaryTriggeredAbility() {
super(Zone.BATTLEFIELD, new GainLifeEffect(1));
}
public SeraphSanctuaryTriggeredAbility(SeraphSanctuaryTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& permanent.hasSubtype("Angel")
&& permanent.getControllerId().equals(this.controllerId)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever an Angel enters the battlefield under your control, you gain 1 life.";
}
@Override
public SeraphSanctuaryTriggeredAbility copy() {
return new SeraphSanctuaryTriggeredAbility(this);
}
}

View file

@ -27,27 +27,33 @@
*/
package mage.sets.avacynrestored;
import mage.Constants;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import java.util.UUID;
/**
* @author noxx
*/
public class SoulOfTheHarvest extends CardImpl<SoulOfTheHarvest> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another nontoken creature");
static {
filter.add(new AnotherPredicate());
filter.add(Predicates.not(new TokenPredicate()));
}
public SoulOfTheHarvest(UUID ownerId) {
super(ownerId, 195, "Soul of the Harvest", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.expansionSetCode = "AVR";
@ -60,7 +66,7 @@ public class SoulOfTheHarvest extends CardImpl<SoulOfTheHarvest> {
this.addAbility(TrampleAbility.getInstance());
// Whenever another nontoken creature enters the battlefield under your control, you may draw a card.
this.addAbility(new SoulOfTheHarvestAbility());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), filter, true));
}
public SoulOfTheHarvest(final SoulOfTheHarvest card) {
@ -72,39 +78,3 @@ public class SoulOfTheHarvest extends CardImpl<SoulOfTheHarvest> {
return new SoulOfTheHarvest(this);
}
}
class SoulOfTheHarvestAbility extends TriggeredAbilityImpl<SoulOfTheHarvestAbility> {
public SoulOfTheHarvestAbility() {
super(Constants.Zone.BATTLEFIELD, new DrawCardControllerEffect(1), true);
}
public SoulOfTheHarvestAbility(final SoulOfTheHarvestAbility ability) {
super(ability);
}
@Override
public SoulOfTheHarvestAbility copy() {
return new SoulOfTheHarvestAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getControllerId().equals(this.controllerId) && !(permanent instanceof PermanentToken) && permanent.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another nontoken creature enters the battlefield under your control, you may draw a card";
}
}

View file

@ -28,10 +28,10 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -42,7 +42,6 @@ import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
@ -58,7 +57,7 @@ public class RoninWarclub extends CardImpl<RoninWarclub> {
this.expansionSetCode = "BOK";
this.subtype.add("Equipment");
// Equipped creature gets +2/+1.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(2, 1)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 1)));
// Whenever a creature enters the battlefield under your control, attach Ronin Warclub to that creature.
Ability ability = new RoninWarclubTriggeredAbility();
@ -66,7 +65,7 @@ public class RoninWarclub extends CardImpl<RoninWarclub> {
this.addAbility(ability);
// Equip {5} ({5}: Attach to target creature you control. Equip only as a sorcery.)
this.addAbility(new EquipAbility(Constants.Outcome.BoostCreature, new GenericManaCost(5)));
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(5)));
}
public RoninWarclub(final RoninWarclub card) {
@ -81,7 +80,7 @@ public class RoninWarclub extends CardImpl<RoninWarclub> {
private class RoninWarclubTriggeredAbility extends TriggeredAbilityImpl<RoninWarclubTriggeredAbility> {
public RoninWarclubTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new RoninWarclubAttachEffect(), false);
super(Zone.BATTLEFIELD, new RoninWarclubAttachEffect(), false);
}
public RoninWarclubTriggeredAbility(RoninWarclubTriggeredAbility ability) {
@ -90,10 +89,9 @@ public class RoninWarclub extends CardImpl<RoninWarclub> {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
if (permanent.getCardType().contains(CardType.CREATURE)
&& (permanent.getControllerId().equals(this.controllerId))) {
if (!this.getTargets().isEmpty()) {
@ -122,7 +120,7 @@ public class RoninWarclub extends CardImpl<RoninWarclub> {
private class RoninWarclubAttachEffect extends OneShotEffect<RoninWarclubAttachEffect> {
public RoninWarclubAttachEffect() {
super(Constants.Outcome.BoostCreature);
super(Outcome.BoostCreature);
this.staticText = "Whenever a creature enters the battlefield under your control, attach {this} to that creature";
}
@ -138,13 +136,20 @@ public class RoninWarclub extends CardImpl<RoninWarclub> {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
Permanent attachment = game.getPermanent(source.getSourceId());
if (permanent != null && attachment != null) {
if (attachment.getAttachedTo() != null) {
Permanent oldTarget = game.getPermanent(attachment.getAttachedTo());
if (oldTarget != null) {
oldTarget.removeAttachment(source.getSourceId(), game);
}
}
boolean result;
result = permanent.addAttachment(source.getSourceId(), game);
return result;
}
return false;
}
}
}

View file

@ -41,7 +41,6 @@ import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
@ -98,19 +97,19 @@ class ZoZuThePunisherAbility extends TriggeredAbilityImpl<ZoZuThePunisherAbility
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(player.getId()));
}
return true;
}
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(player.getId()));
}
return true;
}
}
}
return false;
}
return false;
}
@Override

View file

@ -45,6 +45,7 @@ import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
import mage.game.events.EntersTheBattlefieldEvent;
/**
*
@ -91,10 +92,9 @@ class FlayerTriggeredAbility extends TriggeredAbilityImpl<FlayerTriggeredAbility
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD
&& ((ZoneChangeEvent) event).getFromZone() == Constants.Zone.GRAVEYARD
if (((EntersTheBattlefieldEvent) event).getFromZone() == Constants.Zone.GRAVEYARD
&& permanent.getOwnerId().equals(controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)) {
Effect effect = this.getEffects().get(0);

View file

@ -30,7 +30,6 @@ package mage.sets.darkascension;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@ -48,7 +47,6 @@ import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.WolfToken;
@ -124,15 +122,13 @@ class HuntmasterOfTheFellsAbility extends TriggeredAbilityImpl<HuntmasterOfTheFe
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TRANSFORMED && event.getTargetId().equals(this.getSourceId())) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && !permanent.isTransformed())
return true;
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
if (permanent != null && !permanent.isTransformed()) {
return true;
}
}
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) {
return true;
}
return false;
}
@ -166,8 +162,9 @@ class RavagerOfTheFellsAbility extends TriggeredAbilityImpl<RavagerOfTheFellsAbi
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TRANSFORMED && event.getTargetId().equals(sourceId)) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.isTransformed())
if (permanent != null && permanent.isTransformed()) {
return true;
}
}
return false;
}

View file

@ -30,16 +30,13 @@ package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -47,6 +44,11 @@ import mage.game.events.ZoneChangeEvent;
*/
public class MidnightGuard extends CardImpl<MidnightGuard> {
private static final FilterPermanent filter = new FilterCreaturePermanent("another creature");
static {
filter.add(new AnotherPredicate());
}
public MidnightGuard(UUID ownerId) {
super(ownerId, 14, "Midnight Guard", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.expansionSetCode = "DKA";
@ -58,7 +60,7 @@ public class MidnightGuard extends CardImpl<MidnightGuard> {
this.toughness = new MageInt(3);
// Whenever another creature enters the battlefield, untap Midnight Guard.
this.addAbility(new MidnightGuardTriggeredAbility(new UntapSourceEffect()));
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new UntapSourceEffect(), filter));
}
public MidnightGuard(final MidnightGuard card) {
@ -70,41 +72,3 @@ public class MidnightGuard extends CardImpl<MidnightGuard> {
return new MidnightGuard(this);
}
}
class MidnightGuardTriggeredAbility extends TriggeredAbilityImpl<MidnightGuardTriggeredAbility> {
public MidnightGuardTriggeredAbility(Effect effect) {
this(effect, false);
}
public MidnightGuardTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
}
public MidnightGuardTriggeredAbility(MidnightGuardTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.BATTLEFIELD
&& zEvent.getTarget().getCardType().contains(CardType.CREATURE)
&& zEvent.getTargetId() != this.getSourceId()) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another creature enters the battlefield, " + super.getRule();
}
@Override
public MidnightGuardTriggeredAbility copy() {
return new MidnightGuardTriggeredAbility(this);
}
}

View file

@ -106,12 +106,10 @@ class GruulRagebeastTriggeredAbility extends TriggeredAbilityImpl<GruulRagebeast
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getControllerId().equals(this.controllerId)
if (permanent.getControllerId().equals(this.controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)
&& (targetId.equals(this.getSourceId())
|| !targetId.equals(this.getSourceId()))) {

View file

@ -28,20 +28,17 @@
package mage.sets.innistrad;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -49,6 +46,12 @@ import mage.game.permanent.Permanent;
*/
public class ChampionOfTheParish extends CardImpl<ChampionOfTheParish> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another Human");
static {
filter.add(new SubtypePredicate("Human"));
filter.add(new AnotherPredicate());
}
public ChampionOfTheParish(UUID ownerId) {
super(ownerId, 6, "Champion of the Parish", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}");
this.expansionSetCode = "ISD";
@ -60,7 +63,7 @@ public class ChampionOfTheParish extends CardImpl<ChampionOfTheParish> {
this.toughness = new MageInt(1);
// Whenever another Human enters the battlefield under your control, put a +1/+1 counter on Champion of the Parish.
this.addAbility(new HumanEntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false));
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), filter));
}
public ChampionOfTheParish(final ChampionOfTheParish card) {
@ -72,39 +75,3 @@ public class ChampionOfTheParish extends CardImpl<ChampionOfTheParish> {
return new ChampionOfTheParish(this);
}
}
class HumanEntersBattlefieldTriggeredAbility extends TriggeredAbilityImpl {
public HumanEntersBattlefieldTriggeredAbility(Effect effect, boolean optional) {
super(Constants.Zone.BATTLEFIELD, effect, optional);
}
public HumanEntersBattlefieldTriggeredAbility(HumanEntersBattlefieldTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getControllerId().equals(this.controllerId)
&& (permanent.hasSubtype("Human") && !targetId.equals(this.getSourceId()))) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another Human enters the battlefield under your control, " + super.getRule();
}
@Override
public HumanEntersBattlefieldTriggeredAbility copy() {
return new HumanEntersBattlefieldTriggeredAbility(this);
}
}

View file

@ -33,21 +33,28 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
* @author Loki
*/
public class MentorOfTheMeek extends CardImpl<MentorOfTheMeek> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature with power 2 or less");
static {
filter.add(new AnotherPredicate());
filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 3));
}
public MentorOfTheMeek(UUID ownerId) {
super(ownerId, 21, "Mentor of the Meek", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.expansionSetCode = "ISD";
@ -58,7 +65,8 @@ public class MentorOfTheMeek extends CardImpl<MentorOfTheMeek> {
this.toughness = new MageInt(2);
//Whenever another creature with power 2 or less enters the battlefield under your control, you may pay 1. If you do, draw a card.
this.addAbility(new MentorOfTheMeekAbility());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD, new DoIfCostPaid(new DrawCardControllerEffect(1), new ManaCostsImpl("{1}")),filter, true));
}
@ -72,41 +80,3 @@ public class MentorOfTheMeek extends CardImpl<MentorOfTheMeek> {
}
}
class MentorOfTheMeekAbility extends TriggeredAbilityImpl<MentorOfTheMeekAbility> {
public MentorOfTheMeekAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DrawCardControllerEffect(1), new ManaCostsImpl("{1}")), true);
}
public MentorOfTheMeekAbility(final MentorOfTheMeekAbility ability) {
super(ability);
}
@Override
public MentorOfTheMeekAbility copy() {
return new MentorOfTheMeekAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.getControllerId())
&& permanent.getPower().getValue() <= 2) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return new StringBuilder("Whenever another creature with power 2 or less enters the battlefield under your control, ").append(super.getRule()).toString();
}
}

View file

@ -28,20 +28,17 @@
package mage.sets.magic2010;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import java.util.UUID;
/**
*
@ -49,6 +46,11 @@ import java.util.UUID;
*/
public class SoulWarden extends CardImpl<SoulWarden> {
private static final FilterPermanent filter = new FilterCreaturePermanent("another creature");
static {
filter.add(new AnotherPredicate());
}
public SoulWarden(UUID ownerId) {
super(ownerId, 34, "Soul Warden", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{W}");
this.expansionSetCode = "M10";
@ -57,7 +59,8 @@ public class SoulWarden extends CardImpl<SoulWarden> {
this.color.setWhite(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addAbility(new SoulWardenAbility());
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new GainLifeEffect(1), filter));
}
public SoulWarden(final SoulWarden card) {
@ -70,36 +73,3 @@ public class SoulWarden extends CardImpl<SoulWarden> {
}
}
class SoulWardenAbility extends TriggeredAbilityImpl<SoulWardenAbility> {
public SoulWardenAbility() {
super(Zone.BATTLEFIELD, new GainLifeEffect(1));
}
public SoulWardenAbility(final SoulWardenAbility ability) {
super(ability);
}
@Override
public SoulWardenAbility copy() {
return new SoulWardenAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.CREATURE) && !permanent.getId().equals(this.getSourceId())) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another creature enters the battlefield, " + super.getRule();
}
}

View file

@ -131,11 +131,8 @@ class FrostTitanAbility2 extends TriggeredAbilityImpl<FrostTitanAbility2> {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
return true;
}
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId()) ) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
return true;
}
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
return true;
}
return false;
}

View file

@ -33,14 +33,14 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -48,6 +48,12 @@ import mage.game.permanent.Permanent;
*/
public class GarruksPackleader extends CardImpl<GarruksPackleader> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature with power 3 or greater");
static {
filter.add(new AnotherPredicate());
filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 2));
}
public GarruksPackleader(UUID ownerId) {
super(ownerId, 177, "Garruk's Packleader", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "M11";
@ -56,7 +62,8 @@ public class GarruksPackleader extends CardImpl<GarruksPackleader> {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
this.addAbility(new GarruksPackleaderAbility());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD, new DrawCardControllerEffect(1), filter, true));
}
public GarruksPackleader(final GarruksPackleader card) {
@ -69,39 +76,3 @@ public class GarruksPackleader extends CardImpl<GarruksPackleader> {
}
}
class GarruksPackleaderAbility extends TriggeredAbilityImpl<GarruksPackleaderAbility> {
public GarruksPackleaderAbility() {
super(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), true);
}
public GarruksPackleaderAbility(final GarruksPackleaderAbility ability) {
super(ability);
}
@Override
public GarruksPackleaderAbility copy() {
return new GarruksPackleaderAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId()) && permanent.getPower().getValue() > 2) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another creature with power 3 or greater enters the battlefield under your control, you may draw a card";
}
}

View file

@ -92,11 +92,8 @@ class GraveTitanAbility extends TriggeredAbilityImpl<GraveTitanAbility> {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
return true;
}
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId()) ) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
return true;
}
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
return true;
}
return false;
}

View file

@ -96,11 +96,8 @@ class InfernoTitanAbility extends TriggeredAbilityImpl<InfernoTitanAbility> {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
return true;
}
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId()) ) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
return true;
}
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
return true;
}
return false;
}

View file

@ -96,11 +96,8 @@ class PrimevalTitanAbility extends TriggeredAbilityImpl<PrimevalTitanAbility> {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
return true;
}
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId()) ) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
return true;
}
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
return true;
}
return false;
}

View file

@ -111,11 +111,8 @@ class SunTitanAbility extends TriggeredAbilityImpl<SunTitanAbility> {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
return true;
}
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId()) ) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
return true;
}
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) {
return true;
}
return false;
}

View file

@ -127,12 +127,9 @@ class AegisAngelEffect extends ReplacementEffectImpl<AegisAngelEffect> {
return false;
}
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD) {
this.used = true;
return false;
}
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(source.getSourceId())) {
this.used = true;
return false;
}
return event.getType().equals(GameEvent.EventType.DESTROY_PERMANENT)

View file

@ -84,10 +84,9 @@ class WarstormSurgeTriggeredAbility extends TriggeredAbilityImpl<WarstormSurgeTr
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
if (permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.controllerId)) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());

View file

@ -90,12 +90,10 @@ class HamletbackGoliathTriggeredAbility extends TriggeredAbilityImpl<HamletbackG
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
if (permanent.getCardType().contains(CardType.CREATURE)
&& !(targetId.equals(this.getSourceId()))) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));

View file

@ -31,11 +31,16 @@ import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToHandEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
@ -47,6 +52,11 @@ import mage.game.permanent.Permanent;
*/
public class VeilbornGhoul extends CardImpl<VeilbornGhoul> {
private static final FilterPermanent filter = new FilterControlledLandPermanent("a Swamp");
static {
filter.add(new SubtypePredicate("Swamp"));
}
public VeilbornGhoul(UUID ownerId) {
super(ownerId, 114, "Veilborn Ghoul", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.expansionSetCode = "M13";
@ -60,7 +70,9 @@ public class VeilbornGhoul extends CardImpl<VeilbornGhoul> {
this.addAbility(new CantBlockAbility());
// Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand.
this.addAbility(new VeilbornGhoulTriggeredAbility());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), filter, true));
}
public VeilbornGhoul(final VeilbornGhoul card) {
@ -72,36 +84,3 @@ public class VeilbornGhoul extends CardImpl<VeilbornGhoul> {
return new VeilbornGhoul(this);
}
}
class VeilbornGhoulTriggeredAbility extends TriggeredAbilityImpl<VeilbornGhoulTriggeredAbility> {
VeilbornGhoulTriggeredAbility() {
super(Constants.Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), true);
}
VeilbornGhoulTriggeredAbility(VeilbornGhoulTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.controllerId)) {
if(permanent.hasSubtype("Swamp")){
return true;
}
}
}
return false;
}
@Override
public VeilbornGhoulTriggeredAbility copy() {
return new VeilbornGhoulTriggeredAbility(this);
}
@Override
public String getRule() {
return "Whenever a Swamp enters the battlefield under your control, you may return Veilborn Ghoul from your graveyard to your hand.";
}
}

View file

@ -40,7 +40,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.players.Player;
@ -88,14 +87,11 @@ class MirrorworksAbility extends TriggeredAbilityImpl<MirrorworksAbility> {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && !(permanent instanceof PermanentToken) && permanent.getCardType().contains(CardType.ARTIFACT)) {
getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId()));
return true;
}
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && !event.getTargetId().equals(this.getSourceId())) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && !(permanent instanceof PermanentToken) && permanent.getCardType().contains(CardType.ARTIFACT)) {
getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getId()));
return true;
}
}
return false;
@ -149,4 +145,3 @@ class MirrorworksEffect extends OneShotEffect<MirrorworksEffect> {
}
}

View file

@ -121,20 +121,17 @@ class InvaderParasiteTriggeredAbility extends TriggeredAbilityImpl<InvaderParasi
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent p = game.getPermanent(event.getTargetId());
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (p != null && sourcePermanent != null) {
if (sourcePermanent.getImprinted().size() > 0) {
Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0));
if (p.getName().equals(imprintedCard.getName())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
Permanent p = game.getPermanent(event.getTargetId());
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (p != null && sourcePermanent != null) {
if (sourcePermanent.getImprinted().size() > 0) {
Card imprintedCard = game.getCard(sourcePermanent.getImprinted().get(0));
if (p.getName().equals(imprintedCard.getName())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
}
}

View file

@ -29,14 +29,13 @@
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MetalcraftCondition;
import mage.abilities.costs.mana.GenericManaCost;
@ -46,17 +45,14 @@ import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
* @author Loki
*/
public class PuresteelPaladin extends CardImpl<PuresteelPaladin> {
private static final FilterPermanent filter = new FilterPermanent("Equipment");
private static final FilterPermanent filter = new FilterControlledPermanent("Equipment");
static {
filter.add(new SubtypePredicate("Equipment"));
@ -70,8 +66,11 @@ public class PuresteelPaladin extends CardImpl<PuresteelPaladin> {
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new PuresteelPaladinTriggeredAbility());
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(
// Whenever an Equipment enters the battlefield under your control, you may draw a card.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new DrawCardControllerEffect(1), filter, true));
// Metalcraft - Equipment you control have equip {0} as long as you control three or more artifacts
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(
new GainAbilityControlledEffect(new EquipAbility(Outcome.AddAbility, new GenericManaCost(0)), Duration.WhileOnBattlefield, filter),
MetalcraftCondition.getInstance(),
"Metalcraft - Equipment you control have equip {0} as long as you control three or more artifacts")));
@ -86,38 +85,3 @@ public class PuresteelPaladin extends CardImpl<PuresteelPaladin> {
return new PuresteelPaladin(this);
}
}
class PuresteelPaladinTriggeredAbility extends TriggeredAbilityImpl<PuresteelPaladinTriggeredAbility> {
PuresteelPaladinTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new DrawCardControllerEffect(1), true);
}
PuresteelPaladinTriggeredAbility(final PuresteelPaladinTriggeredAbility ability) {
super(ability);
}
@Override
public PuresteelPaladinTriggeredAbility copy() {
return new PuresteelPaladinTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getSubtype().contains("Equipment")
&& permanent.getControllerId().equals(this.controllerId)) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever an Equipment enters the battlefield under your control, you may draw a card.";
}
}

View file

@ -29,19 +29,18 @@
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -49,6 +48,11 @@ import mage.game.permanent.Permanent;
*/
public class ShatteredAngel extends CardImpl<ShatteredAngel> {
private static final FilterPermanent filter = new FilterLandPermanent("a land");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public ShatteredAngel (UUID ownerId) {
super(ownerId, 23, "Shattered Angel", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.expansionSetCode = "NPH";
@ -56,8 +60,12 @@ public class ShatteredAngel extends CardImpl<ShatteredAngel> {
this.color.setWhite(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
this.addAbility(new ShatteredAngelTriggeredAbility());
// Whenever a land enters the battlefield under an opponent's control, you may gain 3 life.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
Zone.BATTLEFIELD, new GainLifeEffect(3), filter, true, "Whenever a land enters the battlefield under an opponent's control, you may gain 3 life."));
}
public ShatteredAngel (final ShatteredAngel card) {
@ -70,34 +78,3 @@ public class ShatteredAngel extends CardImpl<ShatteredAngel> {
}
}
class ShatteredAngelTriggeredAbility extends TriggeredAbilityImpl<ShatteredAngelTriggeredAbility> {
ShatteredAngelTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new GainLifeEffect(3), true);
}
ShatteredAngelTriggeredAbility(final ShatteredAngelTriggeredAbility ability) {
super(ability);
}
@Override
public ShatteredAngelTriggeredAbility copy() {
return new ShatteredAngelTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.LAND) && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a land enters the battlefield under an opponent's control, you may gain 3 life.";
}
}

View file

@ -33,13 +33,21 @@ import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
@ -51,6 +59,11 @@ import mage.target.targetpointer.FixedTarget;
*/
public class SuturePriest extends CardImpl<SuturePriest> {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature");
static {
filter.add(new AnotherPredicate());
}
public SuturePriest (UUID ownerId) {
super(ownerId, 25, "Suture Priest", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "NPH";
@ -58,8 +71,13 @@ public class SuturePriest extends CardImpl<SuturePriest> {
this.color.setWhite(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addAbility(new SuturePriestFirstTriggeredAbility());
// Whenever another creature enters the battlefield under your control,you gain 1 life.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GainLifeEffect(1), filter));
// Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life.
this.addAbility(new SuturePriestSecondTriggeredAbility());
}
public SuturePriest (final SuturePriest card) {
@ -72,38 +90,6 @@ public class SuturePriest extends CardImpl<SuturePriest> {
}
}
class SuturePriestFirstTriggeredAbility extends TriggeredAbilityImpl<SuturePriestFirstTriggeredAbility> {
SuturePriestFirstTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new GainLifeEffect(1), true);
}
SuturePriestFirstTriggeredAbility(final SuturePriestFirstTriggeredAbility ability) {
super(ability);
}
@Override
public SuturePriestFirstTriggeredAbility copy() {
return new SuturePriestFirstTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId()) && event.getPlayerId().equals(this.controllerId)) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
Card card = zEvent.getTarget();
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD && card != null && card.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another creature enters the battlefield under your control, " + modes.getText();
}
}
class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl<SuturePriestSecondTriggeredAbility> {
SuturePriestSecondTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), true);
@ -120,10 +106,10 @@ class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl<SuturePrie
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
Card card = zEvent.getTarget();
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD && card != null && card.getCardType().contains(CardType.CREATURE)) {
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}

View file

@ -28,7 +28,6 @@
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
@ -40,7 +39,6 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
@ -84,13 +82,10 @@ class TorporOrbEffect extends ReplacementEffectImpl<TorporOrbEffect> {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
return true;
}
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
return false;

View file

@ -96,10 +96,9 @@ class TrostaniSelesnyasVoiceTriggeredAbility extends TriggeredAbilityImpl<Trosta
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
if (permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.controllerId)
&& event.getTargetId() != this.getSourceId()) {
Effect effect = this.getEffects().get(0);

View file

@ -89,16 +89,13 @@ class RenegadeDoppelgangerTriggeredAbility extends TriggeredAbilityImpl<Renegade
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(permanent.getId()));
}
return true;
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && !event.getTargetId().equals(this.getSourceId())) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) && permanent.getControllerId().equals(this.getControllerId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(permanent.getId()));
}
return true;
}
}
return false;

View file

@ -29,22 +29,23 @@
package mage.sets.scarsofmirrodin;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.permanent.token.Token;
/**
@ -53,10 +54,20 @@ import mage.game.permanent.token.Token;
*/
public class GlintHawkIdol extends CardImpl<GlintHawkIdol> {
private static final FilterPermanent filter = new FilterArtifactPermanent("another artifact");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
filter.add(new AnotherPredicate());
}
public GlintHawkIdol (UUID ownerId) {
super(ownerId, 156, "Glint Hawk Idol", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "SOM";
this.addAbility(new GlintHawkIdolTriggeredAbility());
// Whenever another artifact enters the battlefield under your control, you may have {this} become a 2/2 Bird artifact creature with flying until end of turn.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new GlintHawkIdolToken(), "", Duration.EndOfTurn), filter, true));
this.addAbility(new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new GlintHawkIdolToken(), "", Duration.EndOfTurn), new ColoredManaCost(Constants.ColoredManaSymbol.W)));
}
@ -71,41 +82,6 @@ public class GlintHawkIdol extends CardImpl<GlintHawkIdol> {
}
class GlintHawkIdolTriggeredAbility extends TriggeredAbilityImpl<GlintHawkIdolTriggeredAbility> {
GlintHawkIdolTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new GlintHawkIdolToken(), "", Duration.EndOfTurn), true);
}
GlintHawkIdolTriggeredAbility(final GlintHawkIdolTriggeredAbility ability) {
super(ability);
}
@Override
public GlintHawkIdolTriggeredAbility copy() {
return new GlintHawkIdolTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.ARTIFACT)
&& permanent.getControllerId().equals(this.controllerId)) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another artifact enters the battlefield under your control, you may have {this} become a 2/2 Bird artifact creature with flying until end of turn.";
}
}
class GlintHawkIdolToken extends Token {
GlintHawkIdolToken() {
super("", "a 2/2 Bird artifact creature with flying");

View file

@ -97,7 +97,7 @@ class TunnelIgnusWatcher extends WatcherImpl {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.LAND) && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) {
int count = 1;
@ -132,7 +132,7 @@ class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl<TunnelIgnusTrigge
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.LAND) && game.getOpponents(this.controllerId).contains(permanent.getControllerId())) {
TunnelIgnusWatcher watcher = (TunnelIgnusWatcher) game.getState().getWatchers().get("LandPlayedCount", this.controllerId);

View file

@ -33,18 +33,15 @@ import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.TargetPermanent;
/**
@ -54,9 +51,12 @@ import mage.target.TargetPermanent;
public class ReaperKing extends CardImpl<ReaperKing> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Scarecrow creatures");
private static final FilterCreaturePermanent filterTrigger = new FilterCreaturePermanent("another Scarecrow");
static {
filter.add(new SubtypePredicate("Scarecrow"));
filterTrigger.add(new AnotherPredicate());
filterTrigger.add(new SubtypePredicate("Scarecrow"));
}
public ReaperKing(UUID ownerId) {
@ -76,7 +76,9 @@ public class ReaperKing extends CardImpl<ReaperKing> {
// Other Scarecrow creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
// Whenever another Scarecrow enters the battlefield under your control, destroy target permanent.
this.addAbility(new ReaperKingAbility());
Ability ability = new EntersBattlefieldControlledTriggeredAbility(new DestroyTargetEffect(), filterTrigger);
ability.addTarget(new TargetPermanent());
this.addAbility(ability);
}
@ -89,42 +91,3 @@ public class ReaperKing extends CardImpl<ReaperKing> {
return new ReaperKing(this);
}
}
class ReaperKingAbility extends TriggeredAbilityImpl<ReaperKingAbility> {
public ReaperKingAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), false);
this.addTarget(new TargetPermanent());
}
public ReaperKingAbility(ReaperKingAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (permanent.getControllerId().equals(this.controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)
&& permanent.hasSubtype("Scarecrow")
&& !targetId.equals(this.getSourceId())) {
return true;
}
}
}
return false;
}
@Override
public String getRule() {
return "Whenever another Scarecrow enters the battlefield under your control, " + super.getRule();
}
@Override
public ReaperKingAbility copy() {
return new ReaperKingAbility(this);
}
}

View file

@ -36,9 +36,8 @@ import mage.Constants.PhaseStep;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.ZoneChangeTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
@ -46,7 +45,6 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -65,7 +63,7 @@ public class IntruderAlarm extends CardImpl<IntruderAlarm> {
// Creatures don't untap during their controllers' untap steps.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new IntruderAlarmEffect()));
// Whenever a creature enters the battlefield, untap all creatures.
this.addAbility(new IntruderAlarmTriggeredAbility(new UntapAllCreatureEffect()));
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new UntapAllCreatureEffect(), new FilterCreaturePermanent()));
}
public IntruderAlarm(final IntruderAlarm card) {
@ -121,46 +119,10 @@ class IntruderAlarmEffect extends ReplacementEffectImpl<IntruderAlarmEffect> {
return "Creatures don't untap during their controllers' untap steps";
}
}
class IntruderAlarmTriggeredAbility extends ZoneChangeTriggeredAbility<IntruderAlarmTriggeredAbility> {
public IntruderAlarmTriggeredAbility(Effect effect) {
super(Constants.Zone.BATTLEFIELD, effect, "Whenever a creature enters the battlefield, ", false);
}
public IntruderAlarmTriggeredAbility(IntruderAlarmTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(Constants.CardType.CREATURE)) {
return true;
}
}
}
return false;
}
@Override
public IntruderAlarmTriggeredAbility copy() {
return new IntruderAlarmTriggeredAbility(this);
}
}
class UntapAllCreatureEffect extends OneShotEffect<UntapAllCreatureEffect> {
public UntapAllCreatureEffect() {
super(Outcome.Untap);
staticText = "untap all creatures";

View file

@ -42,7 +42,6 @@ import mage.cards.CardImpl;
import mage.filter.common.FilterLandCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
@ -117,9 +116,8 @@ class MoxDiamondReplacementEffect extends ReplacementEffectImpl<MoxDiamondReplac
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
UUID sourceID = source.getSourceId();
if(sourceID.equals(event.getTargetId())){
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
if(source.getSourceId().equals(event.getTargetId())){
return true;
}
}

View file

@ -82,10 +82,9 @@ class AngelicChorusTriggeredAbility extends TriggeredAbilityImpl<AngelicChorusTr
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
if (permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.controllerId)) {
Effect effect = this.getEffects().get(0);
effect.setValue("lifeSource", event.getTargetId());

View file

@ -102,7 +102,7 @@ class CallOfTheWildEffect extends OneShotEffect<CallOfTheWildEffect> {
if (card != null) {
if (card.getCardType().contains(CardType.CREATURE)) {
card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId());
card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId());
} else {
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
}

View file

@ -28,17 +28,15 @@
package mage.sets.worldwake;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -66,7 +64,7 @@ public class AmuletOfVigor extends CardImpl<AmuletOfVigor> {
class AmuletOfVigorTriggeredAbility extends TriggeredAbilityImpl<AmuletOfVigorTriggeredAbility> {
AmuletOfVigorTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new UntapTargetEffect());
super(Zone.BATTLEFIELD, new UntapTargetEffect());
}
AmuletOfVigorTriggeredAbility(final AmuletOfVigorTriggeredAbility ability) {
@ -80,16 +78,13 @@ class AmuletOfVigorTriggeredAbility extends TriggeredAbilityImpl<AmuletOfVigorTr
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.isTapped() && p.getControllerId().equals(this.controllerId)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.isTapped() && p.getControllerId().equals(this.controllerId)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
}
return false;

View file

@ -91,12 +91,10 @@ class ArchonOfRedemptionTriggeredAbility extends TriggeredAbilityImpl<ArchonOfRe
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getControllerId().equals(this.controllerId)
if (permanent.getControllerId().equals(this.controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)
&& (targetId.equals(this.getSourceId())
|| (permanent.getAbilities().contains(FlyingAbility.getInstance()) && !targetId.equals(this.getSourceId())))) {

View file

@ -99,7 +99,7 @@ class PermafrostTrapWatcher extends WatcherImpl<PermafrostTrapWatcher> {
if (condition == true) { // no need to check - condition has already occured
return;
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent perm = game.getPermanent(event.getTargetId());
if (perm.getCardType().contains(CardType.CREATURE) && perm.getColor().contains(ObjectColor.GREEN) && !perm.getControllerId().equals(controllerId)) {
condition = true;

View file

@ -32,7 +32,8 @@ import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.abilities.TriggeredAbilityImpl;
import mage.Constants.Zone;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.HasCounterCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
@ -40,12 +41,11 @@ import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
*
@ -55,9 +55,11 @@ public class QuestForTheGoblinLord extends CardImpl<QuestForTheGoblinLord> {
private static final String rule = "As long as Quest for the Goblin Lord has five or more quest counters on it, creatures you control get +2/+0.";
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
private static final FilterPermanent goblinFilter = new FilterControlledCreaturePermanent();
static {
filter.add(new ControllerPredicate(TargetController.YOU));
goblinFilter.add(new SubtypePredicate("Goblin"));
}
public QuestForTheGoblinLord(UUID ownerId) {
@ -67,7 +69,7 @@ public class QuestForTheGoblinLord extends CardImpl<QuestForTheGoblinLord> {
this.color.setRed(true);
// Whenever a Goblin enters the battlefield under your control, you may put a quest counter on Quest for the Goblin Lord.
this.addAbility(new QuestForTheGoblinLordTriggeredAbility());
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance()), goblinFilter, true));
// As long as Quest for the Goblin Lord has five or more quest counters on it, creatures you control get +2/+0.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new ConditionalContinousEffect(new BoostAllEffect(2, 0, Constants.Duration.WhileOnBattlefield, filter, false), new HasCounterCondition(CounterType.QUEST, 5, Integer.MAX_VALUE), rule)));
@ -82,35 +84,3 @@ public class QuestForTheGoblinLord extends CardImpl<QuestForTheGoblinLord> {
return new QuestForTheGoblinLord(this);
}
}
class QuestForTheGoblinLordTriggeredAbility extends TriggeredAbilityImpl<QuestForTheGoblinLordTriggeredAbility> {
QuestForTheGoblinLordTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true);
}
QuestForTheGoblinLordTriggeredAbility(final QuestForTheGoblinLordTriggeredAbility ability) {
super(ability);
}
@Override
public QuestForTheGoblinLordTriggeredAbility copy() {
return new QuestForTheGoblinLordTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.hasSubtype("Goblin") && permanent.getControllerId().equals(super.getControllerId())) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a Goblin enters the battlefield under your control, you may put a quest counter on {this}.";
}
}

View file

@ -104,17 +104,14 @@ class TalusPaladinTriggeredAbility extends TriggeredAbilityImpl<TalusPaladinTrig
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent ally = game.getPermanent(event.getTargetId());
if (ally != null) {
if (ally.hasSubtype("Ally")
&& ally.getControllerId().equals(this.getControllerId())) {
if (event.getTargetId().equals(this.getSourceId())
|| event.getTargetId().equals(ally.getId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.BATTLEFIELD) {
return true;
}
return true;
}
}
}

View file

@ -96,18 +96,15 @@ class TuktukScrapperTriggeredAbility extends TriggeredAbilityImpl<TuktukScrapper
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Constants.Zone.BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getId() == this.getSourceId()) {
return true;
}
if (permanent != null
&& permanent.hasSubtype("Ally")
&& permanent.getControllerId().equals(this.getControllerId())) {
return true;
}
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getId() == this.getSourceId()) {
return true;
}
if (permanent != null
&& permanent.hasSubtype("Ally")
&& permanent.getControllerId().equals(this.getControllerId())) {
return true;
}
}
return false;

View file

@ -96,7 +96,7 @@ class BalothCageTrapWatcher extends WatcherImpl<BalothCageTrapWatcher> {
if (condition == true) { // no need to check - condition has already occured
return;
}
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent perm = game.getPermanent(event.getTargetId());
if (perm.getCardType().contains(CardType.ARTIFACT) && !perm.getControllerId().equals(controllerId)) {
condition = true;

View file

@ -86,10 +86,9 @@ class ElectropotenceTriggeredAbility extends TriggeredAbilityImpl<Electropotence
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
if (permanent.getCardType().contains(CardType.CREATURE)
&& permanent.getControllerId().equals(this.controllerId)) {
Player player = game.getPlayer(this.getControllerId());
Card card = game.getCard(event.getTargetId());

View file

@ -137,8 +137,7 @@ class GigantiformTriggeredAbility extends TriggeredAbilityImpl<GigantiformTrigge
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(this.getSourceId())
&& ((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())
&& KickedCondition.getInstance().apply(game, this)) {
return true;
}

View file

@ -103,7 +103,7 @@ class LavaballTrapWatcher extends WatcherImpl<LavaballTrapWatcher> {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent perm = game.getPermanent(event.getTargetId());
if (perm.getCardType().contains(CardType.LAND)) {
Integer amount = amountOfLandsPlayedThisTurn.get(perm.getControllerId());

View file

@ -95,7 +95,7 @@ class ValakutTheMoltenPinnacleTriggeredAbility extends TriggeredAbilityImpl<Vala
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.BATTLEFIELD) {
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.LAND) && permanent.getControllerId().equals(this.getControllerId())) {
if(permanent.hasSubtype("Mountain")){

View file

@ -100,7 +100,7 @@ class WhiplashTrapWatcher extends WatcherImpl<WhiplashTrapWatcher> {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent perm = game.getPermanent(event.getTargetId());
if (perm.getCardType().contains(CardType.CREATURE)) {
Integer amount = amountOfCreaturesPlayedThisTurn.get(perm.getControllerId());

View file

@ -12,6 +12,8 @@ public class GoblinBushwhackerTest extends CardTestPlayerBase {
@Test
public void testKicker() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 2);
// Goblin Bushwhacker - Creature Goblin Warrior 1/1, R - Kicker {R} (You may pay an additional {R} as you cast this spell.)
// When Goblin Bushwhacker enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn.
addCard(Constants.Zone.HAND, playerA, "Goblin Bushwhacker");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");

View file

@ -57,7 +57,7 @@ public class ZoneChangeEvent extends GameEvent {
this.target = target;
if (appliedEffects != null) {
this.appliedEffects = appliedEffects;
};
}
}
public ZoneChangeEvent(UUID targetId, UUID sourceId, UUID playerId, Zone fromZone, Zone toZone) {