mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
- Fixed #6209
This commit is contained in:
parent
eb730d4fc3
commit
f2dab4415a
1 changed files with 19 additions and 13 deletions
|
@ -12,11 +12,11 @@ import mage.filter.FilterCard;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.filter.common.FilterNonlandCard;
|
||||||
|
import mage.target.TargetCard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -26,7 +26,9 @@ public final class SpectersShriek extends CardImpl {
|
||||||
public SpectersShriek(UUID ownerId, CardSetInfo setInfo) {
|
public SpectersShriek(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}");
|
||||||
|
|
||||||
// Target opponent reveals their hand. You may choose a nonland card from it. If you do, that player exiles that card. If a nonblack card is exiled this way, exile a card from your hand.
|
// Target opponent reveals their hand. You may choose a nonland card
|
||||||
|
// from it. If you do, that player exiles that card. If a nonblack
|
||||||
|
// card is exiled this way, exile a card from your hand.
|
||||||
this.getSpellAbility().addEffect(new SpectersShriekEffect());
|
this.getSpellAbility().addEffect(new SpectersShriekEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetOpponent());
|
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||||
}
|
}
|
||||||
|
@ -47,8 +49,8 @@ class SpectersShriekEffect extends OneShotEffect {
|
||||||
|
|
||||||
SpectersShriekEffect() {
|
SpectersShriekEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
staticText = "Target opponent reveals their hand. You may choose a nonland card from it. If you do, " +
|
staticText = "Target opponent reveals their hand. You may choose a nonland card from it. If you do, "
|
||||||
"that player exiles that card. If a nonblack card is exiled this way, exile a card from your hand.";
|
+ "that player exiles that card. If a nonblack card is exiled this way, exile a card from your hand.";
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpectersShriekEffect(final SpectersShriekEffect effect) {
|
private SpectersShriekEffect(final SpectersShriekEffect effect) {
|
||||||
|
@ -64,17 +66,20 @@ class SpectersShriekEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Player player = game.getPlayer(source.getFirstTarget());
|
Player player = game.getPlayer(source.getFirstTarget());
|
||||||
if (controller == null || player == null) {
|
if (controller == null
|
||||||
|
|| player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.revealCards(source, player.getHand(), game);
|
player.revealCards(source, player.getHand(), game);
|
||||||
if (player.getHand().count(StaticFilters.FILTER_CARD_NON_LAND, game) == 0
|
if (player.getHand().count(StaticFilters.FILTER_CARD_NON_LAND, game) == 0
|
||||||
|| !controller.chooseUse(outcome, "Exile a card from " + player.getName() + "'s hand?", source, game)) {
|
|| !controller.chooseUse(Outcome.Benefit, "Exile a card from "
|
||||||
return true;
|
+ player.getName() + "'s hand?", source, game)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
TargetCard target = new TargetCardInHand(StaticFilters.FILTER_CARD_NON_LAND);
|
TargetCard target = new TargetCard(Zone.HAND, new FilterNonlandCard());
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
if (!controller.choose(outcome, player.getHand(), target, game)) {
|
target.setRequired(false);
|
||||||
|
if (!controller.chooseTarget(Outcome.Benefit, player.getHand(), target, source, game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
|
@ -83,12 +88,13 @@ class SpectersShriekEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
boolean isBlack = card.getColor(game).isBlack();
|
boolean isBlack = card.getColor(game).isBlack();
|
||||||
player.moveCards(card, Zone.EXILED, source, game);
|
player.moveCards(card, Zone.EXILED, source, game);
|
||||||
if (isBlack || controller.getHand().isEmpty()) {
|
if (isBlack
|
||||||
|
|| controller.getHand().isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
target = new TargetCardInHand(filter);
|
target = new TargetCardInHand(filter);
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
return controller.choose(outcome, controller.getHand(), target, game)
|
return controller.choose(Outcome.Detriment, controller.getHand(), target, game)
|
||||||
&& controller.moveCards(game.getCard(target.getFirstTarget()), Zone.EXILED, source, game);
|
&& controller.moveCards(game.getCard(target.getFirstTarget()), Zone.EXILED, source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue