diff --git a/Mage.Sets/src/mage/cards/s/SkullStorm.java b/Mage.Sets/src/mage/cards/s/SkullStorm.java new file mode 100644 index 0000000000..164cf6e303 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SkullStorm.java @@ -0,0 +1,88 @@ +package mage.cards.s; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeEffect; +import mage.abilities.keyword.CommanderStormAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author TheElk801 + */ +public final class SkullStorm extends CardImpl { + + public SkullStorm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{7}{B}{B}"); + + // When you cast this spell, copy it for each time you've cast your commander from the command zone this game. + this.addAbility(new CommanderStormAbility()); + + // Each opponent sacrifices a creature. Each opponent who can't loses half their life, rounded up. + this.getSpellAbility().addEffect(new SkullStormEffect()); + } + + public SkullStorm(final SkullStorm card) { + super(card); + } + + @Override + public SkullStorm copy() { + return new SkullStorm(this); + } +} + +class SkullStormEffect extends OneShotEffect { + + public SkullStormEffect() { + super(Outcome.Benefit); + this.staticText = "Each opponent sacrifices a creature. " + + "Each opponent who can't loses half their life, rounded up."; + } + + public SkullStormEffect(final SkullStormEffect effect) { + super(effect); + } + + @Override + public SkullStormEffect copy() { + return new SkullStormEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + game.getOpponents(source.getControllerId()).forEach((playerId) -> { + Player player = game.getPlayer(playerId); + if (!(player == null)) { + FilterPermanent filter = new FilterCreaturePermanent(); + filter.add(new ControllerIdPredicate(playerId)); + if (game.getBattlefield().getActivePermanents( + filter, source.getControllerId(), game + ).isEmpty()) { + int lifeToLose = (int) Math.ceil(player.getLife() / 2); + player.loseLife(lifeToLose, game, false); + } else { + Effect effect = new SacrificeEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, 1, null + ); + effect.setTargetPointer(new FixedTarget(playerId, game)); + effect.apply(game, source); + } + } + }); + return true; + } +} +//doot doot diff --git a/Mage.Sets/src/mage/sets/Commander2018.java b/Mage.Sets/src/mage/sets/Commander2018.java index bb6d365209..c01ebfaa4e 100644 --- a/Mage.Sets/src/mage/sets/Commander2018.java +++ b/Mage.Sets/src/mage/sets/Commander2018.java @@ -85,6 +85,7 @@ public final class Commander2018 extends ExpansionSet { cards.add(new SetCardInfo("Serra Avatar", 73, Rarity.MYTHIC, mage.cards.s.SerraAvatar.class)); cards.add(new SetCardInfo("Sigil of the Empty Throne", 74, Rarity.RARE, mage.cards.s.SigilOfTheEmptyThrone.class)); cards.add(new SetCardInfo("Silent-Blade Oni", 191, Rarity.RARE, mage.cards.s.SilentBladeOni.class)); + cards.add(new SetCardInfo("Skull Storm", 18, Rarity.COMMON, mage.cards.s.SkullStorm.class)); cards.add(new SetCardInfo("Sol Ring", 222, Rarity.UNCOMMON, mage.cards.s.SolRing.class)); cards.add(new SetCardInfo("Spawning Grounds", 163, Rarity.RARE, mage.cards.s.SpawningGrounds.class)); cards.add(new SetCardInfo("Swiftfoot Boots", 225, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class));