[MID] Implemented Geistflame Reservoir

This commit is contained in:
Evan Kranzler 2021-09-09 20:00:38 -04:00
parent eef6160a4c
commit 03dfa50f23
4 changed files with 72 additions and 12 deletions

View file

@ -0,0 +1,64 @@
package mage.cards.g;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.ExileTopXMayPlayUntilEndOfTurnEffect;
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.common.TargetAnyTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GeistflameReservoir extends CardImpl {
public GeistflameReservoir(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{R}");
// Whenever you cast an instant or sorcery spell, put a charge counter on Geistflame Reservoir.
this.addAbility(new SpellCastControllerTriggeredAbility(
new AddCountersSourceEffect(CounterType.CHARGE.createInstance()),
StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false
));
// {1}{R}, {T}, Remove any number of charge counters from Geistflame Reservoir: It deals that much damage to any target.
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(GetXValue.instance)
.setText("it deals that much damage to any target"), new ManaCostsImpl<>("{1}{R}"));
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveVariableCountersSourceCost(
CounterType.CHARGE.createInstance(), "Remove any number of charge counters from {this}"
));
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// {1}{R}, {T}: Exile the top card of your library. You may play that card this turn.
ability = new SimpleActivatedAbility(
new ExileTopXMayPlayUntilEndOfTurnEffect(1)
.setText("exile the top card of your library. You may play that card this turn"),
new ManaCostsImpl<>("{1}{R}")
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
private GeistflameReservoir(final GeistflameReservoir card) {
super(card);
}
@Override
public GeistflameReservoir copy() {
return new GeistflameReservoir(this);
}
}

View file

@ -80,6 +80,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Foul Play", 101, Rarity.UNCOMMON, mage.cards.f.FoulPlay.class));
cards.add(new SetCardInfo("Galvanic Iteration", 224, Rarity.RARE, mage.cards.g.GalvanicIteration.class));
cards.add(new SetCardInfo("Geistflame Reservoir", 142, Rarity.RARE, mage.cards.g.GeistflameReservoir.class));
cards.add(new SetCardInfo("Ghoulcaller's Harvest", 225, Rarity.RARE, mage.cards.g.GhoulcallersHarvest.class));
cards.add(new SetCardInfo("Grafted Identity", 57, Rarity.RARE, mage.cards.g.GraftedIdentity.class));
cards.add(new SetCardInfo("Graveyard Glutton", 104, Rarity.RARE, mage.cards.g.GraveyardGlutton.class));

View file

@ -62,12 +62,7 @@ public class RemoveVariableCountersSourceCost extends VariableCostImpl {
@Override
public int getMaxValue(Ability source, Game game) {
int maxValue = 0;
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
maxValue = permanent.getCounters(game).getCount(counterName);
}
return maxValue;
return permanent != null ? permanent.getCounters(game).getCount(counterName) : 0;
}
}

View file

@ -1,4 +1,3 @@
package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
@ -15,11 +14,12 @@ public enum GetXValue implements DynamicValue {
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int amount = 0;
for (VariableCost cost : sourceAbility.getCosts().getVariableCosts()) {
amount += cost.getAmount();
}
return amount;
return sourceAbility
.getCosts()
.getVariableCosts()
.stream()
.mapToInt(VariableCost::getAmount)
.sum();
}
@Override