mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Fixed while loops running endless if player left game.
This commit is contained in:
parent
038b15f399
commit
f430a45157
32 changed files with 121 additions and 58 deletions
|
@ -102,7 +102,9 @@ class MeddlingMageChooseCardEffect extends OneShotEffect<MeddlingMageChooseCardE
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("MeddlingMage, named card: [" + cardName + "]");
|
game.informPlayers("MeddlingMage, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -92,7 +92,9 @@ class ThoughtHemorrhageEffect extends OneShotEffect<ThoughtHemorrhageEffect> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!you.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!you.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!you.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cardName = cardChoice.getChoice();
|
cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Thought Hemorrhage, named card: [" + cardName + "]");
|
game.informPlayers("Thought Hemorrhage, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -145,8 +145,10 @@ class TraceOfAbundanceEffect extends ManaEffect<TraceOfAbundanceEffect> {
|
||||||
Player player = game.getPlayer(land.getControllerId());
|
Player player = game.getPlayer(land.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ChoiceColor choice = new ChoiceColor();
|
ChoiceColor choice = new ChoiceColor();
|
||||||
while (!player.choose(outcome, choice, game) && player.isInGame()) {
|
while (!player.choose(outcome, choice, game)) {
|
||||||
game.debugMessage("player canceled choosing color. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
Mana mana = null;
|
Mana mana = null;
|
||||||
|
|
|
@ -108,8 +108,10 @@ class CavernOfSoulsEffect extends OneShotEffect<CavernOfSoulsEffect> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.Benefit, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Benefit, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
||||||
|
@ -122,10 +124,10 @@ class CavernOfSoulsEffect extends OneShotEffect<CavernOfSoulsEffect> {
|
||||||
public CavernOfSoulsEffect copy() {
|
public CavernOfSoulsEffect copy() {
|
||||||
return new CavernOfSoulsEffect(this);
|
return new CavernOfSoulsEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConditionalMana build(Object... options) {
|
public ConditionalMana build(Object... options) {
|
||||||
return new CavernOfSoulsConditionalMana(this.mana);
|
return new CavernOfSoulsConditionalMana(this.mana);
|
||||||
|
@ -197,7 +199,6 @@ class CavernOfSoulsWatcher extends WatcherImpl<CavernOfSoulsWatcher> {
|
||||||
super.reset();
|
super.reset();
|
||||||
spells.clear();
|
spells.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CavernOfSoulsCantCounterEffect extends ReplacementEffectImpl<CavernOfSoulsCantCounterEffect> {
|
class CavernOfSoulsCantCounterEffect extends ReplacementEffectImpl<CavernOfSoulsCantCounterEffect> {
|
||||||
|
@ -237,5 +238,4 @@ class CavernOfSoulsCantCounterEffect extends ReplacementEffectImpl<CavernOfSouls
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,10 @@ class RidersOfGavonyEffect extends OneShotEffect<RidersOfGavonyEffect> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeChoice.getChoice() != null) {
|
if (typeChoice.getChoice() != null) {
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
|
|
|
@ -94,7 +94,9 @@ class CranialExtractionEffect extends OneShotEffect<CranialExtractionEffect> {
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
|
|
||||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
|
|
|
@ -106,11 +106,15 @@ class MindblazeEffect extends OneShotEffect<MindblazeEffect> {
|
||||||
numberChoice.setChoices(numbers);
|
numberChoice.setChoices(numbers);
|
||||||
|
|
||||||
while (!playerControls.choose(Outcome.Neutral, cardChoice, game)) {
|
while (!playerControls.choose(Outcome.Neutral, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!playerControls.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!playerControls.choose(Outcome.Neutral, numberChoice, game)) {
|
while (!playerControls.choose(Outcome.Neutral, numberChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing number. retrying.");
|
if (!playerControls.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + "]");
|
game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + "]");
|
||||||
|
|
|
@ -114,7 +114,9 @@ class CouncilOfTheAbsoluteChooseCardEffect extends OneShotEffect<CouncilOfTheAbs
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandAndNonCreatureNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandAndNonCreatureNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Council of the Absolute, named card: [" + cardName + "]");
|
game.informPlayers("Council of the Absolute, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -133,8 +133,10 @@ class PlasmCaptureManaEffect extends ManaEffect<PlasmCaptureManaEffect> {
|
||||||
Mana mana = new Mana();
|
Mana mana = new Mana();
|
||||||
for(int i = 0; i < amountOfMana; i++){
|
for(int i = 0; i < amountOfMana; i++){
|
||||||
ChoiceColor choiceColor = new ChoiceColor();
|
ChoiceColor choiceColor = new ChoiceColor();
|
||||||
while (!player.choose(Outcome.Benefit, choiceColor, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Benefit, choiceColor, game)) {
|
||||||
game.debugMessage("player canceled choosing color. retrying." );
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choiceColor.getColor().isBlack()) {
|
if (choiceColor.getColor().isBlack()) {
|
||||||
|
|
|
@ -140,8 +140,10 @@ class VerdantHavenManaEffect extends ManaEffect<VerdantHavenManaEffect> {
|
||||||
Player player = game.getPlayer(land.getControllerId());
|
Player player = game.getPlayer(land.getControllerId());
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
ChoiceColor choice = new ChoiceColor();
|
ChoiceColor choice = new ChoiceColor();
|
||||||
while (!player.choose(outcome, choice, game) && player.isInGame()) {
|
while (!player.choose(outcome, choice, game)) {
|
||||||
game.debugMessage("player canceled choosing color. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int amount = 1;
|
int amount = 1;
|
||||||
Mana mana = null;
|
Mana mana = null;
|
||||||
|
|
|
@ -108,8 +108,10 @@ class OrcishLumberjackManaEffect extends ManaEffect <OrcishLumberjackManaEffect>
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++){
|
for(int i = 0; i < 3; i++){
|
||||||
Mana mana = new Mana();
|
Mana mana = new Mana();
|
||||||
while (!player.choose(Outcome.Benefit, manaChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing color. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manaChoice.getChoice().equals("Green")) {
|
if (manaChoice.getChoice().equals("Green")) {
|
||||||
|
|
|
@ -96,7 +96,9 @@ class NevermoreEffect1 extends OneShotEffect<NevermoreEffect1> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Nevermore, named card: [" + cardName + "]");
|
game.informPlayers("Nevermore, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -98,7 +98,9 @@ class CabalTherapyEffect extends OneShotEffect<CabalTherapyEffect> {
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
|
|
||||||
while (!controller.choose(Outcome.Discard, cardChoice, game)) {
|
while (!controller.choose(Outcome.Discard, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
|
|
|
@ -99,8 +99,10 @@ public class MistformSliver extends CardImpl<MistformSliver> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.Detriment, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Detriment, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
||||||
|
|
|
@ -116,7 +116,9 @@ class SphinxAmbassadorEffect extends OneShotEffect<SphinxAmbassadorEffect> {
|
||||||
cardChoice.setChoices(choices);
|
cardChoice.setChoices(choices);
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!targetPlayer.choose(Outcome.Benefit, cardChoice, game)) {
|
while (!targetPlayer.choose(Outcome.Benefit, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!targetPlayer.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,9 @@ class ConundrumSphinxEffect extends OneShotEffect<ConundrumSphinxEffect> {
|
||||||
if(player.getLibrary().size() > 0){
|
if(player.getLibrary().size() > 0){
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!player.choose(Outcome.DrawCard, cardChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.DrawCard, cardChoice, game) && player.isInGame()) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Conundrum Sphinx, player: " + player.getName() + ", named card: [" + cardName + "]");
|
game.informPlayers("Conundrum Sphinx, player: " + player.getName() + ", named card: [" + cardName + "]");
|
||||||
|
|
|
@ -95,8 +95,10 @@ class AdaptiveAutomatonEffect extends OneShotEffect<AdaptiveAutomatonEffect> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
||||||
|
|
|
@ -107,8 +107,10 @@ class ChooseCreatureTypeEffect extends OneShotEffect<ChooseCreatureTypeEffect> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice());
|
||||||
|
|
|
@ -100,7 +100,9 @@ class SpoilsOfTheVaultEffect extends OneShotEffect<SpoilsOfTheVaultEffect> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNames());
|
cardChoice.setChoices(CardRepository.instance.getNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cardName = cardChoice.getChoice();
|
cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Spoils of the Vault, named card: [" + cardName + "]");
|
game.informPlayers("Spoils of the Vault, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -100,7 +100,9 @@ class PhyrexianRevokerEffect1 extends OneShotEffect<PhyrexianRevokerEffect1> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Phyrexian Revoker, named card: [" + cardName + "]");
|
game.informPlayers("Phyrexian Revoker, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -97,8 +97,10 @@ class XenograftEffect extends OneShotEffect<XenograftEffect> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
game.getState().setValue(source.getSourceId() + "_XenograftType", typeChoice.getChoice());
|
game.getState().setValue(source.getSourceId() + "_XenograftType", typeChoice.getChoice());
|
||||||
|
|
|
@ -105,8 +105,10 @@ class WordsOfWindEffect extends ReplacementEffectImpl<WordsOfWindEffect> {
|
||||||
TargetControlledPermanent target = new TargetControlledPermanent();
|
TargetControlledPermanent target = new TargetControlledPermanent();
|
||||||
List<Permanent> liste = game.getBattlefield().getActivePermanents(new FilterControlledPermanent(), playerId, game);
|
List<Permanent> liste = game.getBattlefield().getActivePermanents(new FilterControlledPermanent(), playerId, game);
|
||||||
if(!liste.isEmpty()){
|
if(!liste.isEmpty()){
|
||||||
while (!player.choose(Outcome.ReturnToHand, target, source.getSourceId(), game) && player.isInGame()){
|
while (!player.choose(Outcome.ReturnToHand, target, source.getSourceId(), game)){
|
||||||
game.debugMessage("player canceled choosing permanent. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
|
|
|
@ -100,7 +100,9 @@ class VoidstoneGargoyleChooseCardEffect extends OneShotEffect<VoidstoneGargoyleC
|
||||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("VoidstoneGargoyle, named card: [" + cardName + "]");
|
game.informPlayers("VoidstoneGargoyle, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -111,8 +111,10 @@ class AxebaneGuardianManaEffect extends ManaEffect<AxebaneGuardianManaEffect> {
|
||||||
Mana mana = new Mana();
|
Mana mana = new Mana();
|
||||||
for(int i = 0; i < x; i++){
|
for(int i = 0; i < x; i++){
|
||||||
ChoiceColor choiceColor = new ChoiceColor();
|
ChoiceColor choiceColor = new ChoiceColor();
|
||||||
while (!player.choose(Outcome.Benefit, choiceColor, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Benefit, choiceColor, game)) {
|
||||||
game.debugMessage("player canceled choosing color. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choiceColor.getColor().isBlack()) {
|
if (choiceColor.getColor().isBlack()) {
|
||||||
|
|
|
@ -98,7 +98,9 @@ class SlaughterGamesEffect extends SearchTargetGraveyardHandLibraryForCardNameAn
|
||||||
cardChoice.setMessage("Name a nonland card");
|
cardChoice.setMessage("Name a nonland card");
|
||||||
|
|
||||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName;
|
String cardName;
|
||||||
cardName = cardChoice.getChoice();
|
cardName = cardChoice.getChoice();
|
||||||
|
|
|
@ -91,8 +91,10 @@ class TabletOfTheGuildsEntersBattlefieldEffect extends OneShotEffect<TabletOfThe
|
||||||
String colors;
|
String colors;
|
||||||
ChoiceColor colorChoice = new ChoiceColor();
|
ChoiceColor colorChoice = new ChoiceColor();
|
||||||
colorChoice.setMessage("Choose the first color");
|
colorChoice.setMessage("Choose the first color");
|
||||||
while (!player.choose(Outcome.GainLife, colorChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.GainLife, colorChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
game.getState().setValue(permanent.getId() + "_color1", colorChoice.getColor().toString());
|
game.getState().setValue(permanent.getId() + "_color1", colorChoice.getColor().toString());
|
||||||
colors = colorChoice.getChoice().toLowerCase() + " and ";
|
colors = colorChoice.getChoice().toLowerCase() + " and ";
|
||||||
|
|
|
@ -90,7 +90,9 @@ class NameCard extends OneShotEffect<NameCard> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNames());
|
cardChoice.setChoices(CardRepository.instance.getNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Pithing Needle, named card: [" + cardName + "]");
|
game.informPlayers("Pithing Needle, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -93,7 +93,9 @@ class MemoricideEffect extends OneShotEffect<MemoricideEffect> {
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
|
|
||||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
|
|
|
@ -102,7 +102,9 @@ class NameCard extends OneShotEffect<NameCard> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNames());
|
cardChoice.setChoices(CardRepository.instance.getNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!controller.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Runed Halo, named card: [" + cardName + "]");
|
game.informPlayers("Runed Halo, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -96,7 +96,10 @@ class CursedScrollEffect extends OneShotEffect<CursedScrollEffect> {
|
||||||
cardChoice.setChoices(CardRepository.instance.getNames());
|
cardChoice.setChoices(CardRepository.instance.getNames());
|
||||||
cardChoice.clearChoice();
|
cardChoice.clearChoice();
|
||||||
while (!you.choose(Outcome.Damage, cardChoice, game)) {
|
while (!you.choose(Outcome.Damage, cardChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing name. retrying.");
|
if (!you.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
String cardName = cardChoice.getChoice();
|
String cardName = cardChoice.getChoice();
|
||||||
game.informPlayers("Cursed Scroll, named card: [" + cardName + "]");
|
game.informPlayers("Cursed Scroll, named card: [" + cardName + "]");
|
||||||
|
|
|
@ -129,10 +129,11 @@ class XenagosManaEffect extends OneShotEffect <XenagosManaEffect> {
|
||||||
|
|
||||||
for(int i = 0; i < x; i++){
|
for(int i = 0; i < x; i++){
|
||||||
Mana mana = new Mana();
|
Mana mana = new Mana();
|
||||||
while (!player.choose(Outcome.Benefit, manaChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing color. retrying.");
|
if (!player.isInGame()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manaChoice.getChoice().equals("Green")) {
|
if (manaChoice.getChoice().equals("Green")) {
|
||||||
mana.addGreen();
|
mana.addGreen();
|
||||||
} else if (manaChoice.getChoice().equals("Red")) {
|
} else if (manaChoice.getChoice().equals("Red")) {
|
||||||
|
|
|
@ -90,9 +90,10 @@ public class EngineeredPlague extends CardImpl<EngineeredPlague> {
|
||||||
Choice typeChoice = new ChoiceImpl(true);
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
typeChoice.setMessage("Choose creature type");
|
typeChoice.setMessage("Choose creature type");
|
||||||
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
while (!player.choose(Outcome.Detriment, typeChoice, game) && player.isInGame()) {
|
while (!player.choose(Outcome.Detriment, typeChoice, game)) {
|
||||||
game.debugMessage("player canceled choosing type. retrying.");
|
if (!player.isInGame()) {
|
||||||
}
|
return false;
|
||||||
|
} }
|
||||||
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
game.informPlayers(permanent.getName() + ": " + player.getName() + " has chosen " + typeChoice.getChoice());
|
||||||
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
game.getState().setValue(permanent.getId() + "_type", typeChoice.getChoice().toString());
|
||||||
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice() + "</i>");
|
permanent.addInfo("chosen type", "<i>Chosen type: " + typeChoice.getChoice() + "</i>");
|
||||||
|
|
Loading…
Reference in a new issue