[NEO] Implemented Dragonspark Reactor

This commit is contained in:
Evan Kranzler 2022-02-05 14:38:05 -05:00
parent 724309b553
commit f20cbd934f
3 changed files with 64 additions and 14 deletions

View file

@ -0,0 +1,56 @@
package mage.cards.d;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DragonsparkReactor extends CardImpl {
private static final DynamicValue xValue = new CountersSourceCount(CounterType.CHARGE);
public DragonsparkReactor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{R}");
// Whenever Dragonspark Reactor or another artifact enters the battlefield under your control, put a charge counter on Dragonspark Reactor.
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
StaticFilters.FILTER_PERMANENT_ARTIFACT, false, true
));
// {4}, Sacrifice Dragonspark Reactor: It deals damage equal to the number of charge counters on it to target player and that much damage to up to one target creature.
Ability ability = new SimpleActivatedAbility(
new DamageTargetEffect(xValue, "it"), new GenericManaCost(4)
);
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPlayer());
ability.addTarget(new TargetCreaturePermanent(0, 1));
this.addAbility(ability);
}
private DragonsparkReactor(final DragonsparkReactor card) {
super(card);
}
@Override
public DragonsparkReactor copy() {
return new DragonsparkReactor(this);
}
}

View file

@ -73,6 +73,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
cards.add(new SetCardInfo("Dokuchi Shadow-Walker", 94, Rarity.COMMON, mage.cards.d.DokuchiShadowWalker.class));
cards.add(new SetCardInfo("Dokuchi Silencer", 95, Rarity.UNCOMMON, mage.cards.d.DokuchiSilencer.class));
cards.add(new SetCardInfo("Dragonfly Suit", 9, Rarity.COMMON, mage.cards.d.DragonflySuit.class));
cards.add(new SetCardInfo("Dragonspark Reactor", 137, Rarity.UNCOMMON, mage.cards.d.DragonsparkReactor.class));
cards.add(new SetCardInfo("Echo of Death's Wail", 124, Rarity.RARE, mage.cards.e.EchoOfDeathsWail.class));
cards.add(new SetCardInfo("Ecologist's Terrarium", 246, Rarity.COMMON, mage.cards.e.EcologistsTerrarium.class));
cards.add(new SetCardInfo("Eiganjo Exemplar", 10, Rarity.COMMON, mage.cards.e.EiganjoExemplar.class));

View file

@ -9,27 +9,20 @@ import mage.game.permanent.Permanent;
public class CountersSourceCount implements DynamicValue {
private final String counterName;
private final CounterType counterType;
public CountersSourceCount(CounterType counter) {
this.counterName = counter.getName();
}
public CountersSourceCount(String counterName) {
this.counterName = counterName;
public CountersSourceCount(CounterType counterType) {
this.counterType = counterType;
}
public CountersSourceCount(final CountersSourceCount countersCount) {
this.counterName = countersCount.counterName;
this.counterType = countersCount.counterType;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent permanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
if (permanent != null) {
return permanent.getCounters(game).getCount(counterName);
}
return 0;
Permanent permanent = sourceAbility.getSourcePermanentOrLKI(game);
return permanent != null ? permanent.getCounters(game).getCount(counterType) : 0;
}
@Override
@ -44,6 +37,6 @@ public class CountersSourceCount implements DynamicValue {
@Override
public String getMessage() {
return counterName + " counter on {this}";
return counterType + " counter on {this}";
}
}