diff --git a/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java b/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java new file mode 100644 index 00000000000..d69bfc84f2f --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PurphorossIntervention.java @@ -0,0 +1,87 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.MultipliedValue; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.SacrificeTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.token.PurphorossInterventionToken; +import mage.game.permanent.token.Token; +import mage.target.common.TargetCreatureOrPlaneswalker; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PurphorossIntervention extends CardImpl { + + private static final DynamicValue xValue = new MultipliedValue(ManacostVariableValue.instance, 2); + + public PurphorossIntervention(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}"); + + // Choose one — + // • Create an X/1 red Elemental creature token with trample and haste. Sacrifice it at the beginning of the next end step. + this.getSpellAbility().addEffect(new PurphorossInterventionEffect()); + + // • Purphoros's Intervention deals twice X damage to target creature or planeswalker. + Mode mode = new Mode(new DamageTargetEffect(xValue) + .setText("{this} deals twice X damage to target creature or planeswalker")); + mode.addTarget(new TargetCreatureOrPlaneswalker()); + this.getSpellAbility().addMode(mode); + } + + private PurphorossIntervention(final PurphorossIntervention card) { + super(card); + } + + @Override + public PurphorossIntervention copy() { + return new PurphorossIntervention(this); + } +} + +class PurphorossInterventionEffect extends OneShotEffect { + + PurphorossInterventionEffect() { + super(Outcome.Benefit); + staticText = "Create an X/1 red Elemental creature token with trample and haste. " + + "Sacrifice it at the beginning of the next end step."; + } + + private PurphorossInterventionEffect(final PurphorossInterventionEffect effect) { + super(effect); + } + + @Override + public PurphorossInterventionEffect copy() { + return new PurphorossInterventionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Token token = new PurphorossInterventionToken(source.getManaCostsToPay().getX()); + token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + token.getLastAddedTokenIds() + .stream() + .forEach(uuid -> game.addDelayedTriggeredAbility( + new AtTheBeginOfNextEndStepDelayedTriggeredAbility( + new SacrificeTargetEffect() + .setText("sacrifice this creature") + .setTargetPointer(new FixedTarget(uuid, game)) + ), source + )); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 221d37d9661..0d0dcad771e 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -96,6 +96,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Pious Wayfarer", 32, Rarity.COMMON, mage.cards.p.PiousWayfarer.class)); cards.add(new SetCardInfo("Plains", 250, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Polukranos, Unchained", 224, Rarity.MYTHIC, mage.cards.p.PolukranosUnchained.class)); + cards.add(new SetCardInfo("Purphoros's Intervention", 151, Rarity.RARE, mage.cards.p.PurphorossIntervention.class)); cards.add(new SetCardInfo("Purphoros, Bronze-Blooded", 150, Rarity.MYTHIC, mage.cards.p.PurphorosBronzeBlooded.class)); cards.add(new SetCardInfo("Reverent Hoplite", 33, Rarity.UNCOMMON, mage.cards.r.ReverentHoplite.class)); cards.add(new SetCardInfo("Revoke Existence", 34, Rarity.COMMON, mage.cards.r.RevokeExistence.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/PurphorossInterventionToken.java b/Mage/src/main/java/mage/game/permanent/token/PurphorossInterventionToken.java new file mode 100644 index 00000000000..2934b37f99b --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/PurphorossInterventionToken.java @@ -0,0 +1,33 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class PurphorossInterventionToken extends TokenImpl { + + public PurphorossInterventionToken(int power) { + super("Elemental", "X/1 red Elemental creature token with trample and haste"); + this.cardType.add(CardType.CREATURE); + this.subtype.add(SubType.ELEMENTAL); + this.color.setRed(true); + this.power = new MageInt(power); + this.toughness = new MageInt(1); + this.addAbility(TrampleAbility.getInstance()); + this.addAbility(HasteAbility.getInstance()); + } + + private PurphorossInterventionToken(final PurphorossInterventionToken token) { + super(token); + } + + public PurphorossInterventionToken copy() { + return new PurphorossInterventionToken(this); + } +} +