mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Extended and used DiscardCardYouChooseTargetOpponentEffect for more cards.
This commit is contained in:
parent
544d1023fb
commit
1932f49969
6 changed files with 45 additions and 255 deletions
|
@ -28,20 +28,11 @@
|
|||
package mage.sets.alarareborn;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.effects.common.DrawCardControllerEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardControllerEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
|
@ -58,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 BrainbiteEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect());
|
||||
// Draw a card.
|
||||
this.getSpellAbility().addEffect(new DrawCardControllerEffect(1));
|
||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||
|
@ -73,41 +64,3 @@ public class Brainbite extends CardImpl<Brainbite> {
|
|||
return new Brainbite(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BrainbiteEffect extends OneShotEffect<BrainbiteEffect> {
|
||||
|
||||
public BrainbiteEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target opponent reveals his or her hand. You choose a card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public BrainbiteEffect(final BrainbiteEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Brainbite", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard());
|
||||
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 false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BrainbiteEffect copy() {
|
||||
return new BrainbiteEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,20 +29,13 @@
|
|||
package mage.sets.magic2010;
|
||||
|
||||
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.cards.Card;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
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.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
|
@ -51,12 +44,20 @@ import mage.target.common.TargetOpponent;
|
|||
*/
|
||||
public class Duress extends CardImpl<Duress> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a noncreature, nonland card");
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public Duress(UUID ownerId){
|
||||
super(ownerId, 96, "Duress", Rarity.COMMON, new CardType[]{CardType.SORCERY},"{B}");
|
||||
this.expansionSetCode = "M10";
|
||||
this.color.setBlack(true);
|
||||
|
||||
// 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 DuressEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect(filter));
|
||||
}
|
||||
|
||||
public Duress(final Duress card) {
|
||||
|
@ -68,48 +69,3 @@ public class Duress extends CardImpl<Duress> {
|
|||
return new Duress(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DuressEffect extends OneShotEffect<DuressEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("noncreature, nonland card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public DuressEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target opponent reveals his or her hand. You choose a noncreature, nonland card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public DuressEffect(final DuressEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Duress", 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 false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DuressEffect copy() {
|
||||
return new DuressEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,6 +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.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -51,6 +52,13 @@ import mage.target.common.TargetOpponent;
|
|||
*/
|
||||
public class Despise extends CardImpl<Despise> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a creature or planeswalker card");
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.CREATURE),
|
||||
new CardTypePredicate(CardType.PLANESWALKER)));
|
||||
}
|
||||
|
||||
public Despise(UUID ownerId) {
|
||||
super(ownerId, 56, "Despise", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{B}");
|
||||
this.expansionSetCode = "NPH";
|
||||
|
@ -59,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 DespiseEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect(filter));
|
||||
}
|
||||
|
||||
public Despise(final Despise card) {
|
||||
|
@ -71,49 +79,3 @@ public class Despise extends CardImpl<Despise> {
|
|||
return new Despise(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DespiseEffect extends OneShotEffect<DespiseEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("creature or planeswalker card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.CREATURE),
|
||||
new CardTypePredicate(CardType.PLANESWALKER)));
|
||||
}
|
||||
|
||||
public DespiseEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target opponent reveals his or her hand. You choose a creature or planeswalker card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public DespiseEffect(final DespiseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Despise", 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 false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DespiseEffect copy() {
|
||||
return new DespiseEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,18 +28,11 @@
|
|||
package mage.sets.urzaslegacy;
|
||||
|
||||
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.cards.Card;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
|
@ -56,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 OstracizeEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect(new FilterCreatureCard("a creature card")));
|
||||
}
|
||||
|
||||
public Ostracize(final Ostracize card) {
|
||||
|
@ -68,39 +61,3 @@ public class Ostracize extends CardImpl<Ostracize> {
|
|||
return new Ostracize(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OstracizeEffect extends OneShotEffect<OstracizeEffect> {
|
||||
|
||||
public OstracizeEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target opponent reveals his or her hand. You choose a creature card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public OstracizeEffect(final OstracizeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Ostracize", player.getHand(), game);
|
||||
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCreatureCard());
|
||||
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 OstracizeEffect copy() {
|
||||
return new OstracizeEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,18 +28,10 @@
|
|||
package mage.sets.visions;
|
||||
|
||||
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.cards.Card;
|
||||
import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetOpponentEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
|
@ -56,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 CoercionEffect());
|
||||
this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetOpponentEffect());
|
||||
}
|
||||
|
||||
public Coercion(final Coercion card) {
|
||||
|
@ -68,42 +60,3 @@ public class Coercion extends CardImpl<Coercion> {
|
|||
return new Coercion(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CoercionEffect extends OneShotEffect<CoercionEffect> {
|
||||
|
||||
|
||||
public CoercionEffect() {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target opponent reveals his or her hand. You choose a card from it. That player discards that card";
|
||||
}
|
||||
|
||||
public CoercionEffect(final CoercionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
player.revealCards("Coercion", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard());
|
||||
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 false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoercionEffect copy() {
|
||||
return new CoercionEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -43,13 +43,22 @@ import mage.target.TargetCard;
|
|||
*/
|
||||
public class DiscardCardYouChooseTargetOpponentEffect extends OneShotEffect<DiscardCardYouChooseTargetOpponentEffect> {
|
||||
|
||||
private FilterCard filter;
|
||||
|
||||
public DiscardCardYouChooseTargetOpponentEffect() {
|
||||
this(new FilterCard("a card"));
|
||||
}
|
||||
|
||||
public DiscardCardYouChooseTargetOpponentEffect(FilterCard filter) {
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target opponent reveals his or her hand. You choose a card from it. That player discards that card";
|
||||
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 DiscardCardYouChooseTargetOpponentEffect(final DiscardCardYouChooseTargetOpponentEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +68,7 @@ public class DiscardCardYouChooseTargetOpponentEffect extends OneShotEffect<Disc
|
|||
player.revealCards("Discard", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard());
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue