Implemented Invigorating Surge

This commit is contained in:
Evan Kranzler 2020-06-12 08:19:44 -04:00
parent 3ff978840b
commit e35afdae0e
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,66 @@
package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
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.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class InvigoratingSurge extends CardImpl {
public InvigoratingSurge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}");
// Put a +1/+1 counter on target creature you control, then double the number of +1/+1 counters on that creature.
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()));
this.getSpellAbility().addEffect(new InvigoratingSurgeEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
}
private InvigoratingSurge(final InvigoratingSurge card) {
super(card);
}
@Override
public InvigoratingSurge copy() {
return new InvigoratingSurge(this);
}
}
class InvigoratingSurgeEffect extends OneShotEffect {
InvigoratingSurgeEffect() {
super(Outcome.Benefit);
staticText = ", then double the number of +1/+1 counters on that creature";
}
private InvigoratingSurgeEffect(final InvigoratingSurgeEffect effect) {
super(effect);
}
@Override
public InvigoratingSurgeEffect copy() {
return new InvigoratingSurgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int counterCount = permanent.getCounters(game).getCount(CounterType.P1P1);
return counterCount > 0 && permanent.addCounters(CounterType.P1P1.createInstance(counterCount), source, game);
}
}

View file

@ -85,6 +85,7 @@ public final class CoreSet2021 extends ExpansionSet {
cards.add(new SetCardInfo("Historian of Zhalfir", 325, Rarity.UNCOMMON, mage.cards.h.HistorianOfZhalfir.class));
cards.add(new SetCardInfo("Igneous Cur", 153, Rarity.COMMON, mage.cards.i.IgneousCur.class));
cards.add(new SetCardInfo("Indulging Patrician", 219, Rarity.UNCOMMON, mage.cards.i.IndulgingPatrician.class));
cards.add(new SetCardInfo("Invigorating Surge", 190, Rarity.UNCOMMON, mage.cards.i.InvigoratingSurge.class));
cards.add(new SetCardInfo("Island", 310, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Jeskai Elder", 53, Rarity.UNCOMMON, mage.cards.j.JeskaiElder.class));
cards.add(new SetCardInfo("Jolrael, Mwonvuli Recluse", 191, Rarity.RARE, mage.cards.j.JolraelMwonvuliRecluse.class));