From 82c34d81172bdd64074314e1186e5fe3ef8a78d1 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 3 Jan 2019 13:39:35 -0500 Subject: [PATCH] Implemented Spawn of Mayhem --- Mage.Sets/src/mage/cards/s/SpawnOfMayhem.java | 94 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SpawnOfMayhem.java diff --git a/Mage.Sets/src/mage/cards/s/SpawnOfMayhem.java b/Mage.Sets/src/mage/cards/s/SpawnOfMayhem.java new file mode 100644 index 0000000000..3e0215662e --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SpawnOfMayhem.java @@ -0,0 +1,94 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.SpectacleAbility; +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.constants.TargetController; +import mage.counters.CounterType; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SpawnOfMayhem extends CardImpl { + + public SpawnOfMayhem(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}"); + + this.subtype.add(SubType.DEMON); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Spectacle {1}{B}{B} + this.addAbility(new SpectacleAbility(this, new ManaCostsImpl("{1}{B}{B}"))); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // At the beginning of your upkeep, Spawn of Mayhem deals 1 damage to each player. Then if you have 10 or less life, put a +1/+1 counter on Spawn of Mayhem. + Ability ability = new BeginningOfUpkeepTriggeredAbility( + new DamagePlayersEffect(1, TargetController.ANY), + TargetController.YOU, false + ); + ability.addEffect(new SpawnOfMayhemEffect()); + this.addAbility(ability); + } + + private SpawnOfMayhem(final SpawnOfMayhem card) { + super(card); + } + + @Override + public SpawnOfMayhem copy() { + return new SpawnOfMayhem(this); + } +} + +class SpawnOfMayhemEffect extends OneShotEffect { + + SpawnOfMayhemEffect() { + super(Outcome.Benefit); + staticText = "Then if you have 10 or less life, put a +1/+1 counter on {this}."; + } + + private SpawnOfMayhemEffect(final SpawnOfMayhemEffect effect) { + super(effect); + } + + @Override + public SpawnOfMayhemEffect copy() { + return new SpawnOfMayhemEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + if (player.getLife() < 11) { + return new AddCountersSourceEffect( + CounterType.P1P1.createInstance() + ).apply(game, source); + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 4ced3df05f..4d18f1fec3 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -78,6 +78,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Simic Guildgate", 257, Rarity.COMMON, mage.cards.s.SimicGuildgate.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Simic Guildgate", 258, Rarity.COMMON, mage.cards.s.SimicGuildgate.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Simic Locket", 240, Rarity.COMMON, mage.cards.s.SimicLocket.class)); + cards.add(new SetCardInfo("Spawn of Mayhem", 85, Rarity.MYTHIC, mage.cards.s.SpawnOfMayhem.class)); cards.add(new SetCardInfo("Sphinx of Foresight", 55, Rarity.RARE, mage.cards.s.SphinxOfForesight.class)); cards.add(new SetCardInfo("Sphinx's Insight", 209, Rarity.COMMON, mage.cards.s.SphinxsInsight.class)); cards.add(new SetCardInfo("Stomping Ground", 259, Rarity.RARE, mage.cards.s.StompingGround.class));