[Y22] Implemented Kindred Denial

This commit is contained in:
Evan Kranzler 2022-03-01 18:17:48 -05:00
parent 263e475dea
commit 752243a6ad
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,72 @@
package mage.cards.k;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KindredDenial extends CardImpl {
public KindredDenial(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
// Counter target spell. Seek a card with the same mana value as that spell.
this.getSpellAbility().addEffect(new KindredDenialEffect());
this.getSpellAbility().addTarget(new TargetSpell());
}
private KindredDenial(final KindredDenial card) {
super(card);
}
@Override
public KindredDenial copy() {
return new KindredDenial(this);
}
}
class KindredDenialEffect extends OneShotEffect {
KindredDenialEffect() {
super(Outcome.Benefit);
staticText = "counter target spell. Seek a card with the same mana value as that spell";
}
private KindredDenialEffect(final KindredDenialEffect effect) {
super(effect);
}
@Override
public KindredDenialEffect copy() {
return new KindredDenialEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Spell spell = game.getSpell(source.getFirstTarget());
if (player == null || spell == null) {
return false;
}
int manaValue = spell.getManaValue();
spell.counter(source, game);
FilterCard filter = new FilterCard();
filter.add(new ManaValuePredicate(ComparisonType.EQUAL_TO, manaValue));
player.seekCard(filter, source, game);
return true;
}
}

View file

@ -25,6 +25,7 @@ public final class AlchemyInnistrad extends ExpansionSet {
cards.add(new SetCardInfo("Faithful Disciple", 7, Rarity.UNCOMMON, mage.cards.f.FaithfulDisciple.class));
cards.add(new SetCardInfo("Ishkanah, Broodmother", 52, Rarity.MYTHIC, mage.cards.i.IshkanahBroodmother.class));
cards.add(new SetCardInfo("Key to the Archive", 59, Rarity.RARE, mage.cards.k.KeyToTheArchive.class));
cards.add(new SetCardInfo("Kindred Denial", 18, Rarity.UNCOMMON, mage.cards.k.KindredDenial.class));
cards.add(new SetCardInfo("Soulstealer Axe", 60, Rarity.UNCOMMON, mage.cards.s.SoulstealerAxe.class));
cards.add(new SetCardInfo("Tireless Angler", 23, Rarity.RARE, mage.cards.t.TirelessAngler.class));
}