implement [MH3] Galvanic Discharge

This commit is contained in:
Susucre 2024-05-25 12:55:43 +02:00
parent 9c5273e5ee
commit 540aeef91d
3 changed files with 83 additions and 3 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.PayEnergyCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
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 GalvanicDischarge extends CardImpl {
public GalvanicDischarge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
// Choose target creature or planeswalker. You get {E}{E}{E}, then you may pay any amount of {E}. Galvanic Discharge deals that much damage to that permanent.
this.getSpellAbility().addEffect(new GalvanicDischargeEffect());
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker());
}
private GalvanicDischarge(final GalvanicDischarge card) {
super(card);
}
@Override
public GalvanicDischarge copy() {
return new GalvanicDischarge(this);
}
}
class GalvanicDischargeEffect extends OneShotEffect {
GalvanicDischargeEffect() {
super(Outcome.Damage);
this.staticText = "Choose target creature or planeswalker. You get {E}{E}{E}, then you may pay any amount of {E}. {this} deals that much damage to that permanent";
}
private GalvanicDischargeEffect(final GalvanicDischargeEffect effect) {
super(effect);
}
@Override
public GalvanicDischargeEffect copy() {
return new GalvanicDischargeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
new GetEnergyCountersControllerEffect(3).apply(game, source);
int numberToPay = controller.getAmount(0, controller.getCounters().getCount(CounterType.ENERGY), "How many {E} do you like to pay?", game);
if (numberToPay <= 0) {
return true;
}
Cost cost = new PayEnergyCost(numberToPay);
if (cost.pay(source, game, source, source.getControllerId(), true)) {
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
if (targetCreature != null) {
targetCreature.damage(numberToPay, source.getSourceId(), source, game, false, true);
}
}
return true;
}
}

View file

@ -1,7 +1,6 @@
package mage.cards.h;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.PayEnergyCost;
@ -17,8 +16,9 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class HarnessedLightning extends CardImpl {
@ -44,7 +44,7 @@ public final class HarnessedLightning extends CardImpl {
class HarnessedLightningEffect extends OneShotEffect {
HarnessedLightningEffect() {
super(Outcome.UnboostCreature);
super(Outcome.Damage);
this.staticText = "Choose target creature. You get {E}{E}{E}, then you may pay any amount of {E}. {this} deals that much damage to that creature";
}

View file

@ -60,6 +60,7 @@ public final class ModernHorizons3 extends ExpansionSet {
cards.add(new SetCardInfo("Flusterstorm", 496, Rarity.RARE, mage.cards.f.Flusterstorm.class));
cards.add(new SetCardInfo("Forest", 308, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Frogmyr Enforcer", 120, Rarity.UNCOMMON, mage.cards.f.FrogmyrEnforcer.class));
cards.add(new SetCardInfo("Galvanic Discharge", 122, Rarity.COMMON, mage.cards.g.GalvanicDischarge.class));
cards.add(new SetCardInfo("Glasswing Grace", 254, Rarity.UNCOMMON, mage.cards.g.GlasswingGrace.class));
cards.add(new SetCardInfo("Grim Servant", 97, Rarity.UNCOMMON, mage.cards.g.GrimServant.class));
cards.add(new SetCardInfo("Grist, Voracious Larva", 251, Rarity.MYTHIC, mage.cards.g.GristVoraciousLarva.class));