Fixed Issue 332

This commit is contained in:
magenoxx 2011-10-25 12:12:13 +04:00
parent 075be7ad9a
commit ee2417f730
9 changed files with 70 additions and 25 deletions

View file

@ -58,6 +58,11 @@ public class Mindblaze extends CardImpl<Mindblaze> {
super(ownerId, 180, "Mindblaze", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{5}{R}");
this.expansionSetCode = "CHK";
this.color.setRed(true);
// Name a nonland card and choose a number greater than 0. Target player reveals his or her library.
// If that library contains exactly the chosen number of the named card,
// Mindblaze deals 8 damage to that player.
// Then that player shuffles his or her library.
this.getSpellAbility().addEffect(new MindblazeEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
@ -98,8 +103,18 @@ class MindblazeEffect extends OneShotEffect<MindblazeEffect> {
numbers.add(Integer.toString(i));
}
numberChoice.setChoices(numbers);
playerControls.choose(Constants.Outcome.Neutral, cardChoice, game);
playerControls.choose(Constants.Outcome.Neutral, numberChoice, game);
while (!playerControls.choose(Constants.Outcome.Neutral, cardChoice, game)) {
game.debugMessage("player canceled choosing name. retrying.");
}
while (!playerControls.choose(Constants.Outcome.Neutral, numberChoice, game)) {
game.debugMessage("player canceled choosing number. retrying.");
}
game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + "]");
game.informPlayers("Mindblaze, chosen number: [" + numberChoice.getChoice() + "]");
Cards cards = new CardsImpl();
cards.addAll(player.getLibrary().getCards(game));
playerControls.revealCards("Library", cards, game);

View file

@ -95,8 +95,11 @@ class NevermoreEffect1 extends OneShotEffect<NevermoreEffect1> {
Choice cardChoice = new ChoiceImpl();
cardChoice.setChoices(Sets.getNonLandCardNames());
cardChoice.clearChoice();
controller.choose(Outcome.Detriment, cardChoice, game);
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
game.debugMessage("player canceled choosing name. retrying.");
}
String cardName = cardChoice.getChoice();
game.informPlayers("Nevermore, named card: [" + cardName + "]");
game.getState().setValue(source.getSourceId().toString(), cardName);
}
return false;

View file

@ -95,12 +95,16 @@ class ConundrumSphinxEffect extends OneShotEffect<ConundrumSphinxEffect> {
for (Player player: game.getPlayers().values()) {
if(player.getLibrary().size() > 0){
cardChoice.clearChoice();
player.choose(Outcome.DrawCard, cardChoice, game);
while (!player.choose(Outcome.DrawCard, cardChoice, game)) {
game.debugMessage("player canceled choosing name. retrying.");
}
String cardName = cardChoice.getChoice();
game.informPlayers("Conundrum Sphinx, player: " + player.getName() + ", named card: [" + cardName + "]");
Card card = player.getLibrary().removeFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);
player.revealCards("Conundrum Sphinx", cards, game);
if (card.getName().equals(cardChoice.getChoice())) {
if (card.getName().equals(cardName)) {
card.moveToZone(Zone.HAND, source.getId(), game, true);
}
else {

View file

@ -97,10 +97,11 @@ class AdaptiveAutomatonEffect extends OneShotEffect<AdaptiveAutomatonEffect> {
if (player != null && permanent != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setChoices(Sets.getCreatureTypes());
if (player.choose(Constants.Outcome.BoostCreature, typeChoice, game)) {
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
}
while (!player.choose(Constants.Outcome.BoostCreature, typeChoice, game)) {
game.debugMessage("player canceled choosing type. retrying.");
}
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
}
return false;
}

View file

@ -63,7 +63,10 @@ public class PhyrexianRevoker extends CardImpl<PhyrexianRevoker> {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// As Phyrexian Revoker enters the battlefield, name a nonland card.
this.addAbility(new EntersBattlefieldTriggeredAbility(new PhyrexianRevokerEffect1()));
// Activated abilities of sources with the chosen name can't be activated.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhyrexianRevokerEffect2()));
}
@ -96,8 +99,11 @@ class PhyrexianRevokerEffect1 extends OneShotEffect<PhyrexianRevokerEffect1> {
Choice cardChoice = new ChoiceImpl();
cardChoice.setChoices(Sets.getNonLandCardNames());
cardChoice.clearChoice();
controller.choose(Outcome.Detriment, cardChoice, game);
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
game.debugMessage("player canceled choosing name. retrying.");
}
String cardName = cardChoice.getChoice();
game.informPlayers("Phyrexian Revoker, named card: [" + cardName + "]");
game.getState().setValue(source.getSourceId().toString(), cardName);
}
return false;

View file

@ -96,10 +96,11 @@ class XenograftEffect extends OneShotEffect<XenograftEffect> {
if (player != null && permanent != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setChoices(Sets.getCreatureTypes());
if (player.choose(Outcome.BoostCreature, typeChoice, game)) {
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
game.getState().setValue(source.getSourceId() + "_XenograftType", typeChoice.getChoice());
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
game.debugMessage("player canceled choosing type. retrying.");
}
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
game.getState().setValue(source.getSourceId() + "_XenograftType", typeChoice.getChoice());
}
return false;
}

View file

@ -54,6 +54,9 @@ public class Memoricide extends CardImpl<Memoricide> {
super(ownerId, 69, "Memoricide", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B}");
this.expansionSetCode = "SOM";
this.color.setBlack(true);
// Name a nonland card. Search target player's graveyard, hand, and library for any number of cards with
// that name and exile them. Then that player shuffles his or her library
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addEffect(new MemoricideEffect());
}
@ -88,8 +91,13 @@ class MemoricideEffect extends OneShotEffect<MemoricideEffect> {
Choice cardChoice = new ChoiceImpl();
cardChoice.setChoices(Sets.getNonLandCardNames());
cardChoice.clearChoice();
controller.choose(Outcome.Exile, cardChoice, game);
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
game.debugMessage("player canceled choosing name. retrying.");
}
String cardName = cardChoice.getChoice();
game.informPlayers("Memoricide, named card: [" + cardName + "]");
for (Card card: player.getGraveyard().getCards(game)) {
if (card.getName().equals(cardName)) {
card.moveToExile(null, "", source.getId(), game);

View file

@ -134,6 +134,7 @@ public interface Game extends MageItem, Serializable {
public void fireInformEvent(String message);
public void fireUpdatePlayersEvent();
public void informPlayers(String message);
public void debugMessage(String message);
public void fireErrorEvent(String message, Exception ex);
//game event methods

View file

@ -31,11 +31,14 @@ package mage.game;
import mage.Constants.*;
import mage.MageObject;
import mage.abilities.*;
import mage.abilities.common.ChancellorAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffects;
import mage.abilities.keyword.LeylineAbility;
import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.cards.decks.Deck;
import mage.choices.Choice;
import mage.counters.CounterType;
@ -45,7 +48,10 @@ import mage.filter.common.*;
import mage.game.combat.Combat;
import mage.game.events.*;
import mage.game.events.TableEvent.EventType;
import mage.game.permanent.*;
import mage.game.permanent.Battlefield;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.game.permanent.PermanentImpl;
import mage.game.stack.SpellStack;
import mage.game.stack.StackObject;
import mage.game.turn.Phase;
@ -54,22 +60,17 @@ import mage.game.turn.Turn;
import mage.players.Player;
import mage.players.PlayerList;
import mage.players.Players;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.watchers.Watcher;
import mage.watchers.common.CastSpellLastTurnWatcher;
import mage.watchers.common.MorbidWatcher;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.io.Serializable;
import java.util.*;
import java.util.Map.Entry;
import mage.abilities.common.ChancellorAbility;
import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardsImpl;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.watchers.common.CastSpellLastTurnWatcher;
import mage.watchers.common.MorbidWatcher;
import org.apache.log4j.Logger;
public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializable {
@ -931,6 +932,11 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
fireInformEvent(message);
}
@Override
public void debugMessage(String message) {
logger.warn(message);
}
@Override
public void fireInformEvent(String message) {
tableEventSource.fireTableEvent(EventType.INFO, message, this);