diff --git a/Mage.Sets/src/mage/cards/d/DragonsguardElite.java b/Mage.Sets/src/mage/cards/d/DragonsguardElite.java new file mode 100644 index 0000000000..9b5e2d5d4f --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DragonsguardElite.java @@ -0,0 +1,45 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.common.MagecraftAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DoubleP1P1CountersSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.counters.CounterType; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DragonsguardElite extends CardImpl { + + public DragonsguardElite(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.DRUID); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Magecraft — Whenever you cast or copy an instant or sorcery spell, put a +1/+1 counter on Dragonsguard Elite. + this.addAbility(new MagecraftAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()))); + + // {4}{G}{G}: Double the number of +1/+1 counters on Dragonsguard Elite. + this.addAbility(new SimpleActivatedAbility(new DoubleP1P1CountersSourceEffect(), new ManaCostsImpl<>("{4}{G}{G}"))); + } + + private DragonsguardElite(final DragonsguardElite card) { + super(card); + } + + @Override + public DragonsguardElite copy() { + return new DragonsguardElite(this); + } +} diff --git a/Mage.Sets/src/mage/cards/p/PrimordialHydra.java b/Mage.Sets/src/mage/cards/p/PrimordialHydra.java index 722b81ec22..0a3b070f73 100644 --- a/Mage.Sets/src/mage/cards/p/PrimordialHydra.java +++ b/Mage.Sets/src/mage/cards/p/PrimordialHydra.java @@ -1,15 +1,13 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; import mage.abilities.condition.common.SourceHasCounterCondition; import mage.abilities.decorator.ConditionalContinuousEffect; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoubleP1P1CountersSourceEffect; import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.keyword.TrampleAbility; @@ -17,19 +15,17 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Outcome; import mage.constants.TargetController; -import mage.constants.Zone; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; + +import java.util.UUID; /** - * * @author Loki */ public final class PrimordialHydra extends CardImpl { + private static final Condition condition = new SourceHasCounterCondition(CounterType.P1P1, 10, Integer.MAX_VALUE); private static final String staticText = "{this} has trample as long as it has ten or more +1/+1 counters on it"; public PrimordialHydra(UUID ownerId, CardSetInfo setInfo) { @@ -44,12 +40,14 @@ public final class PrimordialHydra extends CardImpl { this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.P1P1.createInstance()))); // At the beginning of your upkeep, double the number of +1/+1 counters on Primordial Hydra. - this.addAbility(new BeginningOfUpkeepTriggeredAbility(new PrimordialHydraDoubleEffect(), TargetController.YOU, false)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + new DoubleP1P1CountersSourceEffect(), TargetController.YOU, false + )); // Primordial Hydra has trample as long as it has ten or more +1/+1 counters on it. - ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance()), new SourceHasCounterCondition(CounterType.P1P1, 10, Integer.MAX_VALUE), staticText); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); - + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new GainAbilitySourceEffect(TrampleAbility.getInstance()), condition, staticText + ))); } private PrimordialHydra(final PrimordialHydra card) { @@ -61,33 +59,3 @@ public final class PrimordialHydra extends CardImpl { return new PrimordialHydra(this); } } - -class PrimordialHydraDoubleEffect extends OneShotEffect { - - PrimordialHydraDoubleEffect() { - super(Outcome.BoostCreature); - staticText = "double the number of +1/+1 counters on {this}"; - } - - PrimordialHydraDoubleEffect(final PrimordialHydraDoubleEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (sourcePermanent != null) { - int amount = sourcePermanent.getCounters(game).getCount(CounterType.P1P1); - if (amount > 0) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(amount), source.getControllerId(), source, game); - } - return true; - } - return false; - } - - @Override - public PrimordialHydraDoubleEffect copy() { - return new PrimordialHydraDoubleEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/s/Solarion.java b/Mage.Sets/src/mage/cards/s/Solarion.java index 7c169d7531..bb37de92fb 100644 --- a/Mage.Sets/src/mage/cards/s/Solarion.java +++ b/Mage.Sets/src/mage/cards/s/Solarion.java @@ -1,39 +1,33 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.dynamicvalue.common.CountersSourceCount; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.DoubleP1P1CountersSourceEffect; import mage.abilities.keyword.SunburstAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.counters.CounterType; + +import java.util.UUID; /** - * * @author Plopman */ public final class Solarion extends CardImpl { public Solarion(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{7}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{7}"); this.subtype.add(SubType.CONSTRUCT); this.power = new MageInt(0); this.toughness = new MageInt(0); // Sunburst this.addAbility(new SunburstAbility(this)); + // {tap}: Double the number of +1/+1 counters on Solarion. - Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance(1), new CountersSourceCount(CounterType.P1P1), true); - effect.setText("Double the number of +1/+1 counters on {this}"); - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost())); + this.addAbility(new SimpleActivatedAbility(new DoubleP1P1CountersSourceEffect(), new TapSourceCost())); } private Solarion(final Solarion card) { diff --git a/Mage.Sets/src/mage/cards/v/VoraciousHydra.java b/Mage.Sets/src/mage/cards/v/VoraciousHydra.java index 088ba3cb43..dcbc7e72d1 100644 --- a/Mage.Sets/src/mage/cards/v/VoraciousHydra.java +++ b/Mage.Sets/src/mage/cards/v/VoraciousHydra.java @@ -5,19 +5,16 @@ import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DoubleP1P1CountersSourceEffect; import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; import mage.abilities.effects.common.FightTargetSourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.SubType; import mage.counters.CounterType; import mage.filter.StaticFilters; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import java.util.UUID; @@ -44,7 +41,7 @@ public final class VoraciousHydra extends CardImpl { // When Voracious Hydra enters the battlefield, choose one — // • Double the number of +1/+1 counters on Voracious Hydra. - Ability ability = new EntersBattlefieldTriggeredAbility(new VoraciousHydraEffect(), false); + Ability ability = new EntersBattlefieldTriggeredAbility(new DoubleP1P1CountersSourceEffect(), false); // • Voracious Hydra fights target creature you don't control. Mode mode = new Mode( @@ -65,31 +62,3 @@ public final class VoraciousHydra extends CardImpl { return new VoraciousHydra(this); } } - -class VoraciousHydraEffect extends OneShotEffect { - - VoraciousHydraEffect() { - super(Outcome.Benefit); - staticText = "Double the number of +1/+1 counters on {this}"; - } - - private VoraciousHydraEffect(final VoraciousHydraEffect effect) { - super(effect); - } - - @Override - public VoraciousHydraEffect copy() { - return new VoraciousHydraEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent == null) { - return false; - } - return permanent.addCounters(CounterType.P1P1.createInstance( - permanent.getCounters(game).getCount(CounterType.P1P1) - ), source.getControllerId(), source, game); - } -} diff --git a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java index 5b9c175083..734dbfdd49 100644 --- a/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java +++ b/Mage.Sets/src/mage/sets/StrixhavenSchoolOfMages.java @@ -28,6 +28,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet { this.maxCardNumberInBooster = 275; cards.add(new SetCardInfo("Archmage Emeritus", 37, Rarity.RARE, mage.cards.a.ArchmageEmeritus.class)); + cards.add(new SetCardInfo("Dragonsguard Elite", 127, Rarity.RARE, mage.cards.d.DragonsguardElite.class)); cards.add(new SetCardInfo("Eager First-Year", 16, Rarity.COMMON, mage.cards.e.EagerFirstYear.class)); cards.add(new SetCardInfo("Frostboil Snarl", 265, Rarity.RARE, mage.cards.f.FrostboilSnarl.class)); cards.add(new SetCardInfo("Furycalm Snarl", 266, Rarity.RARE, mage.cards.f.FurycalmSnarl.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoubleP1P1CountersSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoubleP1P1CountersSourceEffect.java new file mode 100644 index 0000000000..4216532bcd --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/DoubleP1P1CountersSourceEffect.java @@ -0,0 +1,39 @@ +package mage.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * @author TheElk801 + */ +public class DoubleP1P1CountersSourceEffect extends OneShotEffect { + + public DoubleP1P1CountersSourceEffect() { + super(Outcome.Benefit); + staticText = "double the number of +1/+1 counters on {this}"; + } + + private DoubleP1P1CountersSourceEffect(final DoubleP1P1CountersSourceEffect effect) { + super(effect); + } + + @Override + public DoubleP1P1CountersSourceEffect copy() { + return new DoubleP1P1CountersSourceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (permanent == null) { + return false; + } + return permanent.addCounters(CounterType.P1P1.createInstance( + permanent.getCounters(game).getCount(CounterType.P1P1) + ), source.getControllerId(), source, game); + } +}