forked from External/mage
[MKC] Implement Counterpoint
This commit is contained in:
parent
cd5bbe96f1
commit
ec34380bed
2 changed files with 90 additions and 0 deletions
89
Mage.Sets/src/mage/cards/c/Counterpoint.java
Normal file
89
Mage.Sets/src/mage/cards/c/Counterpoint.java
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Counterpoint extends CardImpl {
|
||||
|
||||
public Counterpoint(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{B}");
|
||||
|
||||
// Counter target spell. You may cast a creature, instant, sorcery, or planeswalker spell from your graveyard with mana value less than or equal to that spell's mana value without paying its mana cost.
|
||||
this.getSpellAbility().addEffect(new CounterpointEffect());
|
||||
this.getSpellAbility().addTarget(new TargetSpell());
|
||||
}
|
||||
|
||||
private Counterpoint(final Counterpoint card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Counterpoint copy() {
|
||||
return new Counterpoint(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CounterpointEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard baseFilter = new FilterCard();
|
||||
|
||||
static {
|
||||
baseFilter.add(Predicates.or(
|
||||
CardType.CREATURE.getPredicate(),
|
||||
CardType.INSTANT.getPredicate(),
|
||||
CardType.SORCERY.getPredicate(),
|
||||
CardType.PLANESWALKER.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
CounterpointEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "counter target spell. You may cast a creature, instant, sorcery, or planeswalker spell from " +
|
||||
"your graveyard with mana value less than or equal to that spell's mana value without paying its mana cost";
|
||||
}
|
||||
|
||||
private CounterpointEffect(final CounterpointEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CounterpointEffect copy() {
|
||||
return new CounterpointEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Spell spell = game.getSpell(getTargetPointer().getFirst(game, source));
|
||||
if (player == null || spell == null) {
|
||||
return false;
|
||||
}
|
||||
int mv = spell.getManaValue();
|
||||
game.getStack().counter(spell.getId(), source, game);
|
||||
Cards cards = new CardsImpl(player.getGraveyard());
|
||||
FilterCard filter = baseFilter.copy();
|
||||
filter.add(new ManaValuePredicate(ComparisonType.FEWER_THAN, mv + 1));
|
||||
CardUtil.castSpellWithAttributesForFree(player, source, game, cards, filter);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@ public final class MurdersAtKarlovManorCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Connive // Concoct", 203, Rarity.RARE, mage.cards.c.ConniveConcoct.class));
|
||||
cards.add(new SetCardInfo("Consider", 98, Rarity.COMMON, mage.cards.c.Consider.class));
|
||||
cards.add(new SetCardInfo("Copy Catchers", 20, Rarity.RARE, mage.cards.c.CopyCatchers.class));
|
||||
cards.add(new SetCardInfo("Counterpoint", 41, Rarity.RARE, mage.cards.c.Counterpoint.class));
|
||||
cards.add(new SetCardInfo("Curate", 99, Rarity.COMMON, mage.cards.c.Curate.class));
|
||||
cards.add(new SetCardInfo("Curse of Opulence", 150, Rarity.UNCOMMON, mage.cards.c.CurseOfOpulence.class));
|
||||
cards.add(new SetCardInfo("Darien, King of Kjeldor", 59, Rarity.RARE, mage.cards.d.DarienKingOfKjeldor.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue