mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Thoughtseize - Fixed that game lock could happen if target player had no non land cards on hand.
This commit is contained in:
parent
05efb1773a
commit
9b82be530d
14 changed files with 110 additions and 327 deletions
|
@ -29,7 +29,7 @@ package mage.sets.alarareborn;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.DrawCardControllerEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -49,7 +49,7 @@ public class Brainbite extends CardImpl<Brainbite> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// Target opponent reveals his or her hand. You choose a card from it. That player discards that card.
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect());
|
||||
// Draw a card.
|
||||
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
|
|
@ -34,7 +34,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Zone;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
@ -58,7 +58,7 @@ public class CorpseTraders extends CardImpl<CorpseTraders> {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// {2}{B}, Sacrifice a creature: Target opponent reveals his or her hand. You choose a card from it. That player discards that card. Activate this ability only any time you could cast a sorcery.
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DiscardCardYouChooseTargetOpponentEffect(), new ManaCostsImpl("{2}{B}"));
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DiscardCardYouChooseTargetEffect(), new ManaCostsImpl("{2}{B}"));
|
||||
ability.addTarget(new TargetOpponent(true));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -33,9 +33,11 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -51,6 +53,12 @@ import mage.target.TargetPlayer;
|
|||
*/
|
||||
public class PsychicSpear extends CardImpl<PsychicSpear> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Spirit or Arcane card to discard");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new SubtypePredicate("Spirit"),new SubtypePredicate("Arcane")));
|
||||
}
|
||||
|
||||
public PsychicSpear(UUID ownerId) {
|
||||
super(ownerId, 78, "Psychic Spear", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{B}");
|
||||
this.expansionSetCode = "BOK";
|
||||
|
@ -58,8 +66,8 @@ public class PsychicSpear extends CardImpl<PsychicSpear> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// Target player reveals his or her hand. You choose a Spirit or Arcane card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().addEffect(new PsychicSpearEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filter, TargetController.ANY));
|
||||
}
|
||||
|
||||
public PsychicSpear(final PsychicSpear card) {
|
||||
|
@ -71,49 +79,3 @@ public class PsychicSpear extends CardImpl<PsychicSpear> {
|
|||
return new PsychicSpear(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PsychicSpearEffect extends OneShotEffect<PsychicSpearEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a Spirit or Arcane card to discard");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(new SubtypePredicate("Spirit"),new SubtypePredicate("Arcane")));
|
||||
}
|
||||
|
||||
public PsychicSpearEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a Spirit or Arcane card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public PsychicSpearEffect(final PsychicSpearEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Psychic Spear", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, filter);
|
||||
target.setRequired(true);
|
||||
if (you.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return player.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsychicSpearEffect copy() {
|
||||
return new PsychicSpearEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.SoulshiftAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -77,7 +77,7 @@ public class HeWhoHungers extends CardImpl<HeWhoHungers> {
|
|||
|
||||
/* {1}, Sacrifice a Spirit: Target opponent reveals his or her hand. You choose a card from it.
|
||||
* That player discards that card. Activate this ability only any time you could cast a sorcery. */
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DiscardCardYouChooseTargetOpponentEffect(), new ManaCostsImpl("{1}"));
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DiscardCardYouChooseTargetEffect(), new ManaCostsImpl("{1}"));
|
||||
ability.addTarget(new TargetOpponent(true));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -28,21 +28,15 @@
|
|||
package mage.sets.lorwyn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
|
@ -51,6 +45,12 @@ import mage.target.TargetPlayer;
|
|||
*/
|
||||
public class Thoughtseize extends CardImpl<Thoughtseize> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public Thoughtseize(UUID ownerId) {
|
||||
super(ownerId, 145, "Thoughtseize", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{B}");
|
||||
this.expansionSetCode = "LRW";
|
||||
|
@ -59,7 +59,7 @@ public class Thoughtseize extends CardImpl<Thoughtseize> {
|
|||
|
||||
// Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||
this.getSpellAbility().addEffect(new ThoughtseizeEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filter, TargetController.ANY));
|
||||
this.getSpellAbility().addEffect(new LoseLifeSourceEffect(2));
|
||||
}
|
||||
|
||||
|
@ -73,45 +73,3 @@ public class Thoughtseize extends CardImpl<Thoughtseize> {
|
|||
}
|
||||
}
|
||||
|
||||
class ThoughtseizeEffect extends OneShotEffect<ThoughtseizeEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public ThoughtseizeEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a nonland card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public ThoughtseizeEffect(final ThoughtseizeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Thoughtseize", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||
target.setRequired(true);
|
||||
if (target.canChoose(source.getControllerId(), player.getId(), game) && you.chooseTarget(outcome, player.getHand(), target, source, game)) {
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return player.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThoughtseizeEffect copy() {
|
||||
return new ThoughtseizeEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
package mage.sets.magic2010;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -57,7 +57,7 @@ public class Duress extends CardImpl<Duress> {
|
|||
|
||||
// Target opponent reveals his or her hand. You choose a noncreature, nonland card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect(filter));
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filter));
|
||||
}
|
||||
|
||||
public Duress(final Duress card) {
|
||||
|
|
|
@ -33,11 +33,13 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.ExileFromHandCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -56,8 +58,10 @@ import mage.target.common.TargetCardInHand;
|
|||
public class Unmask extends CardImpl<Unmask> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a black card from your hand");
|
||||
|
||||
private static final FilterCard filterNonLand = new FilterCard("nonland card");
|
||||
|
||||
static {
|
||||
filterNonLand.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
filter.add(new ColorPredicate(ObjectColor.BLACK));
|
||||
}
|
||||
|
||||
|
@ -72,7 +76,7 @@ public class Unmask extends CardImpl<Unmask> {
|
|||
|
||||
// Target player reveals his or her hand. You choose a nonland card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||
this.getSpellAbility().addEffect(new UnmaskEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filterNonLand, TargetController.ANY));
|
||||
}
|
||||
|
||||
public Unmask(final Unmask card) {
|
||||
|
@ -84,48 +88,3 @@ public class Unmask extends CardImpl<Unmask> {
|
|||
return new Unmask(this);
|
||||
}
|
||||
}
|
||||
|
||||
class UnmaskEffect extends OneShotEffect<UnmaskEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public UnmaskEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a nonland card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public UnmaskEffect(final UnmaskEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Unmask", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, filter);
|
||||
target.setRequired(true);
|
||||
if (you.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return player.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnmaskEffect copy() {
|
||||
return new UnmaskEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -67,7 +67,7 @@ public class Despise extends CardImpl<Despise> {
|
|||
|
||||
// Target opponent reveals his or her hand. You choose a creature or planeswalker card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect(filter));
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filter));
|
||||
}
|
||||
|
||||
public Despise(final Despise card) {
|
||||
|
|
|
@ -29,18 +29,11 @@ package mage.sets.ravnika;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.abilities.keyword.DredgeAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.constants.TargetController;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
|
@ -56,8 +49,8 @@ public class NightmareVoid extends CardImpl<NightmareVoid> {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// Target player reveals his or her hand. You choose a card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().addEffect(new NightmareVoidEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(TargetController.ANY));
|
||||
// Dredge 2
|
||||
this.addAbility(new DredgeAbility(2));
|
||||
}
|
||||
|
@ -71,39 +64,3 @@ public class NightmareVoid extends CardImpl<NightmareVoid> {
|
|||
return new NightmareVoid(this);
|
||||
}
|
||||
}
|
||||
|
||||
class NightmareVoidEffect extends OneShotEffect<NightmareVoidEffect> {
|
||||
|
||||
public NightmareVoidEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public NightmareVoidEffect(final NightmareVoidEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Nightmare Void", player.getHand(), game);
|
||||
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard());
|
||||
target.setRequired(true);
|
||||
if (you != null && you.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return player.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NightmareVoidEffect copy() {
|
||||
return new NightmareVoidEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,10 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -53,12 +55,19 @@ import mage.target.TargetPlayer;
|
|||
*/
|
||||
public class InquisitionOfKozilek extends CardImpl<InquisitionOfKozilek> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card with converted mana cost 3 or less");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4));
|
||||
}
|
||||
|
||||
public InquisitionOfKozilek(UUID ownerId){
|
||||
super(ownerId, 115, "Inquisition of Kozilek", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY},"{B}");
|
||||
this.expansionSetCode = "ROE";
|
||||
this.color.setBlack(true);
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().addEffect(new InquisitionOfKozilekEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filter, TargetController.ANY));
|
||||
}
|
||||
|
||||
public InquisitionOfKozilek(final InquisitionOfKozilek card) {
|
||||
|
@ -70,47 +79,3 @@ public class InquisitionOfKozilek extends CardImpl<InquisitionOfKozilek> {
|
|||
return new InquisitionOfKozilek(this);
|
||||
}
|
||||
}
|
||||
|
||||
class InquisitionOfKozilekEffect extends OneShotEffect<InquisitionOfKozilekEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card with converted mana cost 3 or less");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 4));
|
||||
}
|
||||
|
||||
public InquisitionOfKozilekEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a nonland card from it with converted mana cost 3 or less. That player discards that card";
|
||||
}
|
||||
|
||||
public InquisitionOfKozilekEffect(final InquisitionOfKozilekEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Inquisition of Kozilek", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, filter);
|
||||
if (you.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return player.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InquisitionOfKozilekEffect copy() {
|
||||
return new InquisitionOfKozilekEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,29 +27,28 @@
|
|||
*/
|
||||
package mage.sets.tenth;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public class Distress extends CardImpl<Distress> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public Distress(UUID ownerId) {
|
||||
super(ownerId, 136, "Distress", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{B}{B}");
|
||||
this.expansionSetCode = "10E";
|
||||
|
@ -58,7 +57,7 @@ public class Distress extends CardImpl<Distress> {
|
|||
|
||||
// Target player reveals his or her hand. You choose a nonland card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer(true));
|
||||
this.getSpellAbility().addEffect(new DistressEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(filter, TargetController.ANY));
|
||||
}
|
||||
|
||||
public Distress(final Distress card) {
|
||||
|
@ -70,49 +69,3 @@ public class Distress extends CardImpl<Distress> {
|
|||
return new Distress(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DistressEffect extends OneShotEffect<DistressEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("nonland card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public DistressEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a nonland card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public DistressEffect(final DistressEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Distress", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, filter);
|
||||
target.setRequired(true);
|
||||
if (you.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
return player.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DistressEffect copy() {
|
||||
return new DistressEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
package mage.sets.urzaslegacy;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -49,7 +49,7 @@ public class Ostracize extends CardImpl<Ostracize> {
|
|||
|
||||
// Target opponent reveals his or her hand. You choose a creature card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect(new FilterCreatureCard("a creature card")));
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(new FilterCreatureCard("a creature card")));
|
||||
}
|
||||
|
||||
public Ostracize(final Ostracize card) {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
package mage.sets.visions;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
|
@ -48,7 +48,7 @@ public class Coercion extends CardImpl<Coercion> {
|
|||
|
||||
// Target opponent reveals his or her hand. You choose a card from it. That player discards that card.
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect());
|
||||
}
|
||||
|
||||
public Coercion(final Coercion card) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
|
@ -41,33 +42,44 @@ import mage.target.TargetCard;
|
|||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class DiscardCardYouChooseTargetOpponentEffect extends OneShotEffect<DiscardCardYouChooseTargetOpponentEffect> {
|
||||
public class DiscardCardYouChooseTargetEffect extends OneShotEffect<DiscardCardYouChooseTargetEffect> {
|
||||
|
||||
private FilterCard filter;
|
||||
private TargetController targetController;
|
||||
|
||||
public DiscardCardYouChooseTargetOpponentEffect() {
|
||||
public DiscardCardYouChooseTargetEffect() {
|
||||
this(new FilterCard("a card"));
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetOpponentEffect(FilterCard filter) {
|
||||
super(Outcome.Discard);
|
||||
staticText = new StringBuilder("Target opponent reveals his or her hand. You choose ")
|
||||
.append(filter.getMessage()).append(" from it. That player discards that card").toString();
|
||||
this.filter = filter;
|
||||
public DiscardCardYouChooseTargetEffect(TargetController targetController) {
|
||||
this(new FilterCard("a card"), targetController);
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetOpponentEffect(final DiscardCardYouChooseTargetOpponentEffect effect) {
|
||||
public DiscardCardYouChooseTargetEffect(FilterCard filter) {
|
||||
this(filter, TargetController.OPPONENT);
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(FilterCard filter, TargetController targetController) {
|
||||
super(Outcome.Discard);
|
||||
this.targetController = targetController;
|
||||
this.filter = filter;
|
||||
staticText = this.setText();
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetEffect(final DiscardCardYouChooseTargetEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
this.targetController = effect.targetController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Discard", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (player != null && you != null) {
|
||||
player.revealCards(sourceCard != null ? sourceCard.getName() :"Discard", player.getHand(), game);
|
||||
if (player.getHand().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, filter);
|
||||
target.setRequired(true);
|
||||
if (you.choose(Outcome.Benefit, player.getHand(), target, game)) {
|
||||
|
@ -77,13 +89,30 @@ public class DiscardCardYouChooseTargetOpponentEffect extends OneShotEffect<Disc
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiscardCardYouChooseTargetOpponentEffect copy() {
|
||||
return new DiscardCardYouChooseTargetOpponentEffect(this);
|
||||
public DiscardCardYouChooseTargetEffect copy() {
|
||||
return new DiscardCardYouChooseTargetEffect(this);
|
||||
}
|
||||
|
||||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("Target ");
|
||||
switch(targetController) {
|
||||
case OPPONENT:
|
||||
sb.append("Opponent");
|
||||
break;
|
||||
case ANY:
|
||||
sb.append("Player");
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("target controller not supported");
|
||||
}
|
||||
sb.append(" reveals his or her hand. You choose ")
|
||||
.append(filter.getMessage()).append(" from it. That player discards that card").toString();
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue