[KHC] Implemented Pact of the Serpent

This commit is contained in:
Evan Kranzler 2021-01-23 19:51:43 -05:00
parent a00f3db62a
commit d0a0061915
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PactOfTheSerpent extends CardImpl {
public PactOfTheSerpent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// Choose a creature type. Target player draws X cards and loses X life, where X is the number of creature they control of the chosen type.
this.getSpellAbility().addEffect(new ChooseCreatureTypeEffect(Outcome.Neutral));
this.getSpellAbility().addEffect(new PactOfTheSerpentEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
private PactOfTheSerpent(final PactOfTheSerpent card) {
super(card);
}
@Override
public PactOfTheSerpent copy() {
return new PactOfTheSerpent(this);
}
}
class PactOfTheSerpentEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(ChosenSubtypePredicate.TRUE);
}
PactOfTheSerpentEffect() {
super(Outcome.Benefit);
staticText = "Target player draws X cards and loses X life, " +
"where X is the number of creature they control of the chosen type";
}
private PactOfTheSerpentEffect(final PactOfTheSerpentEffect effect) {
super(effect);
}
@Override
public PactOfTheSerpentEffect copy() {
return new PactOfTheSerpentEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
int permCount = game.getBattlefield().count(filter, source.getSourceId(), player.getId(), game);
if (permCount > 0) {
player.drawCards(permCount, source, game);
player.loseLife(permCount, game, source, false);
}
return true;
}
}

View file

@ -23,6 +23,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("Lathril, Blade of the Elves", 1, Rarity.MYTHIC, mage.cards.l.LathrilBladeOfTheElves.class));
cards.add(new SetCardInfo("Pact of the Serpent", 9, Rarity.RARE, mage.cards.p.PactOfTheSerpent.class));
cards.add(new SetCardInfo("Ruthless Winnower", 10, Rarity.RARE, mage.cards.r.RuthlessWinnower.class));
cards.add(new SetCardInfo("Sage of the Beyond", 6, Rarity.RARE, mage.cards.s.SageOfTheBeyond.class));
cards.add(new SetCardInfo("Spectral Deluge", 7, Rarity.RARE, mage.cards.s.SpectralDeluge.class));