diff --git a/Mage.Sets/src/mage/sets/avacynrestored/HarvesterOfSouls.java b/Mage.Sets/src/mage/sets/avacynrestored/HarvesterOfSouls.java index 87567e8eda4..73783d4240f 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/HarvesterOfSouls.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/HarvesterOfSouls.java @@ -30,10 +30,14 @@ package mage.sets.avacynrestored; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.DiesAnotherCreatureTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.DrawCardControllerEffect; import mage.abilities.keyword.DeathtouchAbility; import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.TokenPredicate; import java.util.UUID; @@ -42,6 +46,13 @@ import java.util.UUID; */ public class HarvesterOfSouls extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another nontoken creature"); + + static { + filter.add(Predicates.not(new TokenPredicate())); + filter.add(new AnotherPredicate()); + } + public HarvesterOfSouls(UUID ownerId) { super(ownerId, 107, "Harvester of Souls", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); this.expansionSetCode = "AVR"; @@ -54,7 +65,7 @@ public class HarvesterOfSouls extends CardImpl { this.addAbility(DeathtouchAbility.getInstance()); // Whenever another nontoken creature dies, you may draw a card. - this.addAbility(new DiesAnotherCreatureTriggeredAbility(new DrawCardControllerEffect(1), true, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new DrawCardControllerEffect(1), true, filter)); } public HarvesterOfSouls(final HarvesterOfSouls card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/HavengulVampire.java b/Mage.Sets/src/mage/sets/avacynrestored/HavengulVampire.java index c39a16c5077..d13d1d4c02c 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/HavengulVampire.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/HavengulVampire.java @@ -32,7 +32,7 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; -import mage.abilities.common.DiesAnotherCreatureTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.counters.CounterType; @@ -55,7 +55,7 @@ public class HavengulVampire extends CardImpl { // Whenever Havengul Vampire deals combat damage to a player, put a +1/+1 counter on it. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); // Whenever another creature dies, put a +1/+1 counter on Havengul Vampire. - this.addAbility(new DiesAnotherCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, true)); } public HavengulVampire(final HavengulVampire card) { diff --git a/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java b/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java index 113ae2309f3..4b56665db9c 100644 --- a/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java +++ b/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java @@ -30,14 +30,17 @@ package mage.sets.darkascension; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; +import mage.Constants.TargetController; import mage.MageInt; -import mage.abilities.common.DiesAnotherCreatureYouControlTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.permanent.token.SpiritWhiteToken; /** @@ -45,10 +48,12 @@ import mage.game.permanent.token.SpiritWhiteToken; * @author intimidatingant */ public class RequiemAngel extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("non-Spirit creature"); + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another non-Spirit creature you control"); static { filter.add(Predicates.not(new SubtypePredicate("Spirit"))); + filter.add(new AnotherPredicate()); + filter.add(new ControllerPredicate(TargetController.YOU)); } public RequiemAngel(UUID ownerId) { @@ -63,7 +68,7 @@ public class RequiemAngel extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever another non-Spirit creature you control dies, put a 1/1 white Spirit creature token with flying onto the battlefield. - this.addAbility(new DiesAnotherCreatureYouControlTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(), 1), false, filter)); + this.addAbility(new DiesCreatureTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(), 1), false, filter)); } public RequiemAngel(final RequiemAngel card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/GalvanicJuggernaut.java b/Mage.Sets/src/mage/sets/innistrad/GalvanicJuggernaut.java index 18b3487cf61..417fda0513f 100644 --- a/Mage.Sets/src/mage/sets/innistrad/GalvanicJuggernaut.java +++ b/Mage.Sets/src/mage/sets/innistrad/GalvanicJuggernaut.java @@ -33,7 +33,7 @@ import mage.Constants.Rarity; import mage.Constants.Zone; import mage.MageInt; import mage.abilities.common.AttacksEachTurnStaticAbility; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.SkipUntapSourceEffect; import mage.abilities.effects.common.UntapSourceEffect; @@ -58,7 +58,7 @@ public class GalvanicJuggernaut extends CardImpl { // Galvanic Juggernaut doesn't untap during your untap step. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipUntapSourceEffect())); // Whenever another creature dies, untap Galvanic Juggernaut. - this.addAbility(new CreatureDiesTriggeredAbility(new UntapSourceEffect(), false, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new UntapSourceEffect(), false, true)); } public GalvanicJuggernaut(final GalvanicJuggernaut card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/Lumberknot.java b/Mage.Sets/src/mage/sets/innistrad/Lumberknot.java index 91c0f30fdf4..9e81924abb4 100644 --- a/Mage.Sets/src/mage/sets/innistrad/Lumberknot.java +++ b/Mage.Sets/src/mage/sets/innistrad/Lumberknot.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.HexproofAbility; import mage.cards.CardImpl; @@ -54,7 +54,7 @@ public class Lumberknot extends CardImpl { this.addAbility(HexproofAbility.getInstance()); // Whenever a creature dies, put a +1/+1 counter on Lumberknot. - this.addAbility(new CreatureDiesTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); } public Lumberknot(final Lumberknot card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/MurderOfCrows.java b/Mage.Sets/src/mage/sets/innistrad/MurderOfCrows.java index c95fa660b55..6c27aa9d7b2 100644 --- a/Mage.Sets/src/mage/sets/innistrad/MurderOfCrows.java +++ b/Mage.Sets/src/mage/sets/innistrad/MurderOfCrows.java @@ -33,7 +33,7 @@ import mage.Constants.Outcome; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; @@ -57,7 +57,7 @@ public class MurderOfCrows extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever another creature dies, you may draw a card. If you do, discard a card. - this.addAbility(new CreatureDiesTriggeredAbility(new MurderOfCrowsEffect(), false, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new MurderOfCrowsEffect(), false, true)); } public MurderOfCrows(final MurderOfCrows card) { diff --git a/Mage.Sets/src/mage/sets/innistrad/RageThrower.java b/Mage.Sets/src/mage/sets/innistrad/RageThrower.java index 881f864eb33..d0d0195d989 100644 --- a/Mage.Sets/src/mage/sets/innistrad/RageThrower.java +++ b/Mage.Sets/src/mage/sets/innistrad/RageThrower.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.target.TargetPlayer; @@ -53,7 +53,7 @@ public class RageThrower extends CardImpl { this.toughness = new MageInt(2); // Whenever another creature dies, Rage Thrower deals 2 damage to target player. - CreatureDiesTriggeredAbility ability = new CreatureDiesTriggeredAbility(new DamageTargetEffect(2), false, true); + DiesCreatureTriggeredAbility ability = new DiesCreatureTriggeredAbility(new DamageTargetEffect(2), false, true); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/innistrad/UnrulyMob.java b/Mage.Sets/src/mage/sets/innistrad/UnrulyMob.java index 475d5d90813..15e524f3150 100644 --- a/Mage.Sets/src/mage/sets/innistrad/UnrulyMob.java +++ b/Mage.Sets/src/mage/sets/innistrad/UnrulyMob.java @@ -30,11 +30,15 @@ package mage.sets.innistrad; import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; +import mage.Constants.TargetController; import mage.MageInt; -import mage.abilities.common.DiesAnotherCreatureYouControlTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.cards.CardImpl; import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; /** * @@ -42,6 +46,13 @@ import mage.counters.CounterType; */ public class UnrulyMob extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("another creature you control"); + + static { + filter.add(new AnotherPredicate()); + filter.add(new ControllerPredicate(TargetController.YOU)); + } + public UnrulyMob(UUID ownerId) { super(ownerId, 39, "Unruly Mob", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.expansionSetCode = "ISD"; @@ -52,7 +63,7 @@ public class UnrulyMob extends CardImpl { this.toughness = new MageInt(1); // Whenever another creature you control dies, put a +1/+1 counter on Unruly Mob. - this.addAbility(new DiesAnotherCreatureYouControlTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, filter)); } public UnrulyMob(final UnrulyMob card) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/AlgaeGharial.java b/Mage.Sets/src/mage/sets/shardsofalara/AlgaeGharial.java index 91e12daecfe..7069c0752d4 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/AlgaeGharial.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/AlgaeGharial.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.ShroudAbility; import mage.cards.CardImpl; @@ -54,7 +54,7 @@ public class AlgaeGharial extends CardImpl { this.addAbility(ShroudAbility.getInstance()); // Whenever another creature dies, you may put a +1/+1 counter on Algae Gharial. - this.addAbility(new CreatureDiesTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true, true)); } public AlgaeGharial(final AlgaeGharial card) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/Deathgreeter.java b/Mage.Sets/src/mage/sets/shardsofalara/Deathgreeter.java index 0ef873a6ec1..8864f6be0f0 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/Deathgreeter.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/Deathgreeter.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; @@ -52,7 +52,7 @@ public class Deathgreeter extends CardImpl { this.toughness = new MageInt(1); // Whenever another creature dies, you may gain 1 life. - this.addAbility(new CreatureDiesTriggeredAbility(new GainLifeEffect(1), true, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new GainLifeEffect(1), true, true)); } public Deathgreeter(final Deathgreeter card) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/HissingIguanar.java b/Mage.Sets/src/mage/sets/shardsofalara/HissingIguanar.java index d0f9a1c7463..0afac25f236 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/HissingIguanar.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/HissingIguanar.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.target.TargetPlayer; @@ -52,7 +52,7 @@ public class HissingIguanar extends CardImpl { this.toughness = new MageInt(1); // Whenever another creature dies, you may have Hissing Iguanar deal 1 damage to target player. - CreatureDiesTriggeredAbility ability = new CreatureDiesTriggeredAbility(new DamageTargetEffect(1), true, true); + DiesCreatureTriggeredAbility ability = new DiesCreatureTriggeredAbility(new DamageTargetEffect(1), true, true); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/shardsofalara/RockslideElemental.java b/Mage.Sets/src/mage/sets/shardsofalara/RockslideElemental.java index 9ec5564a31b..8abc2c65569 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/RockslideElemental.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/RockslideElemental.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.cards.CardImpl; @@ -54,7 +54,7 @@ public class RockslideElemental extends CardImpl { this.addAbility(FirstStrikeAbility.getInstance()); // Whenever another creature dies, you may put a +1/+1 counter on Rockslide Elemental. - this.addAbility(new CreatureDiesTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true, true)); } public RockslideElemental(final RockslideElemental card) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/ScavengerDrake.java b/Mage.Sets/src/mage/sets/shardsofalara/ScavengerDrake.java index a506b42f59b..64db4f1d5c0 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/ScavengerDrake.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/ScavengerDrake.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; @@ -54,7 +54,7 @@ public class ScavengerDrake extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever another creature dies, you may put a +1/+1 counter on Scavenger Drake. - this.addAbility(new CreatureDiesTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true, true)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true, true)); } public ScavengerDrake(final ScavengerDrake card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/ButcherOfMalakir.java b/Mage.Sets/src/mage/sets/worldwake/ButcherOfMalakir.java index 20b117ae210..0b847ccc300 100644 --- a/Mage.Sets/src/mage/sets/worldwake/ButcherOfMalakir.java +++ b/Mage.Sets/src/mage/sets/worldwake/ButcherOfMalakir.java @@ -34,11 +34,12 @@ import mage.Constants.CardType; import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.DiesThisOrAnotherControlledCreatureTriggeredAbility; +import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; @@ -53,6 +54,8 @@ import mage.target.common.TargetControlledPermanent; */ public class ButcherOfMalakir extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control"); + public ButcherOfMalakir(UUID ownerId) { super(ownerId, 53, "Butcher of Malakir", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{B}{B}"); this.expansionSetCode = "WWK"; @@ -67,7 +70,7 @@ public class ButcherOfMalakir extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever Butcher of Malakir or another creature you control dies, each opponent sacrifices a creature. - this.addAbility(new DiesThisOrAnotherControlledCreatureTriggeredAbility(new ButcherOfMalakirEffect(), false)); + this.addAbility(new DiesThisOrAnotherCreatureTriggeredAbility(new ButcherOfMalakirEffect(), false, filter)); } public ButcherOfMalakir(final ButcherOfMalakir card) { @@ -79,7 +82,6 @@ public class ButcherOfMalakir extends CardImpl { return new ButcherOfMalakir(this); } } - class ButcherOfMalakirEffect extends OneShotEffect { public ButcherOfMalakirEffect() { diff --git a/Mage.Sets/src/mage/sets/zendikar/QuestForTheGravelord.java b/Mage.Sets/src/mage/sets/zendikar/QuestForTheGravelord.java index 1a945aa5b89..ec640ff9814 100644 --- a/Mage.Sets/src/mage/sets/zendikar/QuestForTheGravelord.java +++ b/Mage.Sets/src/mage/sets/zendikar/QuestForTheGravelord.java @@ -33,7 +33,7 @@ import mage.Constants.Rarity; import mage.Constants.Zone; import mage.MageInt; import mage.ObjectColor; -import mage.abilities.common.CreatureDiesTriggeredAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveCountersSourceCost; import mage.abilities.costs.common.SacrificeSourceCost; @@ -56,7 +56,7 @@ public class QuestForTheGravelord extends CardImpl { this.color.setBlack(true); // Whenever a creature dies, you may put a quest counter on Quest for the Gravelord. - this.addAbility(new CreatureDiesTriggeredAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true)); + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.QUEST.createInstance()), true)); // Remove three quest counters from Quest for the Gravelord and sacrifice it: Put a 5/5 black Zombie Giant creature token onto the battlefield. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken()), diff --git a/Mage/src/mage/abilities/common/CreatureDiesTriggeredAbility.java b/Mage/src/mage/abilities/common/CreatureDiesTriggeredAbility.java deleted file mode 100644 index f1a6b9a2704..00000000000 --- a/Mage/src/mage/abilities/common/CreatureDiesTriggeredAbility.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2011 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.abilities.common; - -import mage.Constants.CardType; -import mage.Constants.Zone; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; -import mage.game.permanent.Permanent; - -/** - * - * @author North - */ -public class CreatureDiesTriggeredAbility extends TriggeredAbilityImpl { - - protected boolean another; - - public CreatureDiesTriggeredAbility(Effect effect, boolean optional) { - this(effect, optional, false); - } - - public CreatureDiesTriggeredAbility(Effect effect, boolean optional, boolean another) { - super(Zone.BATTLEFIELD, effect, optional); - this.another = another; - } - - public CreatureDiesTriggeredAbility(final CreatureDiesTriggeredAbility ability) { - super(ability); - this.another = ability.another; - } - - @Override - public CreatureDiesTriggeredAbility copy() { - return new CreatureDiesTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (permanent != null && permanent.getCardType().contains(CardType.CREATURE) - && (!another || !permanent.getId().equals(this.getSourceId()))) { - return true; - } - } - return false; - } - - @Override - public String getRule() { - return "Whenever " + (another ? "another" : "a") + " creature dies, " + super.getRule(); - } -} diff --git a/Mage/src/mage/abilities/common/DiesAnotherCreatureTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesAnotherCreatureTriggeredAbility.java deleted file mode 100644 index 43087c828a3..00000000000 --- a/Mage/src/mage/abilities/common/DiesAnotherCreatureTriggeredAbility.java +++ /dev/null @@ -1,89 +0,0 @@ -package mage.abilities.common; - -import mage.Constants; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -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.PermanentToken; - -import java.util.UUID; - -/** - * noxx - */ -public class DiesAnotherCreatureTriggeredAbility extends TriggeredAbilityImpl { - - protected FilterCreaturePermanent filter; - protected boolean nontoken; - - public DiesAnotherCreatureTriggeredAbility(Effect effect, boolean optional) { - this(effect, optional, new FilterCreaturePermanent()); - } - - public DiesAnotherCreatureTriggeredAbility(Effect effect, boolean optional, boolean nontoken) { - this(effect, optional, new FilterCreaturePermanent(), nontoken); - } - - public DiesAnotherCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) { - this(effect, optional, filter, false); - } - - public DiesAnotherCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter, boolean nontoken) { - super(Constants.Zone.BATTLEFIELD, effect, optional); - this.filter = filter; - this.nontoken = nontoken; - } - - public DiesAnotherCreatureTriggeredAbility(DiesAnotherCreatureTriggeredAbility ability) { - super(ability); - this.filter = ability.filter; - this.nontoken = ability.nontoken; - } - - @Override - public DiesAnotherCreatureTriggeredAbility copy() { - return new DiesAnotherCreatureTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - - UUID sourceId = getSourceId(); - if (game.getPermanent(sourceId) == null) { - if (game.getLastKnownInformation(sourceId, Constants.Zone.BATTLEFIELD) == null) { - return false; - } - } - - if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD); - if (permanent != null) { - if (permanent.getId().equals(this.getSourceId())) { - return false; - } - if (nontoken && permanent instanceof PermanentToken) { - return false; - } - if (filter.match(permanent, game)) { - return true; - } - } - } - } - return false; - } - - @Override - public String getRule() { - if (nontoken) { - return "Whenever another nontoken creature dies, " + super.getRule(); - } - return "Whenever another creature dies, " + super.getRule(); - } -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java deleted file mode 100644 index 75c1e7850f1..00000000000 --- a/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.abilities.common; - -import mage.Constants; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -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.PermanentToken; - -import java.util.UUID; - -/** - * @author noxx - */ -public class DiesAnotherCreatureYouControlTriggeredAbility extends TriggeredAbilityImpl { - - protected FilterCreaturePermanent filter; - protected boolean nontoken; - - public DiesAnotherCreatureYouControlTriggeredAbility(Effect effect, boolean optional) { - this(effect, optional, new FilterCreaturePermanent()); - } - - public DiesAnotherCreatureYouControlTriggeredAbility(Effect effect, boolean optional, boolean nontoken) { - this(effect, optional, new FilterCreaturePermanent(), nontoken); - } - - public DiesAnotherCreatureYouControlTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) { - this(effect, optional, filter, false); - } - - public DiesAnotherCreatureYouControlTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter, boolean nontoken) { - super(Constants.Zone.BATTLEFIELD, effect, optional); - this.filter = filter; - this.nontoken = nontoken; - } - - public DiesAnotherCreatureYouControlTriggeredAbility(DiesAnotherCreatureYouControlTriggeredAbility ability) { - super(ability); - this.filter = ability.filter; - this.nontoken = ability.nontoken; - } - - @Override - public DiesAnotherCreatureYouControlTriggeredAbility copy() { - return new DiesAnotherCreatureYouControlTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - - UUID sourceId = getSourceId(); - if (game.getPermanent(sourceId) == null) { - if (game.getLastKnownInformation(sourceId, Constants.Zone.BATTLEFIELD) == null) { - return false; - } - } - - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - Permanent permanent = zEvent.getTarget(); - - if (nontoken && permanent instanceof PermanentToken) { - return false; - } - - if (permanent != null && permanent.getCardType().contains(Constants.CardType.CREATURE) && - zEvent.isDiesEvent() && - permanent.getControllerId().equals(this.getControllerId()) && filter != null && - filter.match(permanent, game)) { - return true; - } - } - return false; - } - - @Override - public String getRule() { - if (nontoken) { - return "Whenever another nontoken creature you control dies, " + super.getRule(); - } - return "Whenever another creature you control dies, " + super.getRule(); - } -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/common/DiesCreatureTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesCreatureTriggeredAbility.java new file mode 100644 index 00000000000..eecb58b02c8 --- /dev/null +++ b/Mage/src/mage/abilities/common/DiesCreatureTriggeredAbility.java @@ -0,0 +1,69 @@ +package mage.abilities.common; + +import mage.Constants.Zone; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; + +/** + * @author North + */ +public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl { + + protected FilterCreaturePermanent filter; + + public DiesCreatureTriggeredAbility(Effect effect, boolean optional) { + this(effect, optional, new FilterCreaturePermanent("a creature")); + } + + public DiesCreatureTriggeredAbility(Effect effect, boolean optional, boolean another) { + this(effect, optional, new FilterCreaturePermanent("another creature")); + filter.add(new AnotherPredicate()); + } + + public DiesCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) { + super(Zone.BATTLEFIELD, effect, optional); + this.filter = filter; + } + + public DiesCreatureTriggeredAbility(DiesCreatureTriggeredAbility ability) { + super(ability); + this.filter = ability.filter; + } + + @Override + public DiesCreatureTriggeredAbility copy() { + return new DiesCreatureTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + + if (game.getPermanent(sourceId) == null) { + if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { + return false; + } + } + + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null && filter.match(permanent, sourceId, controllerId, game)) { + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever " + filter.getMessage() + " dies, " + super.getRule(); + } +} diff --git a/Mage/src/mage/abilities/common/DiesThisOrAnotherControlledCreatureTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesThisOrAnotherControlledCreatureTriggeredAbility.java deleted file mode 100644 index 8bd20bf9819..00000000000 --- a/Mage/src/mage/abilities/common/DiesThisOrAnotherControlledCreatureTriggeredAbility.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.abilities.common; - -import mage.Constants; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.Effect; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; -import mage.game.permanent.Permanent; - -import java.util.UUID; -import mage.filter.common.FilterControlledCreaturePermanent; - -/** - * @author jeff - */ -public class DiesThisOrAnotherControlledCreatureTriggeredAbility extends TriggeredAbilityImpl { - - protected FilterControlledCreaturePermanent filter; - - public DiesThisOrAnotherControlledCreatureTriggeredAbility(Effect effect, boolean optional) { - this(effect, optional, new FilterControlledCreaturePermanent()); - } - - public DiesThisOrAnotherControlledCreatureTriggeredAbility(Effect effect, boolean optional, FilterControlledCreaturePermanent filter) { - super(Constants.Zone.BATTLEFIELD, effect, optional); - this.filter = filter; - } - - public DiesThisOrAnotherControlledCreatureTriggeredAbility(DiesThisOrAnotherControlledCreatureTriggeredAbility ability) { - super(ability); - this.filter = ability.filter; - } - - @Override - public DiesThisOrAnotherControlledCreatureTriggeredAbility copy() { - return new DiesThisOrAnotherControlledCreatureTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { - ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - - UUID sourceId = getSourceId(); - if (game.getPermanent(sourceId) == null) { - if (game.getLastKnownInformation(sourceId, Constants.Zone.BATTLEFIELD) == null) { - return false; - } - } - - if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD); - if (permanent != null) { - if (permanent.getId().equals(this.getSourceId())) { - return true; - } else { - if (filter.match(permanent, game)) { - return true; - } - } - } - } - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} or another creature you control dies, " + super.getRule(); - } -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/common/DiesThisOrAnotherCreatureTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesThisOrAnotherCreatureTriggeredAbility.java index 2b583d50688..5638471cd53 100644 --- a/Mage/src/mage/abilities/common/DiesThisOrAnotherCreatureTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/DiesThisOrAnotherCreatureTriggeredAbility.java @@ -27,7 +27,7 @@ */ package mage.abilities.common; -import mage.Constants; +import mage.Constants.Zone; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; import mage.filter.common.FilterCreaturePermanent; @@ -36,8 +36,6 @@ import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; -import java.util.UUID; - /** * @author noxx */ @@ -50,7 +48,7 @@ public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityI } public DiesThisOrAnotherCreatureTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) { - super(Constants.Zone.BATTLEFIELD, effect, optional); + super(Zone.BATTLEFIELD, effect, optional); this.filter = filter; } @@ -69,20 +67,19 @@ public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityI if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; - UUID sourceId = getSourceId(); if (game.getPermanent(sourceId) == null) { - if (game.getLastKnownInformation(sourceId, Constants.Zone.BATTLEFIELD) == null) { + if (game.getLastKnownInformation(sourceId, Zone.BATTLEFIELD) == null) { return false; } } - if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) { - Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD); + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); if (permanent != null) { if (permanent.getId().equals(this.getSourceId())) { return true; } else { - if (filter.match(permanent, game)) { + if (filter.match(permanent, sourceId, controllerId, game)) { return true; } } @@ -94,6 +91,6 @@ public class DiesThisOrAnotherCreatureTriggeredAbility extends TriggeredAbilityI @Override public String getRule() { - return "Whenever {this} or another creature dies, " + super.getRule(); + return "Whenever {this} or another " + filter.getMessage() + " dies, " + super.getRule(); } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/common/DiesTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesTriggeredAbility.java index 143ed2d1fc5..be58d8be359 100644 --- a/Mage/src/mage/abilities/common/DiesTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/DiesTriggeredAbility.java @@ -40,8 +40,6 @@ import mage.game.Game; */ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility { -// boolean used = false; - public DiesTriggeredAbility(Effect effect, boolean optional) { super(Zone.BATTLEFIELD, Zone.GRAVEYARD, effect, "When {this} dies, ", optional); } @@ -67,19 +65,4 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility