diff --git a/Mage.Sets/src/mage/cards/b/BreatheYourLast.java b/Mage.Sets/src/mage/cards/b/BreatheYourLast.java new file mode 100644 index 00000000000..a3e8830c40a --- /dev/null +++ b/Mage.Sets/src/mage/cards/b/BreatheYourLast.java @@ -0,0 +1,67 @@ +package mage.cards.b; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreatureOrPlaneswalker; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class BreatheYourLast extends CardImpl { + + public BreatheYourLast(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}{B}"); + + // Destroy target creature or planeswalker. You gain 1 life for each of its colors. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addEffect(new BreatheYourLastEffect()); + this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker()); + } + + private BreatheYourLast(final BreatheYourLast card) { + super(card); + } + + @Override + public BreatheYourLast copy() { + return new BreatheYourLast(this); + } +} + +class BreatheYourLastEffect extends OneShotEffect { + + BreatheYourLastEffect() { + super(Outcome.DestroyPermanent); + staticText = "You gain 1 life for each of its colors."; + } + + private BreatheYourLastEffect(final BreatheYourLastEffect effect) { + super(effect); + } + + @Override + public BreatheYourLastEffect copy() { + return new BreatheYourLastEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); + Player controller = game.getPlayer(source.getControllerId()); + if (permanent == null || controller == null) { + return false; + } + int colors = permanent.getColor(game).getColorCount(); + return controller.gainLife(colors, game, source) > 0; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index 09687fca23b..790ecee0e51 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -41,6 +41,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("Brainsurge", 53, Rarity.UNCOMMON, mage.cards.b.Brainsurge.class)); cards.add(new SetCardInfo("Branching Evolution", 285, Rarity.RARE, mage.cards.b.BranchingEvolution.class)); cards.add(new SetCardInfo("Breaker of Creation", 1, Rarity.UNCOMMON, mage.cards.b.BreakerOfCreation.class)); + cards.add(new SetCardInfo("Breathe Your Last", 82, Rarity.COMMON, mage.cards.b.BreatheYourLast.class)); cards.add(new SetCardInfo("Breya, Etherium Shaper", 289, Rarity.MYTHIC, mage.cards.b.BreyaEtheriumShaper.class)); cards.add(new SetCardInfo("Bridgeworks Battle", 249, Rarity.UNCOMMON, mage.cards.b.BridgeworksBattle.class)); cards.add(new SetCardInfo("Buried Alive", 273, Rarity.UNCOMMON, mage.cards.b.BuriedAlive.class));