[NCC] Implemented Storm of Forms

This commit is contained in:
Evan Kranzler 2022-04-26 19:18:47 -04:00
parent dfe09a5c27
commit afb3c909dd
2 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CastSourceTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.common.TargetNonlandPermanent;
import java.util.Collection;
import java.util.HashMap;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class StormOfForms extends CardImpl {
public StormOfForms(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}");
// When you cast this spell, copy it for each kind of counter among permanents you control. You may choose new targets for the copies.
this.addAbility(new CastSourceTriggeredAbility(new StormOfFormsEffect()));
// Return target nonland permanent to its owner's hand.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addTarget(new TargetNonlandPermanent());
}
private StormOfForms(final StormOfForms card) {
super(card);
}
@Override
public StormOfForms copy() {
return new StormOfForms(this);
}
}
class StormOfFormsEffect extends OneShotEffect {
StormOfFormsEffect() {
super(Outcome.Benefit);
staticText = "copy it for each kind of counter among permanents you control. " +
"You may choose new targets for the copies";
}
private StormOfFormsEffect(final StormOfFormsEffect effect) {
super(effect);
}
@Override
public StormOfFormsEffect copy() {
return new StormOfFormsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Spell spell = (Spell) getValue("spellCast");
if (controller == null || spell == null) {
return false;
}
int amount = game
.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_PERMANENT,
source.getControllerId(), source, game
).stream()
.map(p -> p.getCounters(game))
.map(HashMap::keySet)
.flatMap(Collection::stream)
.distinct()
.mapToInt(x -> 1)
.sum();
if (amount > 0) {
spell.createCopyOnStack(game, source, source.getControllerId(), true, amount);
return true;
}
return false;
}
}

View file

@ -256,6 +256,7 @@ public final class NewCapennaCommander extends ExpansionSet {
cards.add(new SetCardInfo("Stalking Vengeance", 276, Rarity.RARE, mage.cards.s.StalkingVengeance.class));
cards.add(new SetCardInfo("Steelbane Hydra", 313, Rarity.RARE, mage.cards.s.SteelbaneHydra.class));
cards.add(new SetCardInfo("Stolen Identity", 233, Rarity.RARE, mage.cards.s.StolenIdentity.class));
cards.add(new SetCardInfo("Storm of Forms", 32, Rarity.RARE, mage.cards.s.StormOfForms.class));
cards.add(new SetCardInfo("Strionic Resonator", 381, Rarity.RARE, mage.cards.s.StrionicResonator.class));
cards.add(new SetCardInfo("Sun Titan", 210, Rarity.MYTHIC, mage.cards.s.SunTitan.class));
cards.add(new SetCardInfo("Sungrass Prairie", 430, Rarity.RARE, mage.cards.s.SungrassPrairie.class));