[KHC] Implemented Spectral Deluge

This commit is contained in:
Evan Kranzler 2021-01-22 10:02:38 -05:00
parent 36c52c0ece
commit 7eff63d68e
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,66 @@
package mage.cards.s;
import mage.MageObject;
import mage.abilities.effects.common.ReturnToHandFromBattlefieldAllEffect;
import mage.abilities.keyword.ForetellAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterOpponentsCreaturePermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SpectralDeluge extends CardImpl {
private static final FilterPermanent filter = new FilterOpponentsCreaturePermanent();
static {
filter.add(SpectralDelugePredicate.instance);
}
public SpectralDeluge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}");
// Return each creature your opponents control with toughness X or less to its owner's hand, where X is the number of Islands you control.
this.getSpellAbility().addEffect(new ReturnToHandFromBattlefieldAllEffect(filter).setText(
"return each creature your opponents control with toughness X or less to its owner's hand, " +
"where X is the number of Islands you control"
));
// Foretell {1}{U}{U}
this.addAbility(new ForetellAbility(this, "{1}{U}{U}"));
}
private SpectralDeluge(final SpectralDeluge card) {
super(card);
}
@Override
public SpectralDeluge copy() {
return new SpectralDeluge(this);
}
}
enum SpectralDelugePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
instance;
private static final FilterPermanent filter = new FilterPermanent(SubType.ISLAND, "");
@Override
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
return input
.getObject()
.getPower()
.getValue()
<= game
.getBattlefield()
.count(filter, input.getSourceId(), input.getPlayerId(), game);
}
}

View file

@ -34,6 +34,7 @@ public final class KaldheimCommander extends ExpansionSet {
cards.add(new SetCardInfo("Elderfang Venom", 15, Rarity.RARE, mage.cards.e.ElderfangVenom.class));
cards.add(new SetCardInfo("Inspired Sphinx", 40, Rarity.MYTHIC, mage.cards.i.InspiredSphinx.class));
cards.add(new SetCardInfo("Spectral Deluge", 7, Rarity.RARE, mage.cards.s.SpectralDeluge.class));
cards.removeIf(setCardInfo -> unfinished.contains(setCardInfo.getName())); // remove when mechanic is fully implemented
}