From a609d044ece98bb03921b99ca010283e3762064e Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 14 Nov 2024 11:27:55 -0500 Subject: [PATCH] [J25] Implement Slinza, the Spiked Stampede --- .../src/mage/cards/a/ArlinnThePacksHope.java | 53 ++--------- .../src/mage/cards/b/BramblewoodParagon.java | 76 ++++----------- .../src/mage/cards/c/CombineGuildmage.java | 49 ++-------- .../src/mage/cards/d/DearlyDeparted.java | 64 +++---------- .../mage/cards/g/GrumgullyTheGenerous.java | 66 ++++--------- Mage.Sets/src/mage/cards/o/OathOfGideon.java | 62 +++---------- .../src/mage/cards/o/OonasBlackguard.java | 66 +++---------- .../mage/cards/r/RenataCalledToTheHunt.java | 57 ++---------- Mage.Sets/src/mage/cards/s/SageOfFables.java | 64 +++---------- .../mage/cards/s/SlinzaTheSpikedStampede.java | 73 +++++++++++++++ .../src/mage/cards/t/TayamLuminousEnigma.java | 60 ++---------- .../src/mage/cards/v/VampireSocialite.java | 68 +++----------- .../src/mage/cards/z/ZameckGuildmage.java | 60 +++--------- .../src/mage/sets/FoundationsJumpstart.java | 1 + .../EntersWithCountersControlledEffect.java | 93 +++++++++++++++++++ 15 files changed, 308 insertions(+), 604 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SlinzaTheSpikedStampede.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/EntersWithCountersControlledEffect.java diff --git a/Mage.Sets/src/mage/cards/a/ArlinnThePacksHope.java b/Mage.Sets/src/mage/cards/a/ArlinnThePacksHope.java index 4e9751d96fd..8b7f38f9330 100644 --- a/Mage.Sets/src/mage/cards/a/ArlinnThePacksHope.java +++ b/Mage.Sets/src/mage/cards/a/ArlinnThePacksHope.java @@ -2,20 +2,20 @@ package mage.cards.a; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashAllEffect; import mage.abilities.keyword.DayboundAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; import mage.counters.CounterType; import mage.filter.FilterCard; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreatureCard; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; import mage.game.permanent.token.WolfToken; import java.util.UUID; @@ -42,7 +42,9 @@ public final class ArlinnThePacksHope extends CardImpl { Ability ability = new LoyaltyAbility(new CastAsThoughItHadFlashAllEffect( Duration.UntilYourNextTurn, filter ).setText("until your next turn, you may cast creature spells as though they had flash"), 1); - ability.addEffect(new ArlinnThePacksHopeEffect()); + ability.addEffect(new EntersWithCountersControlledEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, CounterType.P1P1.createInstance(), false + )); this.addAbility(ability); // −3: Create two 2/2 green Wolf creature tokens. @@ -58,40 +60,3 @@ public final class ArlinnThePacksHope extends CardImpl { return new ArlinnThePacksHope(this); } } - -class ArlinnThePacksHopeEffect extends ReplacementEffectImpl { - - ArlinnThePacksHopeEffect() { - super(Duration.UntilYourNextTurn, Outcome.BoostCreature); - this.staticText = ", and each creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private ArlinnThePacksHopeEffect(ArlinnThePacksHopeEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - return permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.isCreature(game); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); - if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public ArlinnThePacksHopeEffect copy() { - return new ArlinnThePacksHopeEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java b/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java index 45a20d1cfb9..6e4c41e9b78 100644 --- a/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java +++ b/Mage.Sets/src/mage/cards/b/BramblewoodParagon.java @@ -1,29 +1,29 @@ - package mage.cards.b; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; import mage.counters.CounterType; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.common.FilterCreaturePermanent; + +import java.util.UUID; /** - * * @author emerald000 */ public final class BramblewoodParagon extends CardImpl { + private static final FilterPermanent filter = new FilterCreaturePermanent(SubType.WARRIOR, "Warrior creature"); + public BramblewoodParagon(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); this.subtype.add(SubType.ELF, SubType.WARRIOR); @@ -31,17 +31,15 @@ public final class BramblewoodParagon extends CardImpl { this.toughness = new MageInt(2); // Each other Warrior creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BramblewoodParagonReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + filter, CounterType.P1P1.createInstance(), true + ))); // Each creature you control with a +1/+1 counter on it has trample. - this.addAbility(new SimpleStaticAbility( - Zone.BATTLEFIELD, - new GainAbilityAllEffect( - TrampleAbility.getInstance(), - Duration.WhileOnBattlefield, - StaticFilters.FILTER_EACH_CONTROLLED_CREATURE_P1P1) - ) - ); + this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect( + TrampleAbility.getInstance(), Duration.WhileOnBattlefield, + StaticFilters.FILTER_EACH_CONTROLLED_CREATURE_P1P1 + ))); } @@ -54,43 +52,3 @@ public final class BramblewoodParagon extends CardImpl { return new BramblewoodParagon(this); } } - -class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl { - - BramblewoodParagonReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - staticText = "Each other Warrior creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private BramblewoodParagonReplacementEffect(final BramblewoodParagonReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - return creature != null && creature.isControlledBy(source.getControllerId()) - && creature.isCreature(game) - && creature.hasSubtype(SubType.WARRIOR, game) - && !event.getTargetId().equals(source.getSourceId()); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public BramblewoodParagonReplacementEffect copy() { - return new BramblewoodParagonReplacementEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/c/CombineGuildmage.java b/Mage.Sets/src/mage/cards/c/CombineGuildmage.java index fd84d5667a5..9353935c98a 100644 --- a/Mage.Sets/src/mage/cards/c/CombineGuildmage.java +++ b/Mage.Sets/src/mage/cards/c/CombineGuildmage.java @@ -6,7 +6,7 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -15,10 +15,9 @@ import mage.constants.Outcome; import mage.constants.SubType; import mage.counters.CounterType; import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; @@ -43,9 +42,10 @@ public final class CombineGuildmage extends CardImpl { this.toughness = new MageInt(2); // {1}{G}, {T}: This turn, each creature you control enters the battlefield with an additional +1/+1 counter on it. - Ability ability = new SimpleActivatedAbility( - new CombineGuildmageReplacementEffect(), new ManaCostsImpl<>("{1}{G}") - ); + Ability ability = new SimpleActivatedAbility(new EntersWithCountersControlledEffect( + Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE, + CounterType.P1P1.createInstance(), false + ), new ManaCostsImpl<>("{1}{G}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); @@ -69,43 +69,6 @@ public final class CombineGuildmage extends CardImpl { } } -class CombineGuildmageReplacementEffect extends ReplacementEffectImpl { - - CombineGuildmageReplacementEffect() { - super(Duration.EndOfTurn, Outcome.BoostCreature); - this.staticText = "This turn, each creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private CombineGuildmageReplacementEffect(CombineGuildmageReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - return permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.isCreature(game); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); - if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public CombineGuildmageReplacementEffect copy() { - return new CombineGuildmageReplacementEffect(this); - } -} - class CombineGuildmageCounterEffect extends OneShotEffect { CombineGuildmageCounterEffect() { diff --git a/Mage.Sets/src/mage/cards/d/DearlyDeparted.java b/Mage.Sets/src/mage/cards/d/DearlyDeparted.java index bf1480b985e..4b93cb95e1f 100644 --- a/Mage.Sets/src/mage/cards/d/DearlyDeparted.java +++ b/Mage.Sets/src/mage/cards/d/DearlyDeparted.java @@ -1,26 +1,27 @@ - package mage.cards.d; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; + +import java.util.UUID; /** * @author nantuko */ public final class DearlyDeparted extends CardImpl { + private static final FilterPermanent filter = new FilterCreaturePermanent(SubType.HUMAN, "Human creature"); + public DearlyDeparted(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); this.subtype.add(SubType.SPIRIT); @@ -31,7 +32,9 @@ public final class DearlyDeparted extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // As long as Dearly Departed is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, new DearlyDepartedEntersBattlefieldEffect())); + this.addAbility(new SimpleStaticAbility(Zone.GRAVEYARD, new EntersWithCountersControlledEffect( + filter, CounterType.P1P1.createInstance(), false + ).setText("as long as {this} is in your graveyard, each Human creature you control enters with an additional +1/+1 counter on it"))); } private DearlyDeparted(final DearlyDeparted card) { @@ -43,44 +46,3 @@ public final class DearlyDeparted extends CardImpl { return new DearlyDeparted(this); } } - -class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl { - - DearlyDepartedEntersBattlefieldEffect() { - super(Duration.WhileInGraveyard, Outcome.BoostCreature); - staticText = "As long as {this} is in your graveyard, each Human creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private DearlyDepartedEntersBattlefieldEffect(final DearlyDepartedEntersBattlefieldEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - if (permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.hasSubtype(SubType.HUMAN, game)) { - return true; - } - return false; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); - if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public DearlyDepartedEntersBattlefieldEffect copy() { - return new DearlyDepartedEntersBattlefieldEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/g/GrumgullyTheGenerous.java b/Mage.Sets/src/mage/cards/g/GrumgullyTheGenerous.java index 62147aa2e65..7bed6118f73 100644 --- a/Mage.Sets/src/mage/cards/g/GrumgullyTheGenerous.java +++ b/Mage.Sets/src/mage/cards/g/GrumgullyTheGenerous.java @@ -1,17 +1,17 @@ package mage.cards.g; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; import java.util.UUID; @@ -20,6 +20,12 @@ import java.util.UUID; */ public final class GrumgullyTheGenerous extends CardImpl { + private static final FilterPermanent filter = new FilterCreaturePermanent("non-Human creature"); + + static { + filter.add(Predicates.not(SubType.HUMAN.getPredicate())); + } + public GrumgullyTheGenerous(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{G}"); @@ -30,7 +36,9 @@ public final class GrumgullyTheGenerous extends CardImpl { this.toughness = new MageInt(3); // Each other non-Human creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(new GrumgullyTheGenerousReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + filter, CounterType.P1P1.createInstance(), true + ))); } private GrumgullyTheGenerous(final GrumgullyTheGenerous card) { @@ -42,45 +50,3 @@ public final class GrumgullyTheGenerous extends CardImpl { return new GrumgullyTheGenerous(this); } } - -class GrumgullyTheGenerousReplacementEffect extends ReplacementEffectImpl { - - GrumgullyTheGenerousReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - staticText = "Each other non-Human creature you control " + - "enters the battlefield with an additional +1/+1 counter on it."; - } - - private GrumgullyTheGenerousReplacementEffect(final GrumgullyTheGenerousReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - return creature != null - && creature.isCreature(game) - && !source.getSourceId().equals(creature.getId()) - && creature.isControlledBy(source.getControllerId()) - && !creature.hasSubtype(SubType.HUMAN, game); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public GrumgullyTheGenerousReplacementEffect copy() { - return new GrumgullyTheGenerousReplacementEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/o/OathOfGideon.java b/Mage.Sets/src/mage/cards/o/OathOfGideon.java index 01089034b48..2eb9ed36b13 100644 --- a/Mage.Sets/src/mage/cards/o/OathOfGideon.java +++ b/Mage.Sets/src/mage/cards/o/OathOfGideon.java @@ -1,37 +1,36 @@ - package mage.cards.o; -import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SuperType; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.StaticFilters; import mage.game.permanent.token.KorAllyToken; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class OathOfGideon extends CardImpl { public OathOfGideon(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); this.supertype.add(SuperType.LEGENDARY); // When Oath of Gideon enters the battlefield, create two 1/1 Kor Ally creature tokens. this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KorAllyToken(), 2), false)); // Each planeswalker you control enters the battlefield with an additional loyalty counter on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OathOfGideonReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + StaticFilters.FILTER_PERMANENT_PLANESWALKER, + CounterType.LOYALTY.createInstance(), false + ))); } private OathOfGideon(final OathOfGideon card) { @@ -43,42 +42,3 @@ public final class OathOfGideon extends CardImpl { return new OathOfGideon(this); } } - -class OathOfGideonReplacementEffect extends ReplacementEffectImpl { - - OathOfGideonReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "Each planeswalker you control enters the battlefield with an additional loyalty counter on it"; - } - - private OathOfGideonReplacementEffect(final OathOfGideonReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - return creature != null && creature.isControlledBy(source.getControllerId()) - && creature.isPlaneswalker(game) - && !event.getTargetId().equals(source.getSourceId()); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.LOYALTY.createInstance(), source.getControllerId(), source, game); - } - return false; - } - - @Override - public OathOfGideonReplacementEffect copy() { - return new OathOfGideonReplacementEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/o/OonasBlackguard.java b/Mage.Sets/src/mage/cards/o/OonasBlackguard.java index 025988a77a6..9508d7de58e 100644 --- a/Mage.Sets/src/mage/cards/o/OonasBlackguard.java +++ b/Mage.Sets/src/mage/cards/o/OonasBlackguard.java @@ -1,32 +1,36 @@ package mage.cards.o; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.DamagedPlayerEvent; -import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author fireshoes */ public final class OonasBlackguard extends CardImpl { + private static final FilterPermanent filter = new FilterCreaturePermanent(SubType.ROGUE, "Rogue creature"); + public OonasBlackguard(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); this.subtype.add(SubType.FAERIE); @@ -36,12 +40,14 @@ public final class OonasBlackguard extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); + // Each other Rogue creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OonasBlackguardReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + filter, CounterType.P1P1.createInstance(), true + ))); // Whenever a creature you control with a +1/+1 counter on it deals combat damage to a player, that player discards a card. this.addAbility(new OonasBlackguardTriggeredAbility()); - } private OonasBlackguard(final OonasBlackguard card) { @@ -54,49 +60,6 @@ public final class OonasBlackguard extends CardImpl { } } -class OonasBlackguardReplacementEffect extends ReplacementEffectImpl { - - OonasBlackguardReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - staticText = "Each other Rogue creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private OonasBlackguardReplacementEffect(final OonasBlackguardReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null && creature.isControlledBy(source.getControllerId()) - && creature.isCreature(game) - && creature.hasSubtype(SubType.ROGUE, game) - && !event.getTargetId().equals(source.getSourceId())) { - return true; - } - return false; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public OonasBlackguardReplacementEffect copy() { - return new OonasBlackguardReplacementEffect(this); - } -} - class OonasBlackguardTriggeredAbility extends TriggeredAbilityImpl { public OonasBlackguardTriggeredAbility() { @@ -135,5 +98,4 @@ class OonasBlackguardTriggeredAbility extends TriggeredAbilityImpl { public String getRule() { return "Whenever a creature you control with a +1/+1 counter on it deals combat damage to a player, that player discards a card."; } - } diff --git a/Mage.Sets/src/mage/cards/r/RenataCalledToTheHunt.java b/Mage.Sets/src/mage/cards/r/RenataCalledToTheHunt.java index 54e575a7f8a..679d7859a8e 100644 --- a/Mage.Sets/src/mage/cards/r/RenataCalledToTheHunt.java +++ b/Mage.Sets/src/mage/cards/r/RenataCalledToTheHunt.java @@ -1,19 +1,18 @@ package mage.cards.r; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.common.DevotionCount; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.effects.common.continuous.SetBasePowerSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.StaticFilters; import java.util.UUID; @@ -38,7 +37,9 @@ public final class RenataCalledToTheHunt extends CardImpl { ).addHint(DevotionCount.G.getHint())); // Each other creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(new RenataCalledToTheHuntReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, CounterType.P1P1.createInstance(), true + ))); } private RenataCalledToTheHunt(final RenataCalledToTheHunt card) { @@ -50,43 +51,3 @@ public final class RenataCalledToTheHunt extends CardImpl { return new RenataCalledToTheHunt(this); } } - -class RenataCalledToTheHuntReplacementEffect extends ReplacementEffectImpl { - - RenataCalledToTheHuntReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - staticText = "Each other creature you control enters the battlefield with an additional +1/+1 counter on it."; - } - - private RenataCalledToTheHuntReplacementEffect(final RenataCalledToTheHuntReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - return creature != null - && creature.isCreature(game) - && !source.getSourceId().equals(creature.getId()) - && creature.isControlledBy(source.getControllerId()); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public RenataCalledToTheHuntReplacementEffect copy() { - return new RenataCalledToTheHuntReplacementEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/s/SageOfFables.java b/Mage.Sets/src/mage/cards/s/SageOfFables.java index 994e709e003..7e8f05239ec 100644 --- a/Mage.Sets/src/mage/cards/s/SageOfFables.java +++ b/Mage.Sets/src/mage/cards/s/SageOfFables.java @@ -1,31 +1,31 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.RemoveCounterCost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SubType; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class SageOfFables extends CardImpl { + private static final FilterPermanent filter = new FilterCreaturePermanent(SubType.WIZARD, "Wizard creature"); + public SageOfFables(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.subtype.add(SubType.MERFOLK); @@ -34,10 +34,12 @@ public final class SageOfFables extends CardImpl { this.toughness = new MageInt(2); // Each other Wizard creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SageOfFablesReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + filter, CounterType.P1P1.createInstance(), true + ))); // {2}, Remove a +1/+1 counter from a creature you control: Draw a card. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(2)); + Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new GenericManaCost(2)); ability.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(), CounterType.P1P1)); this.addAbility(ability); } @@ -51,43 +53,3 @@ public final class SageOfFables extends CardImpl { return new SageOfFables(this); } } - -class SageOfFablesReplacementEffect extends ReplacementEffectImpl { - - SageOfFablesReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - staticText = "Each other Wizard creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private SageOfFablesReplacementEffect(final SageOfFablesReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - return creature != null && creature.isControlledBy(source.getControllerId()) - && creature.isCreature(game) - && creature.hasSubtype(SubType.WIZARD, game) - && !event.getTargetId().equals(source.getSourceId()); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public SageOfFablesReplacementEffect copy() { - return new SageOfFablesReplacementEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/s/SlinzaTheSpikedStampede.java b/Mage.Sets/src/mage/cards/s/SlinzaTheSpikedStampede.java new file mode 100644 index 00000000000..871e1e1ef12 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SlinzaTheSpikedStampede.java @@ -0,0 +1,73 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DoWhenCostPaid; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; +import mage.abilities.effects.common.FightTargetSourceEffect; +import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SlinzaTheSpikedStampede extends CardImpl { + + private static final FilterCard filter = new FilterCard("Beast spells"); + private static final FilterPermanent filter2 = new FilterCreaturePermanent(SubType.BEAST, "Beast creature"); + private static final FilterPermanent filter3 = new FilterCreaturePermanent("creature with power 4 or greater"); + + static { + filter3.add(new PowerPredicate(ComparisonType.MORE_THAN, 3)); + } + + public SlinzaTheSpikedStampede(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.BEAST); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Beast spells you cast cost {2} less to cast. + this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 2))); + + // Each other Beast creature you control enters with an additional +1/+1 counter on it. + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + filter2, CounterType.P1P1.createInstance(), true + ))); + + // Whenever Slinza or another creature with power 4 or greater enters, you may pay {1}{R/G}. When you do, Slinza fights target creature you don't control. + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new FightTargetSourceEffect(), false); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); + this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new DoWhenCostPaid( + ability, new ManaCostsImpl<>("{1}{R/G}"), "Pay {1}{R/G}?" + ), filter3, false, false)); + } + + private SlinzaTheSpikedStampede(final SlinzaTheSpikedStampede card) { + super(card); + } + + @Override + public SlinzaTheSpikedStampede copy() { + return new SlinzaTheSpikedStampede(this); + } +} diff --git a/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java b/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java index 51da06480e4..177141e5766 100644 --- a/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java +++ b/Mage.Sets/src/mage/cards/t/TayamLuminousEnigma.java @@ -8,7 +8,7 @@ import mage.abilities.costs.Cost; import mage.abilities.costs.common.RemoveCounterCost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.effects.common.MillCardsControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -18,20 +18,18 @@ import mage.constants.*; import mage.counters.Counter; import mage.counters.CounterType; import mage.filter.FilterCard; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterPermanentCard; import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.permanent.CounterAnyPredicate; import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetCard; import mage.target.TargetPermanent; import mage.target.common.TargetCardInYourGraveyard; -import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Set; import java.util.UUID; @@ -51,15 +49,17 @@ public final class TayamLuminousEnigma extends CardImpl { this.toughness = new MageInt(3); // Each other creature you control enters the battlefield with an additional vigilance counter on it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TayamLuminousEnigmaReplacementEffect())); + this.addAbility(new SimpleStaticAbility(new EntersWithCountersControlledEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, + CounterType.VIGILANCE.createInstance(), true + ))); // {3}, Remove three counters from among creatures you control: Put the top three cards of your library into your graveyard, then return a permanent card with converted mana cost 3 or less from your graveyard to the battlefield. - MillCardsControllerEffect millEffect = new MillCardsControllerEffect(3); - millEffect.concatBy("."); - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, millEffect, new GenericManaCost(3)); + Ability ability = new SimpleActivatedAbility( + new MillCardsControllerEffect(3).concatBy("."), new GenericManaCost(3) + ); ability.addCost(new TayamLuminousEnigmaCost()); - TayamLuminousEnigmaEffect effect = new TayamLuminousEnigmaEffect(); - ability.addEffect(effect); + ability.addEffect(new TayamLuminousEnigmaEffect()); this.addAbility(ability); } @@ -192,43 +192,3 @@ class TayamLuminousEnigmaEffect extends OneShotEffect { return player.moveCards(game.getCard(target.getFirstTarget()), Zone.BATTLEFIELD, source, game); } } - -class TayamLuminousEnigmaReplacementEffect extends ReplacementEffectImpl { - - TayamLuminousEnigmaReplacementEffect() { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - staticText = "Each other creature you control enters the battlefield with an additional vigilance counter on it."; - } - - private TayamLuminousEnigmaReplacementEffect(final TayamLuminousEnigmaReplacementEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - return creature != null - && creature.isCreature(game) - && !source.getSourceId().equals(creature.getId()) - && creature.isControlledBy(source.getControllerId()); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); - if (creature != null) { - creature.addCounters(CounterType.VIGILANCE.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public TayamLuminousEnigmaReplacementEffect copy() { - return new TayamLuminousEnigmaReplacementEffect(this); - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/v/VampireSocialite.java b/Mage.Sets/src/mage/cards/v/VampireSocialite.java index afa69d6fdb9..f3d3f1a725e 100644 --- a/Mage.Sets/src/mage/cards/v/VampireSocialite.java +++ b/Mage.Sets/src/mage/cards/v/VampireSocialite.java @@ -1,32 +1,25 @@ package mage.cards.v; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.OpponentsLostLifeCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.decorator.ConditionalReplacementEffect; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.abilities.effects.common.counter.AddCountersAllEffect; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubType; import mage.abilities.keyword.MenaceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.counters.CounterType; -import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class VampireSocialite extends CardImpl { @@ -57,7 +50,12 @@ public final class VampireSocialite extends CardImpl { )); // As long as an opponent lost life this turn, each other Vampire you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleStaticAbility(new VampireSocialiteReplacementEffect(filter))); + this.addAbility(new SimpleStaticAbility(new ConditionalReplacementEffect( + new EntersWithCountersControlledEffect( + filter, CounterType.P1P1.createInstance(), true + ), OpponentsLostLifeCondition.instance + ).setText("as long as an opponent lost life this turn, " + + "each other Vampire you control enters the battlefield with an additional +1/+1 counter on it"))); } private VampireSocialite(final VampireSocialite card) { @@ -69,47 +67,3 @@ public final class VampireSocialite extends CardImpl { return new VampireSocialite(this); } } - -class VampireSocialiteReplacementEffect extends ReplacementEffectImpl { - - private final FilterPermanent filter; - - public VampireSocialiteReplacementEffect(FilterPermanent filter) { - super(Duration.WhileOnBattlefield, Outcome.BoostCreature); - this.filter = filter; - staticText = "As long as an opponent lost life this turn, each other Vampire you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private VampireSocialiteReplacementEffect(final VampireSocialiteReplacementEffect effect) { - super(effect); - this.filter = effect.filter; - } - - @Override - public VampireSocialiteReplacementEffect copy() { - return new VampireSocialiteReplacementEffect(this); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (OpponentsLostLifeCondition.instance.apply(game, source)) { - Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - return permanent != null && filter.match(permanent, source.getControllerId(), source, game); - } - return false; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java b/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java index 83d318edd1e..b630fdaba3a 100644 --- a/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java +++ b/Mage.Sets/src/mage/cards/z/ZameckGuildmage.java @@ -1,26 +1,24 @@ - package mage.cards.z; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveCounterCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.EntersWithCountersControlledEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.events.EntersTheBattlefieldEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class ZameckGuildmage extends CardImpl { @@ -32,10 +30,13 @@ public final class ZameckGuildmage extends CardImpl { this.toughness = new MageInt(2); // {G}{U}: This turn, each creature you control enters the battlefield with an additional +1/+1 counter on it. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ZameckGuildmageEntersBattlefieldEffect(), new ManaCostsImpl<>("{G}{U}"))); + this.addAbility(new SimpleActivatedAbility(new EntersWithCountersControlledEffect( + Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE, + CounterType.P1P1.createInstance(), false + ), new ManaCostsImpl<>("{G}{U}"))); // {G}{U}, Remove a +1/+1 counter from a creature you control: Draw a card. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl<>("{G}{U}")); + Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new ManaCostsImpl<>("{G}{U}")); ability.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(), CounterType.P1P1)); this.addAbility(ability); } @@ -49,40 +50,3 @@ public final class ZameckGuildmage extends CardImpl { return new ZameckGuildmage(this); } } - -class ZameckGuildmageEntersBattlefieldEffect extends ReplacementEffectImpl { - - ZameckGuildmageEntersBattlefieldEffect() { - super(Duration.EndOfTurn, Outcome.BoostCreature); - this.staticText = "This turn, each creature you control enters the battlefield with an additional +1/+1 counter on it"; - } - - private ZameckGuildmageEntersBattlefieldEffect(final ZameckGuildmageEntersBattlefieldEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); - return permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.isCreature(game); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent target = ((EntersTheBattlefieldEvent) event).getTarget(); - if (target != null) { - target.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects()); - } - return false; - } - - @Override - public ZameckGuildmageEntersBattlefieldEffect copy() { - return new ZameckGuildmageEntersBattlefieldEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/FoundationsJumpstart.java b/Mage.Sets/src/mage/sets/FoundationsJumpstart.java index 97349715655..70ec47aaa7a 100644 --- a/Mage.Sets/src/mage/sets/FoundationsJumpstart.java +++ b/Mage.Sets/src/mage/sets/FoundationsJumpstart.java @@ -613,6 +613,7 @@ public final class FoundationsJumpstart extends ExpansionSet { cards.add(new SetCardInfo("Skymarch Bloodletter", 125, Rarity.COMMON, mage.cards.s.SkymarchBloodletter.class)); cards.add(new SetCardInfo("Slimebind", 360, Rarity.COMMON, mage.cards.s.Slimebind.class)); cards.add(new SetCardInfo("Slimy Piper", 25, Rarity.COMMON, mage.cards.s.SlimyPiper.class)); + cards.add(new SetCardInfo("Slinza, the Spiked Stampede", 55, Rarity.RARE, mage.cards.s.SlinzaTheSpikedStampede.class)); cards.add(new SetCardInfo("Smoke Shroud", 361, Rarity.COMMON, mage.cards.s.SmokeShroud.class)); cards.add(new SetCardInfo("Snakeskin Veil", 713, Rarity.COMMON, mage.cards.s.SnakeskinVeil.class)); cards.add(new SetCardInfo("Snapping Gnarlid", 714, Rarity.COMMON, mage.cards.s.SnappingGnarlid.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/EntersWithCountersControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EntersWithCountersControlledEffect.java new file mode 100644 index 00000000000..28cf8362ed6 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/EntersWithCountersControlledEffect.java @@ -0,0 +1,93 @@ +package mage.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.counters.Counter; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.util.CardUtil; + +/** + * @author TheElk801 + */ +public class EntersWithCountersControlledEffect extends ReplacementEffectImpl { + + private final FilterPermanent filter; + private final Counter counter; + private final boolean excludeSource; + + public EntersWithCountersControlledEffect(FilterPermanent filter, Counter counter, boolean excludeSource) { + this(Duration.WhileOnBattlefield, filter, counter, excludeSource); + } + + public EntersWithCountersControlledEffect(Duration duration, FilterPermanent filter, Counter counter, boolean excludeSource) { + super(duration, Outcome.BoostCreature); + this.filter = filter; + this.counter = counter; + this.excludeSource = excludeSource; + staticText = makeText(); + } + + private EntersWithCountersControlledEffect(final EntersWithCountersControlledEffect effect) { + super(effect); + this.filter = effect.filter.copy(); + this.counter = effect.counter.copy(); + this.excludeSource = effect.excludeSource; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (excludeSource && event.getTargetId().equals(source.getSourceId())) { + return false; + } + Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); + return permanent != null + && permanent.isControlledBy(source.getControllerId()) + && filter.match(permanent, source.getControllerId(), source, game); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); + if (creature != null) { + creature.addCounters(counter, source.getControllerId(), source, game, event.getAppliedEffects()); + } + return false; + } + + private String makeText() { + StringBuilder sb = new StringBuilder(); + if (duration == Duration.EndOfTurn) { + sb.append("this turn, "); + } + sb.append("each "); + if (excludeSource) { + sb.append("other "); + } + sb.append(filter.getMessage()); + sb.append(" you control enters with "); + sb.append(CardUtil.numberToText(counter.getCount(), "an")); + sb.append(" additional "); + sb.append(counter.getName()); + if (counter.getCount() > 1) { + sb.append('s'); + } + sb.append(" on it"); + return sb.toString(); + } + + @Override + public EntersWithCountersControlledEffect copy() { + return new EntersWithCountersControlledEffect(this); + } +}