implement [MH3] Breathe Your Last

This commit is contained in:
Susucre 2024-05-31 11:34:25 +02:00
parent 239f75fc8d
commit 4e600d81b0
2 changed files with 68 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));