From fad4f53365aadc1907b414543d6ff7d85f332ae0 Mon Sep 17 00:00:00 2001 From: Styxo Date: Wed, 4 Jan 2017 15:10:25 +0100 Subject: [PATCH] [Refactor] Removed some duplicate classes --- .../src/mage/cards/a/AetherwindBasker.java | 4 +- .../src/mage/cards/a/ArashinForemost.java | 68 +++--------- .../src/mage/cards/a/ArmoryAutomaton.java | 100 +++++------------- .../src/mage/cards/a/AvenRiftwatcher.java | 4 +- .../src/mage/cards/b/BloodhallPriest.java | 52 ++------- .../mage/cards/b/BruseTarlBoorishHerder.java | 59 +++-------- Mage.Sets/src/mage/cards/c/ChiefEngineer.java | 73 +------------ .../src/mage/cards/d/DeadwoodTreefolk.java | 4 +- Mage.Sets/src/mage/cards/f/FrostTitan.java | 61 +++-------- .../src/mage/cards/g/GlintSleeveSiphoner.java | 44 +------- Mage.Sets/src/mage/cards/g/GraveTitan.java | 48 ++------- Mage.Sets/src/mage/cards/i/InfernoTitan.java | 51 ++------- .../src/mage/cards/k/KeldonMarauders.java | 4 +- .../src/mage/cards/m/MycosynthGolem.java | 68 ++---------- Mage.Sets/src/mage/cards/p/PrimevalTitan.java | 47 +------- .../src/mage/cards/r/RavingOniSlave.java | 4 +- .../src/mage/cards/s/SidisiBroodTyrant.java | 51 ++------- .../cards/s/SkysovereignConsulFlagship.java | 45 +------- .../mage/cards/s/SubterraneanShambler.java | 78 ++++++++++++++ Mage.Sets/src/mage/cards/s/SunTitan.java | 77 +++----------- .../src/mage/cards/s/SunderingTitan.java | 4 +- .../src/mage/cards/t/ThrummingStone.java | 64 +---------- Mage.Sets/src/mage/sets/TimeSpiral.java | 1 + ...fieldOrAttacksSourceTriggeredAbility.java} | 12 +-- ...efieldOrLeavesSourceTriggeredAbility.java} | 10 +- 25 files changed, 246 insertions(+), 787 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SubterraneanShambler.java rename Mage/src/main/java/mage/abilities/common/{EntersTheBattlefieldOrAttacksSourceTriggeredAbility.java => EntersBattlefieldOrAttacksSourceTriggeredAbility.java} (81%) rename Mage/src/main/java/mage/abilities/common/{EntersOrLeavesTheBattlefieldSourceTriggeredAbility.java => EntersBattlefieldOrLeavesSourceTriggeredAbility.java} (86%) diff --git a/Mage.Sets/src/mage/cards/a/AetherwindBasker.java b/Mage.Sets/src/mage/cards/a/AetherwindBasker.java index cbe3da7109..ac0f7345d9 100644 --- a/Mage.Sets/src/mage/cards/a/AetherwindBasker.java +++ b/Mage.Sets/src/mage/cards/a/AetherwindBasker.java @@ -29,7 +29,7 @@ package mage.cards.a; import java.util.UUID; import mage.MageInt; -import mage.abilities.common.EntersTheBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.PayEnergyCost; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; @@ -60,7 +60,7 @@ public class AetherwindBasker extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // Whenever Aetherwind Basker enters the battlefield or attacks, you get {E} for each creature you control. - this.addAbility(new EntersTheBattlefieldOrAttacksSourceTriggeredAbility(new GetEnergyCountersControllerEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("creature you control"), null)))); + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GetEnergyCountersControllerEffect(new PermanentsOnBattlefieldCount(new FilterControlledCreaturePermanent("creature you control"), null)))); // Pay {E}: Aetherwind Basker gets +1/+1 until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new PayEnergyCost(1))); diff --git a/Mage.Sets/src/mage/cards/a/ArashinForemost.java b/Mage.Sets/src/mage/cards/a/ArashinForemost.java index 06b6367359..bb1c83664d 100644 --- a/Mage.Sets/src/mage/cards/a/ArashinForemost.java +++ b/Mage.Sets/src/mage/cards/a/ArashinForemost.java @@ -29,20 +29,17 @@ package mage.cards.a; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -51,8 +48,15 @@ import mage.target.common.TargetControlledCreaturePermanent; */ public class ArashinForemost extends CardImpl { + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another target Warrior creature you control"); + + static { + filter.add(new SubtypePredicate("Warrior")); + filter.add(new AnotherPredicate()); + } + public ArashinForemost(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); this.subtype.add("Human"); this.subtype.add("Warrior"); this.power = new MageInt(2); @@ -60,9 +64,11 @@ public class ArashinForemost extends CardImpl { // Double strike this.addAbility(DoubleStrikeAbility.getInstance()); - + // Whenever Arashin Foremost enters the battlefield or attacks, another target Warrior creature you control gains double strike until end of turn. - this.addAbility(new ArashinForemostAbility()); + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn)); + ability.addTarget(new TargetControlledCreaturePermanent(filter)); + this.addAbility(ability); } public ArashinForemost(final ArashinForemost card) { @@ -74,49 +80,3 @@ public class ArashinForemost extends CardImpl { return new ArashinForemost(this); } } - -class ArashinForemostAbility extends TriggeredAbilityImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another Warrior creature you control"); - - static { - filter.add(new SubtypePredicate("Warrior")); - filter.add(new AnotherPredicate()); - } - - public ArashinForemostAbility() { - super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn), false); - this.addTarget(new TargetControlledCreaturePermanent(filter)); - } - - public ArashinForemostAbility(final ArashinForemostAbility ability) { - super(ability); - } - - @Override - public ArashinForemostAbility copy() { - return new ArashinForemostAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) ) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, another target Warrior creature you control gains double strike until end of turn"; - } - -} diff --git a/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java b/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java index d43b68cc37..a689074b5c 100644 --- a/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java +++ b/Mage.Sets/src/mage/cards/a/ArmoryAutomaton.java @@ -30,19 +30,15 @@ package mage.cards.a; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterArtifactPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; @@ -56,13 +52,13 @@ public class ArmoryAutomaton extends CardImpl { public ArmoryAutomaton(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); - + this.subtype.add("Construct"); this.power = new MageInt(2); this.toughness = new MageInt(2); - // Whenever Armory Automaton enters the battlefield or attacks, attach any number of target Equipments to it. - this.addAbility(new ArmoryAutomatonAbility()); + // Whenever Armory Automaton enters the battlefield or attacks, attach any number of target Equipment to it. + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new ArmoryAutomatonEffect())); } public ArmoryAutomaton(final ArmoryAutomaton card) { @@ -77,9 +73,15 @@ public class ArmoryAutomaton extends CardImpl { class ArmoryAutomatonEffect extends OneShotEffect { + private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("Equipment"); + + static { + filter.add(new SubtypePredicate("Equipment")); + } + public ArmoryAutomatonEffect() { super(Outcome.Benefit); - this.staticText = "Whenever {this} enters the battlefield or attacks, attach any number of target Equipments to it"; + this.staticText = "attach any number of target Equipment to it"; } public ArmoryAutomatonEffect(final ArmoryAutomatonEffect effect) { @@ -93,74 +95,26 @@ class ArmoryAutomatonEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - UUID aautomaton = source.getSourceId(); Player player = game.getPlayer(source.getControllerId()); - - FilterPermanent filterEquipment = new FilterPermanent("Equipment"); - - filterEquipment.add(new CardTypePredicate(CardType.ARTIFACT)); - filterEquipment.add(new SubtypePredicate("Equipment")); - - if (player == null) { - return false; - } - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent == null) { - return false; - } - - int countBattlefield = game.getBattlefield().getAllActivePermanents(filterEquipment, game).size() - permanent.getAttachments().size(); - while (player.canRespond() - && countBattlefield > 0 - && player.chooseUse(Outcome.Benefit, "Attach a target Equipment?", source, game)) { - Target targetEquipment = new TargetPermanent(filterEquipment); - if (player.choose(Outcome.Benefit, targetEquipment, source.getSourceId(), game)) { - Permanent aura = game.getPermanent(targetEquipment.getFirstTarget()); - if (aura != null) { - Permanent attachedTo = game.getPermanent(aura.getAttachedTo()); - if (attachedTo != null) { - attachedTo.removeAttachment(aura.getId(), game); + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (player != null && sourcePermanent != null) { + int countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game).size() - sourcePermanent.getAttachments().size(); + while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.Benefit, "Attach a target Equipment?", source, game)) { + Target targetEquipment = new TargetPermanent(filter); + if (player.choose(Outcome.Benefit, targetEquipment, source.getSourceId(), game)) { + Permanent aura = game.getPermanent(targetEquipment.getFirstTarget()); + if (aura != null) { + Permanent attachedTo = game.getPermanent(aura.getAttachedTo()); + if (attachedTo != null) { + attachedTo.removeAttachment(aura.getId(), game); + } + sourcePermanent.addAttachment(aura.getId(), game); } - permanent.addAttachment(aura.getId(), game); } + countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game).size() - sourcePermanent.getAttachments().size(); } - countBattlefield = game.getBattlefield().getAllActivePermanents(filterEquipment, game).size() - permanent.getAttachments().size(); - } - - return true; - } -} - -class ArmoryAutomatonAbility extends TriggeredAbilityImpl { - - public ArmoryAutomatonAbility() { - super(Zone.BATTLEFIELD, new ArmoryAutomatonEffect(), false); - } - - public ArmoryAutomatonAbility(final ArmoryAutomatonAbility ability) { - super(ability); - } - - @Override - public ArmoryAutomatonAbility copy() { - return new ArmoryAutomatonAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { return true; } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return super.getRule(); + return false; } } diff --git a/Mage.Sets/src/mage/cards/a/AvenRiftwatcher.java b/Mage.Sets/src/mage/cards/a/AvenRiftwatcher.java index 53e4cc605f..d20eef5d9c 100644 --- a/Mage.Sets/src/mage/cards/a/AvenRiftwatcher.java +++ b/Mage.Sets/src/mage/cards/a/AvenRiftwatcher.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrLeavesSourceTriggeredAbility; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.FlyingAbility; @@ -67,7 +67,7 @@ public class AvenRiftwatcher extends CardImpl { this.addAbility(new VanishingSacrificeAbility()); // When Aven Riftwatcher enters the battlefield or leaves the battlefield, you gain 2 life. - this.addAbility(new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new GainLifeEffect(2), false)); + this.addAbility(new EntersBattlefieldOrLeavesSourceTriggeredAbility(new GainLifeEffect(2), false)); } public AvenRiftwatcher(final AvenRiftwatcher card) { diff --git a/Mage.Sets/src/mage/cards/b/BloodhallPriest.java b/Mage.Sets/src/mage/cards/b/BloodhallPriest.java index 4c8730a5aa..e4feffc12d 100644 --- a/Mage.Sets/src/mage/cards/b/BloodhallPriest.java +++ b/Mage.Sets/src/mage/cards/b/BloodhallPriest.java @@ -29,7 +29,8 @@ package mage.cards.b; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.condition.common.HellbentCondition; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.decorator.ConditionalTriggeredAbility; @@ -38,10 +39,6 @@ import mage.abilities.keyword.MadnessAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreatureOrPlayer; /** @@ -51,14 +48,20 @@ import mage.target.common.TargetCreatureOrPlayer; public class BloodhallPriest extends CardImpl { public BloodhallPriest(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}"); this.subtype.add("Vampire"); this.subtype.add("Cleric"); this.power = new MageInt(4); this.toughness = new MageInt(4); // Whenever Bloodhall Priest enters the battlefield or attacks, if you have no cards in hand, Bloodhall Priest deals 2 damage to target creature or player. - this.addAbility(new ConditionalTriggeredAbility(new BloodhallPriestAbility(), HellbentCondition.getInstance(), null)); + TriggeredAbility triggeredAbility = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new DamageTargetEffect(2)); + triggeredAbility.addTarget(new TargetCreatureOrPlayer()); + this.addAbility(new ConditionalTriggeredAbility( + triggeredAbility, + HellbentCondition.getInstance(), + "Whenever {this} enters the battlefield or attacks, if you have no cards in hand, {this} deals 2 damage to target creature or player" + )); // Madness {1}{B}{R} this.addAbility(new MadnessAbility(this, new ManaCostsImpl("{1}{B}{R}"))); @@ -73,38 +76,3 @@ public class BloodhallPriest extends CardImpl { return new BloodhallPriest(this); } } - -class BloodhallPriestAbility extends TriggeredAbilityImpl { - - public BloodhallPriestAbility() { - super(Zone.BATTLEFIELD, new DamageTargetEffect(2), false); - this.addTarget(new TargetCreatureOrPlayer()); - } - - public BloodhallPriestAbility(final BloodhallPriestAbility ability) { - super(ability); - } - - @Override - public BloodhallPriestAbility copy() { - return new BloodhallPriestAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, if you have no cards in hand, {this} deals 2 damage to target creature or player."; - } -} diff --git a/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java b/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java index 6bf8d8ae8e..3428205b8f 100644 --- a/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java +++ b/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java @@ -29,7 +29,9 @@ package mage.cards.b; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.abilities.keyword.LifelinkAbility; @@ -38,11 +40,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -61,7 +59,15 @@ public class BruseTarlBoorishHerder extends CardImpl { this.toughness = new MageInt(3); // Whenever Bruse Tarl, Boorish Herder enters the battlefield or attacks, target creature you control gains double strike and lifelink until end of turn. - this.addAbility(new BruseTarlAbility()); + Effect effect = new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn); + effect.setText("target creature you control gains double strike"); + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(effect); + effect = new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn); + effect.setText("and lifelink until end of turn"); + ability.addEffect(effect); + ability.addTarget(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("target creature you control"))); + + this.addAbility(ability); // Partner this.addAbility(PartnerAbility.getInstance()); @@ -76,44 +82,3 @@ public class BruseTarlBoorishHerder extends CardImpl { return new BruseTarlBoorishHerder(this); } } - -class BruseTarlAbility extends TriggeredAbilityImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("target creature you control"); - - public BruseTarlAbility() { - super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn), false); - addEffect(new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn)); - this.addTarget(new TargetControlledCreaturePermanent(filter)); - } - - public BruseTarlAbility(final BruseTarlAbility ability) { - super(ability); - } - - @Override - public BruseTarlAbility copy() { - return new BruseTarlAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, target creature you control gains double strike and lifelink until end of turn"; - } -} diff --git a/Mage.Sets/src/mage/cards/c/ChiefEngineer.java b/Mage.Sets/src/mage/cards/c/ChiefEngineer.java index 0fc0ee5ed8..e3ab5aa26f 100644 --- a/Mage.Sets/src/mage/cards/c/ChiefEngineer.java +++ b/Mage.Sets/src/mage/cards/c/ChiefEngineer.java @@ -29,40 +29,23 @@ package mage.cards.c; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect; import mage.abilities.keyword.ConvokeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; import mage.constants.Zone; -import mage.filter.FilterSpell; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.game.stack.Spell; -import mage.game.stack.StackObject; -import mage.players.Player; +import mage.filter.common.FilterArtifactSpell; /** * * @author LevelX2 */ public class ChiefEngineer extends CardImpl { - - private static final FilterSpell filter = new FilterSpell("Artifact spells you cast"); - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public ChiefEngineer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add("Vedalken"); this.subtype.add("Artificer"); @@ -70,9 +53,8 @@ public class ChiefEngineer extends CardImpl { this.toughness = new MageInt(3); // Artifact spells you cast have convoke. - this.addAbility(new SimpleStaticAbility( - Zone.BATTLEFIELD, new ChiefEngineerGainAbilitySpellsEffect(new ConvokeAbility(), filter))); - + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledSpellsEffect(new ConvokeAbility(), new FilterArtifactSpell("Artifact spells you cast")))); + } public ChiefEngineer(final ChiefEngineer card) { @@ -84,48 +66,3 @@ public class ChiefEngineer extends CardImpl { return new ChiefEngineer(this); } } - -class ChiefEngineerGainAbilitySpellsEffect extends ContinuousEffectImpl { - - private final Ability ability; - private final FilterSpell filter; - - public ChiefEngineerGainAbilitySpellsEffect(Ability ability, FilterSpell filter) { - super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); - this.ability = ability; - this.filter = filter; - staticText = filter.getMessage() + " have " + ability.getRule(); - } - - public ChiefEngineerGainAbilitySpellsEffect(final ChiefEngineerGainAbilitySpellsEffect effect) { - super(effect); - this.ability = effect.ability; - this.filter = effect.filter; - } - - @Override - public ChiefEngineerGainAbilitySpellsEffect copy() { - return new ChiefEngineerGainAbilitySpellsEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanent(source.getSourceId()); - if (player != null && permanent != null) { - for (StackObject stackObject : game.getStack()) { - // only spells cast, so no copies of spells - if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) { - Spell spell = (Spell) stackObject; - if (filter.match(spell, game)) { - if (!spell.getAbilities().contains(ability)) { - game.getState().addOtherAbility(spell.getCard(), ability); - } - } - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/d/DeadwoodTreefolk.java b/Mage.Sets/src/mage/cards/d/DeadwoodTreefolk.java index 95256fb603..25dce2ffa0 100644 --- a/Mage.Sets/src/mage/cards/d/DeadwoodTreefolk.java +++ b/Mage.Sets/src/mage/cards/d/DeadwoodTreefolk.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrLeavesSourceTriggeredAbility; import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.VanishingSacrificeAbility; @@ -70,7 +70,7 @@ public class DeadwoodTreefolk extends CardImpl { this.addAbility(new VanishingUpkeepAbility(3)); this.addAbility(new VanishingSacrificeAbility()); // When Deadwood Treefolk enters the battlefield or leaves the battlefield, return another target creature card from your graveyard to your hand. - ability = new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false); + ability = new EntersBattlefieldOrLeavesSourceTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false); Target target = new TargetCardInYourGraveyard(filter); ability.addTarget(target); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/f/FrostTitan.java b/Mage.Sets/src/mage/cards/f/FrostTitan.java index 70325de100..86ac14b6c4 100644 --- a/Mage.Sets/src/mage/cards/f/FrostTitan.java +++ b/Mage.Sets/src/mage/cards/f/FrostTitan.java @@ -25,14 +25,15 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.cards.f; import java.util.UUID; import mage.constants.CardType; import mage.constants.Zone; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.CounterUnlessPaysEffect; import mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect; @@ -52,17 +53,20 @@ import mage.target.TargetStackObject; public class FrostTitan extends CardImpl { public FrostTitan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}"); this.subtype.add("Giant"); this.power = new MageInt(6); this.toughness = new MageInt(6); - + // Whenever Frost Titan becomes the target of a spell or ability an opponent controls, counter that spell or ability unless its controller pays 2. - this.addAbility(new FrostTitanAbility1()); + this.addAbility(new FrostTitanAbility()); // Whenever Frost Titan enters the battlefield or attacks, tap target permanent. It doesn't untap during its controller's next untap step. - this.addAbility(new FrostTitanAbility2()); + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new TapTargetEffect()); + ability.addEffect(new DontUntapInControllersNextUntapStepTargetEffect("It")); + ability.addTarget(new TargetPermanent()); + this.addAbility(ability); } public FrostTitan(final FrostTitan card) { @@ -76,19 +80,19 @@ public class FrostTitan extends CardImpl { } -class FrostTitanAbility1 extends TriggeredAbilityImpl { +class FrostTitanAbility extends TriggeredAbilityImpl { - public FrostTitanAbility1() { + public FrostTitanAbility() { super(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new GenericManaCost(2)), false); } - public FrostTitanAbility1(final FrostTitanAbility1 ability) { + public FrostTitanAbility(final FrostTitanAbility ability) { super(ability); } @Override - public FrostTitanAbility1 copy() { - return new FrostTitanAbility1(this); + public FrostTitanAbility copy() { + return new FrostTitanAbility(this); } @Override @@ -114,40 +118,3 @@ class FrostTitanAbility1 extends TriggeredAbilityImpl { } } - -class FrostTitanAbility2 extends TriggeredAbilityImpl { - - public FrostTitanAbility2() { - super(Zone.BATTLEFIELD, new TapTargetEffect(), false); - this.addEffect(new DontUntapInControllersNextUntapStepTargetEffect()); - this.addTarget(new TargetPermanent()); - } - - public FrostTitanAbility2(final FrostTitanAbility2 ability) { - super(ability); - } - - @Override - public FrostTitanAbility2 copy() { - return new FrostTitanAbility2(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, tap target permanent. It doesn't untap during its controller's next untap step."; - } - -} diff --git a/Mage.Sets/src/mage/cards/g/GlintSleeveSiphoner.java b/Mage.Sets/src/mage/cards/g/GlintSleeveSiphoner.java index f483398a91..6d9c9af899 100644 --- a/Mage.Sets/src/mage/cards/g/GlintSleeveSiphoner.java +++ b/Mage.Sets/src/mage/cards/g/GlintSleeveSiphoner.java @@ -29,8 +29,8 @@ package mage.cards.g; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.costs.common.PayEnergyCost; import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DrawCardSourceControllerEffect; @@ -42,9 +42,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; /** * @@ -64,7 +61,7 @@ public class GlintSleeveSiphoner extends CardImpl { this.addAbility(new MenaceAbility()); // Whenever Glint-Sleeve Siphoner enters the battlefield or attacks, you get {E}. - this.addAbility(new GlintSleeveSiphonerAbility()); + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GetEnergyCountersControllerEffect(1))); // At the beginning of your upkeep, you may pay {E}{E}. If you do, draw a card and you lose 1 life. DoIfCostPaid doIfCostPaidEffect = new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new PayEnergyCost(2)); @@ -82,40 +79,3 @@ public class GlintSleeveSiphoner extends CardImpl { return new GlintSleeveSiphoner(this); } } - -class GlintSleeveSiphonerAbility extends TriggeredAbilityImpl { - - public GlintSleeveSiphonerAbility() { - super(Zone.BATTLEFIELD, new GetEnergyCountersControllerEffect(1), false); - } - - public GlintSleeveSiphonerAbility(final GlintSleeveSiphonerAbility ability) { - super(ability); - } - - @Override - public GlintSleeveSiphonerAbility copy() { - return new GlintSleeveSiphonerAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId())) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, target creature you control gains double strike and lifelink until end of turn"; - } -} diff --git a/Mage.Sets/src/mage/cards/g/GraveTitan.java b/Mage.Sets/src/mage/cards/g/GraveTitan.java index 62a76a8393..fb8e7b2de3 100644 --- a/Mage.Sets/src/mage/cards/g/GraveTitan.java +++ b/Mage.Sets/src/mage/cards/g/GraveTitan.java @@ -29,16 +29,12 @@ package mage.cards.g; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.keyword.DeathtouchAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.permanent.token.ZombieToken; /** @@ -48,14 +44,17 @@ import mage.game.permanent.token.ZombieToken; public class GraveTitan extends CardImpl { public GraveTitan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); this.subtype.add("Giant"); this.power = new MageInt(6); this.toughness = new MageInt(6); + // Deathtouch this.addAbility(DeathtouchAbility.getInstance()); - this.addAbility(new GraveTitanAbility()); + + // Whenever Grave Titan enters the battlefield or attacks, create two 2/2 black Zombie creature tokens. + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new CreateTokenEffect(new ZombieToken(), 2))); } public GraveTitan(final GraveTitan card) { @@ -68,38 +67,3 @@ public class GraveTitan extends CardImpl { } } - -class GraveTitanAbility extends TriggeredAbilityImpl { - - public GraveTitanAbility() { - super(Zone.BATTLEFIELD, new CreateTokenEffect(new ZombieToken(), 2), false); - } - - public GraveTitanAbility(final GraveTitanAbility ability) { - super(ability); - } - - @Override - public GraveTitanAbility copy() { - return new GraveTitanAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, create two 2/2 black Zombie creature tokens."; - } - -} diff --git a/Mage.Sets/src/mage/cards/i/InfernoTitan.java b/Mage.Sets/src/mage/cards/i/InfernoTitan.java index a3b4761a8b..49d3308bc8 100644 --- a/Mage.Sets/src/mage/cards/i/InfernoTitan.java +++ b/Mage.Sets/src/mage/cards/i/InfernoTitan.java @@ -29,7 +29,8 @@ package mage.cards.i; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DamageMultiEffect; @@ -39,9 +40,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreatureOrPlayerAmount; /** @@ -51,14 +49,19 @@ import mage.target.common.TargetCreatureOrPlayerAmount; public class InfernoTitan extends CardImpl { public InfernoTitan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}"); this.subtype.add("Giant"); this.power = new MageInt(6); this.toughness = new MageInt(6); + // {R}: Inferno Titan gets +1/+0 until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}"))); - this.addAbility(new InfernoTitanAbility()); + + // Whenever Inferno Titan enters the battlefield or attacks, it deals 3 damage divided as you choose among one, two, or three target creatures and/or players. + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new DamageMultiEffect(3)); + ability.addTarget(new TargetCreatureOrPlayerAmount(3)); + this.addAbility(ability); } public InfernoTitan(final InfernoTitan card) { @@ -71,39 +74,3 @@ public class InfernoTitan extends CardImpl { } } - -class InfernoTitanAbility extends TriggeredAbilityImpl { - - public InfernoTitanAbility() { - super(Zone.BATTLEFIELD, new DamageMultiEffect(3), false); - this.addTarget(new TargetCreatureOrPlayerAmount(3)); - } - - public InfernoTitanAbility(final InfernoTitanAbility ability) { - super(ability); - } - - @Override - public InfernoTitanAbility copy() { - return new InfernoTitanAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, it deals 3 damage divided as you choose among one, two, or three target creatures and/or players."; - } - -} diff --git a/Mage.Sets/src/mage/cards/k/KeldonMarauders.java b/Mage.Sets/src/mage/cards/k/KeldonMarauders.java index 33f4bcab1a..d68344b534 100644 --- a/Mage.Sets/src/mage/cards/k/KeldonMarauders.java +++ b/Mage.Sets/src/mage/cards/k/KeldonMarauders.java @@ -31,7 +31,7 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; -import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrLeavesSourceTriggeredAbility; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.keyword.VanishingSacrificeAbility; @@ -64,7 +64,7 @@ public class KeldonMarauders extends CardImpl { this.addAbility(new VanishingSacrificeAbility()); // When Keldon Marauders enters the battlefield or leaves the battlefield, it deals 1 damage to target player. - ability = new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new DamageTargetEffect(1), false); + ability = new EntersBattlefieldOrLeavesSourceTriggeredAbility(new DamageTargetEffect(1), false); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/m/MycosynthGolem.java b/Mage.Sets/src/mage/cards/m/MycosynthGolem.java index 757083e61a..df42c690fc 100644 --- a/Mage.Sets/src/mage/cards/m/MycosynthGolem.java +++ b/Mage.Sets/src/mage/cards/m/MycosynthGolem.java @@ -29,25 +29,15 @@ package mage.cards.m; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect; import mage.abilities.keyword.AffinityForArtifactsAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; import mage.constants.Zone; import mage.filter.FilterSpell; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.game.stack.Spell; -import mage.game.stack.StackObject; -import mage.players.Player; /** * @@ -55,8 +45,15 @@ import mage.players.Player; */ public class MycosynthGolem extends CardImpl { + private static final FilterSpell filter = new FilterSpell("Artifact creature spells"); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + filter.add(new CardTypePredicate(CardType.CREATURE)); + } + public MycosynthGolem(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{11}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{11}"); this.subtype.add("Golem"); this.power = new MageInt(4); @@ -66,8 +63,7 @@ public class MycosynthGolem extends CardImpl { this.addAbility(new AffinityForArtifactsAbility()); // Artifact creature spells you cast have affinity for artifacts. - this.addAbility(new SimpleStaticAbility( - Zone.BATTLEFIELD, new MycosynthGolemGainAbilitySpellsEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledSpellsEffect(new AffinityForArtifactsAbility(), filter))); } @@ -80,47 +76,3 @@ public class MycosynthGolem extends CardImpl { return new MycosynthGolem(this); } } - -class MycosynthGolemGainAbilitySpellsEffect extends ContinuousEffectImpl { - - private static final FilterSpell filter = new FilterSpell("Artifact creature spells you cast"); - private static final Ability ability = new AffinityForArtifactsAbility(); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - filter.add(new CardTypePredicate(CardType.CREATURE)); - } - - public MycosynthGolemGainAbilitySpellsEffect() { - super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); - staticText = "Artifact creature spells you cast have affinity for artifacts"; - } - - public MycosynthGolemGainAbilitySpellsEffect(final MycosynthGolemGainAbilitySpellsEffect effect) { - super(effect); - } - - @Override - public MycosynthGolemGainAbilitySpellsEffect copy() { - return new MycosynthGolemGainAbilitySpellsEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanent(source.getSourceId()); - if (controller != null && permanent != null) { - for (StackObject stackObject : game.getStack()) { - // only spells cast, so no copies of spells - if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) { - Spell spell = (Spell) stackObject; - if (filter.match(spell, game)) { - game.getState().addOtherAbility(spell.getCard(), ability); - } - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/p/PrimevalTitan.java b/Mage.Sets/src/mage/cards/p/PrimevalTitan.java index 7bdb543861..1425389f58 100644 --- a/Mage.Sets/src/mage/cards/p/PrimevalTitan.java +++ b/Mage.Sets/src/mage/cards/p/PrimevalTitan.java @@ -29,18 +29,14 @@ package mage.cards.p; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.constants.Zone; import mage.filter.common.FilterLandCard; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCardInLibrary; /** @@ -50,7 +46,7 @@ import mage.target.common.TargetCardInLibrary; public class PrimevalTitan extends CardImpl { public PrimevalTitan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); this.subtype.add("Giant"); this.power = new MageInt(6); @@ -60,7 +56,7 @@ public class PrimevalTitan extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // Whenever Primeval Titan enters the battlefield or attacks, you may search your library for up to two land cards, put them onto the battlefield tapped, then shuffle your library. - this.addAbility(new PrimevalTitanAbility()); + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 2, new FilterLandCard("land cards")), true, Outcome.PutLandInPlay))); } public PrimevalTitan(final PrimevalTitan card) { @@ -73,40 +69,3 @@ public class PrimevalTitan extends CardImpl { } } - -class PrimevalTitanAbility extends TriggeredAbilityImpl { - - public PrimevalTitanAbility() { - super(Zone.BATTLEFIELD, null, true); - TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterLandCard()); - this.addEffect(new SearchLibraryPutInPlayEffect(target, true, Outcome.PutLandInPlay)); - } - - public PrimevalTitanAbility(final PrimevalTitanAbility ability) { - super(ability); - } - - @Override - public PrimevalTitanAbility copy() { - return new PrimevalTitanAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, you may search your library for up to two land cards, put them onto the battlefield tapped, then shuffle your library."; - } - -} diff --git a/Mage.Sets/src/mage/cards/r/RavingOniSlave.java b/Mage.Sets/src/mage/cards/r/RavingOniSlave.java index a440584b58..af5c6f5ae5 100644 --- a/Mage.Sets/src/mage/cards/r/RavingOniSlave.java +++ b/Mage.Sets/src/mage/cards/r/RavingOniSlave.java @@ -30,7 +30,7 @@ package mage.cards.r; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrLeavesSourceTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -55,7 +55,7 @@ public class RavingOniSlave extends CardImpl { this.toughness = new MageInt(3); // When Raving Oni-Slave enters the battlefield or leaves the battlefield, you lose 3 life if you don't control a Demon. - this.addAbility(new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new RavingOniSlaveEffect(), false)); + this.addAbility(new EntersBattlefieldOrLeavesSourceTriggeredAbility(new RavingOniSlaveEffect(), false)); } public RavingOniSlave(final RavingOniSlave card) { diff --git a/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java b/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java index 242aa8bf52..62c68abedd 100644 --- a/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java +++ b/Mage.Sets/src/mage/cards/s/SidisiBroodTyrant.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.UUID; import mage.MageInt; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect; import mage.cards.Card; @@ -40,7 +41,6 @@ import mage.constants.CardType; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.game.events.ZoneChangeGroupEvent; import mage.game.permanent.token.ZombieToken; @@ -51,7 +51,7 @@ import mage.game.permanent.token.ZombieToken; public class SidisiBroodTyrant extends CardImpl { public SidisiBroodTyrant(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{G}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}{U}"); this.supertype.add("Legendary"); this.subtype.add("Naga"); this.subtype.add("Shaman"); @@ -60,7 +60,8 @@ public class SidisiBroodTyrant extends CardImpl { this.toughness = new MageInt(3); // Whenever Sidisi, Brood Tyrant enters the battlefield or attacks, put the top three cards of your library into your graveyard. - this.addAbility(new SidisiBroodTyrantAbility()); + this.addAbility(new EntersBattlefieldOrAttacksSourceTriggeredAbility(new PutTopCardOfLibraryIntoGraveControllerEffect(3))); + // Whenever one or more creature cards are put into your graveyard from your library, create a 2/2 black Zombie creature token. this.addAbility(new SidisiBroodTyrantTriggeredAbility()); } @@ -75,40 +76,6 @@ public class SidisiBroodTyrant extends CardImpl { } } -class SidisiBroodTyrantAbility extends TriggeredAbilityImpl { - - public SidisiBroodTyrantAbility() { - super(Zone.BATTLEFIELD, new PutTopCardOfLibraryIntoGraveControllerEffect(3), false); - } - - public SidisiBroodTyrantAbility(final SidisiBroodTyrantAbility ability) { - super(ability); - } - - @Override - public SidisiBroodTyrantAbility copy() { - return new SidisiBroodTyrantAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ATTACKER_DECLARED || event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, put the top three cards of your library into your graveyard."; - } -} - class SidisiBroodTyrantTriggeredAbility extends TriggeredAbilityImpl { public SidisiBroodTyrantTriggeredAbility() { @@ -129,19 +96,19 @@ class SidisiBroodTyrantTriggeredAbility extends TriggeredAbilityImpl { ZoneChangeGroupEvent zEvent = (ZoneChangeGroupEvent) event; if (zEvent != null && Zone.LIBRARY == zEvent.getFromZone() && Zone.GRAVEYARD == zEvent.getToZone() && zEvent.getCards() != null) { for (Card card : zEvent.getCards()) { - if (card != null) { - + if (card != null) { + UUID cardOwnerId = card.getOwnerId(); List cardType = card.getCardType(); - + if (cardOwnerId != null - && card.getOwnerId().equals(getControllerId()) + && card.getOwnerId().equals(getControllerId()) && cardType != null && card.getCardType().contains(CardType.CREATURE)) { return true; } } - + } } return false; diff --git a/Mage.Sets/src/mage/cards/s/SkysovereignConsulFlagship.java b/Mage.Sets/src/mage/cards/s/SkysovereignConsulFlagship.java index 705f1f7bf3..4b6a856394 100644 --- a/Mage.Sets/src/mage/cards/s/SkysovereignConsulFlagship.java +++ b/Mage.Sets/src/mage/cards/s/SkysovereignConsulFlagship.java @@ -30,7 +30,7 @@ package mage.cards.s; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.CrewAbility; import mage.abilities.keyword.FlyingAbility; @@ -38,12 +38,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.TargetController; -import mage.constants.Zone; import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent; import mage.filter.predicate.permanent.ControllerPredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.target.common.TargetCreatureOrPlaneswalker; /** @@ -53,12 +49,13 @@ import mage.target.common.TargetCreatureOrPlaneswalker; public class SkysovereignConsulFlagship extends CardImpl { private static final FilterCreatureOrPlaneswalkerPermanent filter = new FilterCreatureOrPlaneswalkerPermanent("creature or planeswalker an opponent controls"); + static { filter.add(new ControllerPredicate(TargetController.OPPONENT)); } public SkysovereignConsulFlagship(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); this.supertype.add("Legendary"); this.subtype.add("Vehicle"); this.power = new MageInt(6); @@ -68,7 +65,7 @@ public class SkysovereignConsulFlagship extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever Skysovereign, Consul Flagship enters the battlefield or attacks, it deals 3 damage to target creature or planeswalker an opponent controls. - Ability ability = new SkysovereignConsulFlagshipTriggeredAbility(); + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new DamageTargetEffect(3)); ability.addTarget(new TargetCreatureOrPlaneswalker(1, 1, filter, false)); this.addAbility(ability); @@ -85,37 +82,3 @@ public class SkysovereignConsulFlagship extends CardImpl { return new SkysovereignConsulFlagship(this); } } - -class SkysovereignConsulFlagshipTriggeredAbility extends TriggeredAbilityImpl { - - SkysovereignConsulFlagshipTriggeredAbility() { - super(Zone.BATTLEFIELD, new DamageTargetEffect(3), false); - } - - SkysovereignConsulFlagshipTriggeredAbility(final SkysovereignConsulFlagshipTriggeredAbility ability) { - super(ability); - } - - @Override - public SkysovereignConsulFlagshipTriggeredAbility copy() { - return new SkysovereignConsulFlagshipTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, it deals 3 damage to target creature or planeswalker an opponent controls."; - } -} diff --git a/Mage.Sets/src/mage/cards/s/SubterraneanShambler.java b/Mage.Sets/src/mage/cards/s/SubterraneanShambler.java new file mode 100644 index 0000000000..0e5ae92959 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SubterraneanShambler.java @@ -0,0 +1,78 @@ +/* + * 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.cards.s; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldOrLeavesSourceTriggeredAbility; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.keyword.EchoAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; + +/** + * + * @author Styxo + */ +public class SubterraneanShambler extends CardImpl { + + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("creature without flying"); + + static { + filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + + public SubterraneanShambler(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add("Elemental"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Echo {3}{R} + this.addAbility(new EchoAbility("{3}{R}")); + + // When Subterranean Shambler enters the battlefield or leaves the battlefield, it deals 1 damage to each creature without flying. + this.addAbility(new EntersBattlefieldOrLeavesSourceTriggeredAbility(new DamageAllEffect(1, filter), false)); + + } + + public SubterraneanShambler(final SubterraneanShambler card) { + super(card); + } + + @Override + public SubterraneanShambler copy() { + return new SubterraneanShambler(this); + } +} diff --git a/Mage.Sets/src/mage/cards/s/SunTitan.java b/Mage.Sets/src/mage/cards/s/SunTitan.java index 48abee8af7..cf3994d81c 100644 --- a/Mage.Sets/src/mage/cards/s/SunTitan.java +++ b/Mage.Sets/src/mage/cards/s/SunTitan.java @@ -29,22 +29,16 @@ package mage.cards.s; import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; import mage.filter.Filter.ComparisonType; -import mage.filter.FilterCard; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterPermanentCard; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.target.Target; import mage.target.common.TargetCardInYourGraveyard; /** @@ -53,15 +47,26 @@ import mage.target.common.TargetCardInYourGraveyard; */ public class SunTitan extends CardImpl { + private static final FilterPermanentCard filter = new FilterPermanentCard("permanent card with converted mana cost 3 or less from your graveyard"); + + static { + filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, 4)); + } + public SunTitan(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); this.subtype.add("Giant"); this.power = new MageInt(6); this.toughness = new MageInt(6); + // Vigilance this.addAbility(VigilanceAbility.getInstance()); - this.addAbility(new SunTitanAbility()); + + // Whenever Sun Titan enters the battlefield or attacks, you may return target permanent card with converted mana cost 3 or less from your graveyard to the battlefield. + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), true); + ability.addTarget(new TargetCardInYourGraveyard(filter)); + this.addAbility(ability); } public SunTitan(final SunTitan card) { @@ -74,53 +79,3 @@ public class SunTitan extends CardImpl { } } - -class SunTitanAbility extends TriggeredAbilityImpl { - - private static final FilterCard filter = new FilterCard("permanent card with converted mana cost 3 or less from your graveyard"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE), - new CardTypePredicate(CardType.ENCHANTMENT), - new CardTypePredicate(CardType.LAND), - new CardTypePredicate(CardType.PLANESWALKER))); - filter.add(new ConvertedManaCostPredicate(ComparisonType.LessThan, 4)); - } - - public SunTitanAbility() { - super(Zone.BATTLEFIELD, null, true); - Target target = new TargetCardInYourGraveyard(filter); - this.addTarget(target); - this.addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect()); - } - - public SunTitanAbility(final SunTitanAbility ability) { - super(ability); - } - - @Override - public SunTitanAbility copy() { - return new SunTitanAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.ATTACKER_DECLARED || event.getType() == EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) { - return true; - } - return event.getType() == EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()); - } - - @Override - public String getRule() { - return "Whenever {this} enters the battlefield or attacks, you may return target permanent card with converted mana cost 3 or less from your graveyard to the battlefield."; - } - -} diff --git a/Mage.Sets/src/mage/cards/s/SunderingTitan.java b/Mage.Sets/src/mage/cards/s/SunderingTitan.java index de826111d0..26f093240d 100644 --- a/Mage.Sets/src/mage/cards/s/SunderingTitan.java +++ b/Mage.Sets/src/mage/cards/s/SunderingTitan.java @@ -32,7 +32,7 @@ import java.util.Set; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.EntersOrLeavesTheBattlefieldSourceTriggeredAbility; +import mage.abilities.common.EntersBattlefieldOrLeavesSourceTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -60,7 +60,7 @@ public class SunderingTitan extends CardImpl { this.toughness = new MageInt(10); // When Sundering Titan enters the battlefield or leaves the battlefield, choose a land of each basic land type, then destroy those lands. - this.addAbility(new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(new SunderingTitanDestroyLandEffect(), false)); + this.addAbility(new EntersBattlefieldOrLeavesSourceTriggeredAbility(new SunderingTitanDestroyLandEffect(), false)); } public SunderingTitan(final SunderingTitan card) { diff --git a/Mage.Sets/src/mage/cards/t/ThrummingStone.java b/Mage.Sets/src/mage/cards/t/ThrummingStone.java index d0fc53c62d..7c1ba93988 100644 --- a/Mage.Sets/src/mage/cards/t/ThrummingStone.java +++ b/Mage.Sets/src/mage/cards/t/ThrummingStone.java @@ -27,41 +27,28 @@ */ package mage.cards.t; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.keyword.RippleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; import mage.constants.Zone; import mage.filter.FilterSpell; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.game.stack.Spell; -import mage.game.stack.StackObject; -import mage.players.Player; import java.util.UUID; +import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect; /** * @author klayhamn */ public class ThrummingStone extends CardImpl { - //applies to all spells - private static final FilterSpell anySpellFilter = new FilterSpell("Spells you cast"); - public ThrummingStone(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); this.supertype.add("Legendary"); // spells you cast have Ripple 4 - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ThrummingStoneGainAbilitySpellsEffect(new RippleAbility(4), anySpellFilter))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledSpellsEffect(new RippleAbility(4), new FilterSpell("spells")))); } public ThrummingStone(final ThrummingStone card) { @@ -73,48 +60,3 @@ public class ThrummingStone extends CardImpl { return new ThrummingStone(this); } } - -class ThrummingStoneGainAbilitySpellsEffect extends ContinuousEffectImpl { - - private final Ability ability; - private final FilterSpell filter; - - public ThrummingStoneGainAbilitySpellsEffect(Ability ability, FilterSpell filter) { - super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); - this.ability = ability; - this.filter = filter; - staticText = filter.getMessage() + " have " + ability.getRule(); - } - - public ThrummingStoneGainAbilitySpellsEffect(final ThrummingStoneGainAbilitySpellsEffect effect) { - super(effect); - this.ability = effect.ability.copy(); - this.filter = effect.filter.copy(); - } - - @Override - public ThrummingStoneGainAbilitySpellsEffect copy() { - return new ThrummingStoneGainAbilitySpellsEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanent(source.getSourceId()); - if (player != null && permanent != null) { - for (StackObject stackObject : game.getStack()) { - // only spells cast, so no copies of spells - if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) { - Spell spell = (Spell) stackObject; - if (filter.match(spell, game)) { - if (!spell.getAbilities().contains(ability)) { - game.getState().addOtherAbility(spell.getCard(), ability); - } - } - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/TimeSpiral.java b/Mage.Sets/src/mage/sets/TimeSpiral.java index 053169a522..b3c01a8ad8 100644 --- a/Mage.Sets/src/mage/sets/TimeSpiral.java +++ b/Mage.Sets/src/mage/sets/TimeSpiral.java @@ -253,6 +253,7 @@ public class TimeSpiral extends ExpansionSet { cards.add(new SetCardInfo("Strength in Numbers", 224, Rarity.COMMON, mage.cards.s.StrengthInNumbers.class)); cards.add(new SetCardInfo("Stronghold Overseer", 133, Rarity.RARE, mage.cards.s.StrongholdOverseer.class)); cards.add(new SetCardInfo("Stuffy Doll", 264, Rarity.RARE, mage.cards.s.StuffyDoll.class)); + cards.add(new SetCardInfo("Subterranean Shambler", 178, Rarity.COMMON, mage.cards.s.SubterraneanShambler.class)); cards.add(new SetCardInfo("Sudden Death", 134, Rarity.UNCOMMON, mage.cards.s.SuddenDeath.class)); cards.add(new SetCardInfo("Sudden Shock", 179, Rarity.UNCOMMON, mage.cards.s.SuddenShock.class)); cards.add(new SetCardInfo("Sudden Spoiling", 135, Rarity.RARE, mage.cards.s.SuddenSpoiling.class)); diff --git a/Mage/src/main/java/mage/abilities/common/EntersTheBattlefieldOrAttacksSourceTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksSourceTriggeredAbility.java similarity index 81% rename from Mage/src/main/java/mage/abilities/common/EntersTheBattlefieldOrAttacksSourceTriggeredAbility.java rename to Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksSourceTriggeredAbility.java index 17443fc201..44733c7ca9 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersTheBattlefieldOrAttacksSourceTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrAttacksSourceTriggeredAbility.java @@ -37,23 +37,23 @@ import mage.game.events.GameEvent; * * @author Styxo */ -public class EntersTheBattlefieldOrAttacksSourceTriggeredAbility extends TriggeredAbilityImpl { +public class EntersBattlefieldOrAttacksSourceTriggeredAbility extends TriggeredAbilityImpl { - public EntersTheBattlefieldOrAttacksSourceTriggeredAbility(Effect effect) { + public EntersBattlefieldOrAttacksSourceTriggeredAbility(Effect effect) { this(effect, false); } - public EntersTheBattlefieldOrAttacksSourceTriggeredAbility(Effect effect, boolean optional) { + public EntersBattlefieldOrAttacksSourceTriggeredAbility(Effect effect, boolean optional) { super(Zone.BATTLEFIELD, effect, optional); } - public EntersTheBattlefieldOrAttacksSourceTriggeredAbility(final EntersTheBattlefieldOrAttacksSourceTriggeredAbility ability) { + public EntersBattlefieldOrAttacksSourceTriggeredAbility(final EntersBattlefieldOrAttacksSourceTriggeredAbility ability) { super(ability); } @Override - public EntersTheBattlefieldOrAttacksSourceTriggeredAbility copy() { - return new EntersTheBattlefieldOrAttacksSourceTriggeredAbility(this); + public EntersBattlefieldOrAttacksSourceTriggeredAbility copy() { + return new EntersBattlefieldOrAttacksSourceTriggeredAbility(this); } @Override diff --git a/Mage/src/main/java/mage/abilities/common/EntersOrLeavesTheBattlefieldSourceTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrLeavesSourceTriggeredAbility.java similarity index 86% rename from Mage/src/main/java/mage/abilities/common/EntersOrLeavesTheBattlefieldSourceTriggeredAbility.java rename to Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrLeavesSourceTriggeredAbility.java index 64c83b86ff..02a0a1e1fb 100644 --- a/Mage/src/main/java/mage/abilities/common/EntersOrLeavesTheBattlefieldSourceTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/EntersBattlefieldOrLeavesSourceTriggeredAbility.java @@ -39,20 +39,20 @@ import mage.game.events.ZoneChangeEvent; * * @author LevelX2 */ -public class EntersOrLeavesTheBattlefieldSourceTriggeredAbility extends TriggeredAbilityImpl { +public class EntersBattlefieldOrLeavesSourceTriggeredAbility extends TriggeredAbilityImpl { - public EntersOrLeavesTheBattlefieldSourceTriggeredAbility(Effect effect, boolean optional) { + public EntersBattlefieldOrLeavesSourceTriggeredAbility(Effect effect, boolean optional) { super(Zone.BATTLEFIELD, effect, optional); setLeavesTheBattlefieldTrigger(true); } - public EntersOrLeavesTheBattlefieldSourceTriggeredAbility(final EntersOrLeavesTheBattlefieldSourceTriggeredAbility ability) { + public EntersBattlefieldOrLeavesSourceTriggeredAbility(final EntersBattlefieldOrLeavesSourceTriggeredAbility ability) { super(ability); } @Override - public EntersOrLeavesTheBattlefieldSourceTriggeredAbility copy() { - return new EntersOrLeavesTheBattlefieldSourceTriggeredAbility(this); + public EntersBattlefieldOrLeavesSourceTriggeredAbility copy() { + return new EntersBattlefieldOrLeavesSourceTriggeredAbility(this); } @Override