mirror of
https://github.com/correl/mage.git
synced 2024-12-03 03:00:10 +00:00
* Cast without paying its mana cost - fixed that some cards can freeze the game on disconnected player or non castable cards (Mizzix's Mastery and other);
This commit is contained in:
parent
e92081b7ea
commit
1ac9502748
13 changed files with 113 additions and 150 deletions
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.common.ColorsOfManaSpentToCastCount;
|
import mage.abilities.dynamicvalue.common.ColorsOfManaSpentToCastCount;
|
||||||
|
@ -20,8 +19,9 @@ import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class BringToLight extends CardImpl {
|
public final class BringToLight extends CardImpl {
|
||||||
|
@ -86,8 +86,7 @@ class BringToLightEffect extends OneShotEffect {
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
if (cardWasCast) {
|
if (!cardWasCast) {
|
||||||
} else {
|
|
||||||
Logger.getLogger(BringToLightEffect.class).error("Bring to Light: spellAbility == null " + card.getName());
|
Logger.getLogger(BringToLightEffect.class).error("Bring to Light: spellAbility == null " + card.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
package mage.cards.c;
|
package mage.cards.c;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
@ -19,8 +14,9 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class ChaosWand extends CardImpl {
|
public final class ChaosWand extends CardImpl {
|
||||||
|
@ -79,7 +75,7 @@ class ChaosWandEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Cards cardsToShuffle = new CardsImpl();
|
Cards cardsToShuffle = new CardsImpl();
|
||||||
while (opponent.getLibrary().hasCards()) {
|
while (opponent.canRespond() && opponent.getLibrary().hasCards()) {
|
||||||
Card card = opponent.getLibrary().getFromTop(game);
|
Card card = opponent.getLibrary().getFromTop(game);
|
||||||
if (card == null) {
|
if (card == null) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -84,16 +84,17 @@ class CollectedConjuringEffect extends OneShotEffect {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 6));
|
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 6));
|
||||||
|
Cards cardsToChoose = new CardsImpl(cards);
|
||||||
controller.moveCards(cards, Zone.EXILED, source, game);
|
controller.moveCards(cards, Zone.EXILED, source, game);
|
||||||
int cardsCast = 0;
|
int cardsCast = 0;
|
||||||
while (!cards.getCards(filter, source.getSourceId(), source.getControllerId(), game).isEmpty()
|
while (!cardsToChoose.getCards(filter, source.getSourceId(), source.getControllerId(), game).isEmpty()
|
||||||
&& cardsCast < 2) {
|
&& cardsCast < 2) {
|
||||||
if (!controller.chooseUse(Outcome.PlayForFree, "Cast a card exiled with "
|
if (!controller.chooseUse(Outcome.PlayForFree, "Cast a card exiled with "
|
||||||
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TargetCard targetCard = new TargetCard(1, Zone.EXILED, filter2);
|
TargetCard targetCard = new TargetCard(1, Zone.EXILED, filter2);
|
||||||
if (!controller.choose(Outcome.PlayForFree, cards, targetCard, game)) {
|
if (!controller.choose(Outcome.PlayForFree, cardsToChoose, targetCard, game)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Card card = game.getCard(targetCard.getFirstTarget());
|
Card card = game.getCard(targetCard.getFirstTarget());
|
||||||
|
@ -104,6 +105,7 @@ class CollectedConjuringEffect extends OneShotEffect {
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
|
cardsToChoose.remove(card); // remove on non cast too (infinite freeze fix)
|
||||||
if (cardWasCast) {
|
if (cardWasCast) {
|
||||||
cards.remove(card);
|
cards.remove(card);
|
||||||
cardsCast++;
|
cardsCast++;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -18,8 +17,9 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class EpicExperiment extends CardImpl {
|
public final class EpicExperiment extends CardImpl {
|
||||||
|
@ -79,7 +79,7 @@ class EpicExperimentEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
cardsToCast.addAll(epicExperimentExileZone.getCards(filter, source.getSourceId(),
|
cardsToCast.addAll(epicExperimentExileZone.getCards(filter, source.getSourceId(),
|
||||||
source.getControllerId(), game));
|
source.getControllerId(), game));
|
||||||
while (!cardsToCast.isEmpty()) {
|
while (controller.canRespond() && !cardsToCast.isEmpty()) {
|
||||||
if (!controller.chooseUse(Outcome.PlayForFree, "Cast (another) a card exiled with "
|
if (!controller.chooseUse(Outcome.PlayForFree, "Cast (another) a card exiled with "
|
||||||
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,32 +1,24 @@
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.AttacksTriggeredAbility;
|
import mage.abilities.common.AttacksTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
import mage.constants.*;
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterNonlandCard;
|
import mage.filter.common.FilterNonlandCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author ciaccona007 & L_J
|
* @author ciaccona007 & L_J
|
||||||
*/
|
*/
|
||||||
public final class EtaliPrimalStorm extends CardImpl {
|
public final class EtaliPrimalStorm extends CardImpl {
|
||||||
|
@ -99,7 +91,7 @@ class EtaliPrimalStormEffect extends OneShotEffect {
|
||||||
Cards cardsToCast = new CardsImpl();
|
Cards cardsToCast = new CardsImpl();
|
||||||
cardsToCast.addAll(currentExiledCards);
|
cardsToCast.addAll(currentExiledCards);
|
||||||
boolean alreadyCast = false;
|
boolean alreadyCast = false;
|
||||||
while (!cardsToCast.isEmpty()) {
|
while (controller.canRespond() && !cardsToCast.isEmpty()) {
|
||||||
if (!controller.chooseUse(Outcome.PlayForFree, "Cast a"
|
if (!controller.chooseUse(Outcome.PlayForFree, "Cast a"
|
||||||
+ (alreadyCast ? "nother" : "") + " card exiled with "
|
+ (alreadyCast ? "nother" : "") + " card exiled with "
|
||||||
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
||||||
|
|
|
@ -1,22 +1,12 @@
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
|
import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
import mage.constants.*;
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.ComparisonType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.TargetController;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterControlledLandPermanent;
|
import mage.filter.common.FilterControlledLandPermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
|
@ -26,8 +16,9 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author ciaccona007
|
* @author ciaccona007
|
||||||
*/
|
*/
|
||||||
public final class HazoretsUndyingFury extends CardImpl {
|
public final class HazoretsUndyingFury extends CardImpl {
|
||||||
|
@ -101,10 +92,10 @@ class HazoretsUndyingFuryEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
cardsToCast.addAll(hazoretsUndyingFuryExileZone.getCards(filter,
|
cardsToCast.addAll(hazoretsUndyingFuryExileZone.getCards(filter,
|
||||||
source.getSourceId(), source.getControllerId(), game));
|
source.getSourceId(), source.getControllerId(), game));
|
||||||
while (!cardsToCast.isEmpty()) {
|
while (controller.canRespond() && !cardsToCast.isEmpty()) {
|
||||||
if (!controller.chooseUse(Outcome.PlayForFree,
|
if (!controller.chooseUse(Outcome.PlayForFree,
|
||||||
"Cast (another) a card exiled with "
|
"Cast (another) a card exiled with "
|
||||||
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TargetCard targetCard = new TargetCard(1, Zone.EXILED,
|
TargetCard targetCard = new TargetCard(1, Zone.EXILED,
|
||||||
|
@ -116,9 +107,8 @@ class HazoretsUndyingFuryEffect extends OneShotEffect {
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
if (cardWasCast) {
|
cardsToCast.remove(card);
|
||||||
cardsToCast.remove(card);
|
if (!cardWasCast) {
|
||||||
} else {
|
|
||||||
game.informPlayer(controller, "You're not able to cast "
|
game.informPlayer(controller, "You're not able to cast "
|
||||||
+ card.getIdName() + " or you canceled the casting.");
|
+ card.getIdName() + " or you canceled the casting.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,12 @@
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
|
@ -25,8 +17,12 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author jeffwadsworth & L_J
|
* @author jeffwadsworth & L_J
|
||||||
*/
|
*/
|
||||||
public final class HellcarverDemon extends CardImpl {
|
public final class HellcarverDemon extends CardImpl {
|
||||||
|
@ -93,8 +89,7 @@ class HellcarverDemonEffect extends OneShotEffect {
|
||||||
Cards cardsToCast = new CardsImpl();
|
Cards cardsToCast = new CardsImpl();
|
||||||
cardsToCast.addAll(currentExiledCards);
|
cardsToCast.addAll(currentExiledCards);
|
||||||
boolean alreadyCast = false;
|
boolean alreadyCast = false;
|
||||||
while (!cardsToCast.isEmpty()
|
while (controller.canRespond() && !cardsToCast.isEmpty()) {
|
||||||
&& controller.canRespond()) {
|
|
||||||
if (!controller.chooseUse(outcome, "Cast a" + (alreadyCast ? "another" : "")
|
if (!controller.chooseUse(outcome, "Cast a" + (alreadyCast ? "another" : "")
|
||||||
+ " card exiled with " + sourceObject.getLogName()
|
+ " card exiled with " + sourceObject.getLogName()
|
||||||
+ " without paying its mana cost?", source, game)) {
|
+ " without paying its mana cost?", source, game)) {
|
||||||
|
@ -110,9 +105,8 @@ class HellcarverDemonEffect extends OneShotEffect {
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
if (cardWasCast) {
|
cardsToCast.remove(card);
|
||||||
cardsToCast.remove(card);
|
if (!cardWasCast) {
|
||||||
} else {
|
|
||||||
game.informPlayer(controller, "You're not able to cast "
|
game.informPlayer(controller, "You're not able to cast "
|
||||||
+ card.getIdName() + " or you canceled the casting.");
|
+ card.getIdName() + " or you canceled the casting.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -11,11 +10,7 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ExileTargetEffect;
|
import mage.abilities.effects.common.ExileTargetEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
|
@ -29,8 +24,9 @@ import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInExile;
|
import mage.target.common.TargetCardInExile;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class IzzetChemister extends CardImpl {
|
public final class IzzetChemister extends CardImpl {
|
||||||
|
@ -115,17 +111,16 @@ class IzzetChemisterCastFromExileEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
TargetCardInExile target = new TargetCardInExile(0, 1, filter, exileId, false);
|
TargetCardInExile target = new TargetCardInExile(0, 1, filter, exileId, false);
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
while (cardsToExile.count(filter, game) > 0
|
while (controller.canRespond()
|
||||||
|
&& cardsToExile.count(filter, game) > 0
|
||||||
&& controller.choose(Outcome.PlayForFree, cardsToExile, target, game)) {
|
&& controller.choose(Outcome.PlayForFree, cardsToExile, target, game)) {
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), game, true,
|
controller.cast(controller.chooseAbilityForCast(card, game, true), game, true,
|
||||||
new MageObjectReference(source.getSourceObject(game), game));
|
new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
if (cardWasCast) {
|
cardsToExile.remove(card);
|
||||||
cardsToExile.remove(card);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
break OuterLoop;
|
break OuterLoop;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
package mage.cards.j;
|
package mage.cards.j;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.DelayedTriggeredAbility;
|
import mage.abilities.DelayedTriggeredAbility;
|
||||||
|
@ -12,17 +7,8 @@ import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
import mage.constants.*;
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.FilterPlayer;
|
import mage.filter.FilterPlayer;
|
||||||
import mage.filter.common.FilterNonlandCard;
|
import mage.filter.common.FilterNonlandCard;
|
||||||
|
@ -42,9 +28,9 @@ import mage.target.common.TargetOpponent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class JaceArchitectOfThought extends CardImpl {
|
public final class JaceArchitectOfThought extends CardImpl {
|
||||||
|
@ -304,15 +290,18 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect {
|
||||||
}
|
}
|
||||||
FilterCard filter = new FilterCard("card to cast without mana costs");
|
FilterCard filter = new FilterCard("card to cast without mana costs");
|
||||||
TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId());
|
TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId());
|
||||||
while (jaceExileZone.count(filter, game) > 0
|
Cards cardsToChoose = new CardsImpl(jaceExileZone.getCards(game));
|
||||||
|
while (controller.canRespond()
|
||||||
|
&& cardsToChoose.count(filter, game) > 0
|
||||||
&& controller.chooseUse(Outcome.Benefit, "Cast another spell from exile zone for free?", source, game)) {
|
&& controller.chooseUse(Outcome.Benefit, "Cast another spell from exile zone for free?", source, game)) {
|
||||||
controller.choose(Outcome.PlayForFree, jaceExileZone, target, game);
|
controller.choose(Outcome.PlayForFree, cardsToChoose, target, game);
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
|
cardsToChoose.remove(card);
|
||||||
if (cardWasCast) {
|
if (cardWasCast) {
|
||||||
game.getExile().removeCard(card, game);
|
game.getExile().removeCard(card, game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ class MizzixsMasteryEffect extends OneShotEffect {
|
||||||
Card cardCopy = game.copyCard(card, source, source.getControllerId());
|
Card cardCopy = game.copyCard(card, source, source.getControllerId());
|
||||||
if (cardCopy.getSpellAbility().canChooseTarget(game)
|
if (cardCopy.getSpellAbility().canChooseTarget(game)
|
||||||
&& controller.chooseUse(outcome, "Cast copy of "
|
&& controller.chooseUse(outcome, "Cast copy of "
|
||||||
+ card.getName() + " without paying its mana cost?", source, game)) {
|
+ card.getName() + " without paying its mana cost?", source, game)) {
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + cardCopy.getId(), Boolean.TRUE);
|
game.getState().setValue("PlayFromNotOwnHandZone" + cardCopy.getId(), Boolean.TRUE);
|
||||||
controller.cast(controller.chooseAbilityForCast(cardCopy, game, true),
|
controller.cast(controller.chooseAbilityForCast(cardCopy, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
|
@ -126,8 +126,8 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect {
|
||||||
copiedCards.add(game.copyCard(card, source, source.getControllerId()));
|
copiedCards.add(game.copyCard(card, source, source.getControllerId()));
|
||||||
}
|
}
|
||||||
boolean continueCasting = true;
|
boolean continueCasting = true;
|
||||||
while (continueCasting
|
while (controller.canRespond()
|
||||||
&& controller.isInGame()
|
&& continueCasting
|
||||||
&& !copiedCards.isEmpty()) {
|
&& !copiedCards.isEmpty()) {
|
||||||
TargetCard targetCard = new TargetCard(0, 1, Zone.OUTSIDE,
|
TargetCard targetCard = new TargetCard(0, 1, Zone.OUTSIDE,
|
||||||
new FilterCard("copied card to cast without paying its mana cost?"));
|
new FilterCard("copied card to cast without paying its mana cost?"));
|
||||||
|
@ -137,13 +137,11 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect {
|
||||||
if (selectedCard != null
|
if (selectedCard != null
|
||||||
&& selectedCard.getSpellAbility().canChooseTarget(game)) {
|
&& selectedCard.getSpellAbility().canChooseTarget(game)) {
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + selectedCard.getId(), Boolean.TRUE);
|
game.getState().setValue("PlayFromNotOwnHandZone" + selectedCard.getId(), Boolean.TRUE);
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(selectedCard, game, true),
|
controller.cast(controller.chooseAbilityForCast(selectedCard, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + selectedCard.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + selectedCard.getId(), null);
|
||||||
if (cardWasCast) {
|
|
||||||
copiedCards.remove(selectedCard);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
copiedCards.remove(selectedCard);
|
||||||
}
|
}
|
||||||
continueCasting = !copiedCards.isEmpty()
|
continueCasting = !copiedCards.isEmpty()
|
||||||
&& controller.chooseUse(Outcome.Benefit, "Continue to choose copies and cast?", source, game);
|
&& controller.chooseUse(Outcome.Benefit, "Continue to choose copies and cast?", source, game);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.o;
|
package mage.cards.o;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -9,20 +8,23 @@ import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterInstantOrSorceryCard;
|
import mage.filter.common.FilterInstantOrSorceryCard;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.filter.predicate.mageobject.CardIdPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class OmnispellAdept extends CardImpl {
|
public final class OmnispellAdept extends CardImpl {
|
||||||
|
@ -80,29 +82,36 @@ class OmnispellAdeptEffect extends OneShotEffect {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Target target = new TargetCardInHand(filter);
|
FilterCard realFilter = filter.copy();
|
||||||
|
Target target = new TargetCardInHand(realFilter);
|
||||||
|
// choose one card until it possible to cast
|
||||||
if (target.canChoose(source.getSourceId(), controller.getId(), game)
|
if (target.canChoose(source.getSourceId(), controller.getId(), game)
|
||||||
&& controller.chooseUse(Outcome.PlayForFree, "Cast an instant or sorcery "
|
&& controller.chooseUse(Outcome.PlayForFree, "Cast an instant or sorcery "
|
||||||
+ "card from your hand without paying its mana cost?", source, game)) {
|
+ "card from your hand without paying its mana cost?", source, game)) {
|
||||||
Card cardToCast = null;
|
Card cardToCast;
|
||||||
boolean cancel = false;
|
|
||||||
while (controller.canRespond()
|
while (controller.canRespond()
|
||||||
&& !cancel) {
|
&& controller.chooseTarget(Outcome.PlayForFree, target, source, game)) {
|
||||||
if (controller.chooseTarget(Outcome.PlayForFree, target, source, game)) {
|
cardToCast = game.getCard(target.getFirstTarget());
|
||||||
cardToCast = game.getCard(target.getFirstTarget());
|
if (cardToCast == null) {
|
||||||
if (cardToCast != null
|
break;
|
||||||
&& cardToCast.getSpellAbility().canChooseTarget(game)) {
|
|
||||||
cancel = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cancel = true;
|
|
||||||
}
|
}
|
||||||
}
|
realFilter.add(Predicates.not(new CardIdPredicate(cardToCast.getId()))); // remove card from choose dialog (infinite fix)
|
||||||
if (cardToCast != null) {
|
|
||||||
|
if (!cardToCast.getSpellAbility().canChooseTarget(game)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + cardToCast.getId(), Boolean.TRUE);
|
game.getState().setValue("PlayFromNotOwnHandZone" + cardToCast.getId(), Boolean.TRUE);
|
||||||
controller.cast(controller.chooseAbilityForCast(cardToCast, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(cardToCast, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + cardToCast.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + cardToCast.getId(), null);
|
||||||
|
|
||||||
|
if (cardWasCast) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
game.informPlayer(controller, "You're not able to cast "
|
||||||
|
+ cardToCast.getIdName() + " or you canceled the casting.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.common.SpellMasteryCondition;
|
import mage.abilities.condition.common.SpellMasteryCondition;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
@ -22,8 +16,10 @@ import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class TalentOfTheTelepath extends CardImpl {
|
public final class TalentOfTheTelepath extends CardImpl {
|
||||||
|
@ -98,13 +94,13 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
|
|
||||||
TargetCard target = new TargetCard(Zone.LIBRARY, filter); // zone should be ignored here
|
TargetCard target = new TargetCard(Zone.LIBRARY, filter); // zone should be ignored here
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
while (numberOfSpells > 0
|
while (controller.canRespond()
|
||||||
|
&& numberOfSpells > 0
|
||||||
&& !cardsToCast.isEmpty()
|
&& !cardsToCast.isEmpty()
|
||||||
&& controller.chooseUse(outcome, "Cast an instant or sorcery card "
|
&& controller.chooseUse(outcome, "Cast an instant or sorcery card "
|
||||||
+ "from among them for free?", source, game)
|
+ "from among them for free?", source, game)
|
||||||
&& controller.choose(Outcome.PlayForFree, cardsToCast, target, game)) {
|
&& controller.choose(Outcome.PlayForFree, cardsToCast, target, game)) {
|
||||||
Card card = cardsToCast.get(target.getFirstTarget(), game);
|
Card card = cardsToCast.get(target.getFirstTarget(), game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
@ -112,11 +108,13 @@ class TalentOfTheTelepathEffect extends OneShotEffect {
|
||||||
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
|
||||||
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
game, true, new MageObjectReference(source.getSourceObject(game), game));
|
||||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||||
|
cardsToCast.remove(card);
|
||||||
if (cardWasCast) {
|
if (cardWasCast) {
|
||||||
numberOfSpells--;
|
numberOfSpells--;
|
||||||
cardsToCast.remove(card);
|
|
||||||
allCards.remove(card);
|
allCards.remove(card);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!controller.canRespond()) {
|
if (!controller.canRespond()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.v;
|
package mage.cards.v;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -19,8 +18,9 @@ import mage.target.common.TargetCardInExile;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public final class VillainousWealth extends CardImpl {
|
public final class VillainousWealth extends CardImpl {
|
||||||
|
@ -85,7 +85,8 @@ class VillainousWealthEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
TargetCardInExile target = new TargetCardInExile(0, 1, filter, exileId, false);
|
TargetCardInExile target = new TargetCardInExile(0, 1, filter, exileId, false);
|
||||||
target.setNotTarget(true);
|
target.setNotTarget(true);
|
||||||
while (cardsToExile.count(filter, game) > 0
|
while (controller.canRespond()
|
||||||
|
&& cardsToExile.count(filter, game) > 0
|
||||||
&& controller.choose(Outcome.PlayForFree, cardsToExile, target, game)) {
|
&& controller.choose(Outcome.PlayForFree, cardsToExile, target, game)) {
|
||||||
Card card = game.getCard(target.getFirstTarget());
|
Card card = game.getCard(target.getFirstTarget());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
|
Loading…
Reference in a new issue