mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Some changes to target handling.
This commit is contained in:
parent
dc376e49f1
commit
155b7a277b
3 changed files with 21 additions and 17 deletions
|
@ -32,6 +32,7 @@ import mage.Constants;
|
|||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -128,21 +129,22 @@ class DimirCharmEffect extends OneShotEffect {
|
|||
Card card = player.getLibrary().removeFromTop(game);
|
||||
if(card != null){
|
||||
cards.add(card);
|
||||
game.getState().setZone(card.getId(), Zone.PICK);
|
||||
}
|
||||
}
|
||||
|
||||
if(cards.size() > 0){
|
||||
TargetCard target = new TargetCard(Constants.Zone.PICK, new FilterCard("Card to put back on top of library"));
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("Card to put back on top of library"));
|
||||
target.setRequired(true);
|
||||
if(controller.choose(Outcome.Neutral, cards, target, game)){
|
||||
if(controller.chooseTarget(Outcome.Benefit, cards, target, source, game)){
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
if(card != null){
|
||||
card.moveToZone(Constants.Zone.LIBRARY, source.getId(), game, true);
|
||||
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
|
||||
cards.remove(card);
|
||||
}
|
||||
for(Card card2 : cards.getCards(game)){
|
||||
if(card2 != null){
|
||||
card2.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, true);
|
||||
card2.moveToZone(Zone.GRAVEYARD, source.getId(), game, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ package mage.sets.gatecrash;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -103,22 +103,23 @@ class VizkopaConfessorEffect extends OneShotEffect<VizkopaConfessorEffect> {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (controller != null && targetPlayer != null) {
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (controller != null && targetPlayer != null && sourceCard != null) {
|
||||
int payLife = controller.getAmount(0, controller.getLife(),"Pay how many life?", game);
|
||||
if (payLife > 0) {
|
||||
controller.loseLife(payLife, game);
|
||||
game.informPlayers(new StringBuilder("Vizkopa Confessor: ").append(controller.getName()).append(" pays ").append(payLife).append(" life").toString());
|
||||
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": ").append(controller.getName()).append(" pays ").append(payLife).append(" life").toString());
|
||||
|
||||
Cards cardsInHand = new CardsImpl(Constants.Zone.PICK);
|
||||
Cards cardsInHand = new CardsImpl();
|
||||
cardsInHand.addAll(targetPlayer.getHand());
|
||||
|
||||
int count = Math.min(cardsInHand.size(), payLife);
|
||||
|
||||
TargetCard target = new TargetCard(count, Constants.Zone.PICK, new FilterCard());
|
||||
TargetCard target = new TargetCard(count, Zone.HAND, new FilterCard());
|
||||
target.setRequired(true);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
|
||||
if (targetPlayer.choose(Outcome.Discard, cardsInHand, target, game)) {
|
||||
if (targetPlayer.chooseTarget(Outcome.Discard, cardsInHand, target, source, game)) {
|
||||
List<UUID> targets = target.getTargets();
|
||||
for (UUID targetId : targets) {
|
||||
Card card = game.getCard(targetId);
|
||||
|
@ -128,16 +129,16 @@ class VizkopaConfessorEffect extends OneShotEffect<VizkopaConfessorEffect> {
|
|||
}
|
||||
}
|
||||
|
||||
TargetCard targetInHand = new TargetCard(Constants.Zone.PICK, new FilterCard("card to exile"));
|
||||
TargetCard targetInHand = new TargetCard(Zone.HAND, new FilterCard("card to exile"));
|
||||
targetInHand.setRequired(true);
|
||||
|
||||
if (!revealedCards.isEmpty()) {
|
||||
targetPlayer.revealCards("Vizkopa Confessor", revealedCards, game);
|
||||
controller.choose(Constants.Outcome.Exile, revealedCards, targetInHand, game);
|
||||
controller.chooseTarget(Outcome.Exile, revealedCards, targetInHand, source, game);
|
||||
Card card = revealedCards.get(targetInHand.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.moveToExile(null, null, source.getSourceId(), game);
|
||||
game.informPlayers(new StringBuilder("Vizkopa Confessor: Exiled card ").append(card.getName()).toString());
|
||||
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": Exiled card ").append(card.getName()).toString());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -28,9 +28,10 @@
|
|||
package mage.sets.lorwyn;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
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;
|
||||
|
@ -81,7 +82,7 @@ class ThoughtseizeEffect extends OneShotEffect<ThoughtseizeEffect> {
|
|||
}
|
||||
|
||||
public ThoughtseizeEffect() {
|
||||
super(Constants.Outcome.Discard);
|
||||
super(Outcome.Discard);
|
||||
staticText = "Target player reveals his or her hand. You choose a nonland card from it. That player discards that card";
|
||||
}
|
||||
|
||||
|
@ -96,8 +97,8 @@ class ThoughtseizeEffect extends OneShotEffect<ThoughtseizeEffect> {
|
|||
player.revealCards("Thoughtseize", player.getHand(), game);
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
TargetCard target = new TargetCard(Constants.Zone.PICK, filter);
|
||||
if (you.choose(Constants.Outcome.Benefit, player.getHand(), target, game)) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, filter);
|
||||
if (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);
|
||||
|
|
Loading…
Reference in a new issue