mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
* Optimized handling and call of player.choose choice to prevent problems if a player disconnects or left a game (#4263).
This commit is contained in:
parent
b9ec919f06
commit
b752eacfaa
152 changed files with 1224 additions and 1681 deletions
|
@ -153,7 +153,7 @@ public class HumanPlayer extends PlayerImpl {
|
|||
// wait response open for answer process
|
||||
int numTimesWaiting = 0;
|
||||
while (!responseOpenedForAnswer && canRespond()) {
|
||||
numTimesWaiting ++;
|
||||
numTimesWaiting++;
|
||||
if (numTimesWaiting >= 300) {
|
||||
// game freezed -- need to report about error and continue to execute
|
||||
String s = "Game freezed in waitResponseOpen for user " + getName();
|
||||
|
@ -406,14 +406,14 @@ public class HumanPlayer extends PlayerImpl {
|
|||
}
|
||||
}
|
||||
updateGameStatePriority("choose(3)", game);
|
||||
while (!abort) {
|
||||
while (canRespond()) {
|
||||
prepareForResponse(game);
|
||||
if (!isExecutingMacro()) {
|
||||
game.fireChooseChoiceEvent(playerId, choice);
|
||||
}
|
||||
waitForResponse(game);
|
||||
String val = response.getString();
|
||||
if (val != null) {
|
||||
if (val != null && !val.isEmpty()) {
|
||||
if (choice.isKeyChoice()) {
|
||||
choice.setChoiceByKey(val);
|
||||
} else {
|
||||
|
|
|
@ -51,7 +51,7 @@ import mage.target.TargetPlayer;
|
|||
public class Addle extends CardImpl {
|
||||
|
||||
public Addle(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
|
||||
|
||||
// Choose a color. Target player reveals his or her hand and you choose a card of that color from it. That player discards that card.
|
||||
this.getSpellAbility().addEffect(new AddleEffect());
|
||||
|
@ -87,17 +87,14 @@ class AddleEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(outcome, choice, game);
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
||||
ObjectColor color = choice.getColor();
|
||||
if(color != null) {
|
||||
game.informPlayers(controller.getLogName() + " chooses " + color + '.');
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(color));
|
||||
Effect effect = new DiscardCardYouChooseTargetEffect(filter);
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
game.informPlayers(controller.getLogName() + " chooses " + color + '.');
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(color));
|
||||
Effect effect = new DiscardCardYouChooseTargetEffect(filter);
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import mage.players.Player;
|
|||
public class AngelicSkirmisher extends CardImpl {
|
||||
|
||||
public AngelicSkirmisher(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}");
|
||||
this.subtype.add(SubType.ANGEL);
|
||||
|
||||
this.power = new MageInt(4);
|
||||
|
@ -103,13 +103,8 @@ class AngelicSkirmisherEffect extends OneShotEffect {
|
|||
abilityChoices.add("Vigilance");
|
||||
abilityChoices.add("Lifelink");
|
||||
abilityChoice.setChoices(abilityChoices);
|
||||
while (!controller.choose(outcome, abilityChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Ability ability = null;
|
||||
if (abilityChoice.getChoice() != null) {
|
||||
if (controller.choose(outcome, abilityChoice, game)) {
|
||||
Ability ability = null;
|
||||
switch (abilityChoice.getChoice()) {
|
||||
case "First strike":
|
||||
ability = FirstStrikeAbility.getInstance();
|
||||
|
|
|
@ -157,13 +157,16 @@ class AnimationModuleEffect extends OneShotEffect {
|
|||
}
|
||||
choice.setChoices(choices);
|
||||
choice.setMessage("Choose a counter");
|
||||
controller.choose(Outcome.Benefit, choice, game);
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (counter.getName().equals(choice.getChoice())) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
permanent.addCounters(newCounter, source, game);
|
||||
break;
|
||||
if (controller.choose(Outcome.Benefit, choice, game)) {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (counter.getName().equals(choice.getChoice())) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
permanent.addCounters(newCounter, source, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,13 +187,16 @@ class AnimationModuleEffect extends OneShotEffect {
|
|||
}
|
||||
choice.setChoices(choices);
|
||||
choice.setMessage("Choose a counter");
|
||||
controller.choose(Outcome.Benefit, choice, game);
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
if (counter.getName().equals(choice.getChoice())) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
player.addCounters(newCounter, game);
|
||||
break;
|
||||
if (controller.choose(Outcome.Benefit, choice, game)) {
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
if (counter.getName().equals(choice.getChoice())) {
|
||||
Counter newCounter = new Counter(counter.getName());
|
||||
player.addCounters(newCounter, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
public class AphettoDredging extends CardImpl {
|
||||
|
||||
public AphettoDredging(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
|
||||
|
||||
// Return up to three target creature cards of the creature type of your choice from your graveyard to your hand.
|
||||
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
||||
|
@ -64,15 +64,9 @@ public class AphettoDredging extends CardImpl {
|
|||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
if (controller != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId()));
|
||||
while (!controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(ability.getSourceId()));
|
||||
if (controller != null && controller.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
|
||||
String chosenType = typeChoice.getChoice();
|
||||
|
||||
FilterCreatureCard filter = new FilterCreatureCard(chosenType + " cards");
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(chosenType)));
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, 3, filter));
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -53,6 +52,7 @@ import mage.target.common.TargetControlledPermanent;
|
|||
* @author Loki
|
||||
*/
|
||||
public class ApostlesBlessing extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifact or creature you control");
|
||||
|
||||
static {
|
||||
|
@ -62,8 +62,8 @@ public class ApostlesBlessing extends CardImpl {
|
|||
}
|
||||
|
||||
public ApostlesBlessing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W/P}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W/P}");
|
||||
|
||||
// ({W/P} can be paid with either {W} or 2 life.)
|
||||
// Target artifact or creature you control gains protection from artifacts or from the color of your choice until end of turn.
|
||||
this.getSpellAbility().addEffect(new ApostlesBlessingEffect());
|
||||
|
@ -82,46 +82,41 @@ public class ApostlesBlessing extends CardImpl {
|
|||
}
|
||||
|
||||
class ApostlesBlessingEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public ApostlesBlessingEffect() {
|
||||
super(Outcome.AddAbility);
|
||||
this.staticText = "Target artifact or creature you control gains protection from artifacts or from the color of your choice until end of turn";
|
||||
}
|
||||
|
||||
|
||||
public ApostlesBlessingEffect(final ApostlesBlessingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ApostlesBlessingEffect copy() {
|
||||
return new ApostlesBlessingEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceColorOrArtifact choice = new ChoiceColorOrArtifact();
|
||||
while (!choice.isChosen()) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
FilterCard protectionFilter = new FilterCard();
|
||||
if (choice.isArtifactSelected()) {
|
||||
protectionFilter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
} else {
|
||||
protectionFilter.add(new ColorPredicate(choice.getColor()));
|
||||
}
|
||||
controller.choose(outcome, choice, game);
|
||||
protectionFilter.setMessage(choice.getChoice());
|
||||
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(protectionAbility, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(getTargetPointer());
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
FilterCard protectionFilter = new FilterCard();
|
||||
if (choice.isArtifactSelected()) {
|
||||
protectionFilter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
} else {
|
||||
protectionFilter.add(new ColorPredicate(choice.getColor()));
|
||||
}
|
||||
protectionFilter.setMessage(choice.getChoice());
|
||||
ProtectionAbility protectionAbility = new ProtectionAbility(protectionFilter);
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(protectionAbility, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(getTargetPointer());
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ import mage.players.Player;
|
|||
public class AquamorphEntity extends CardImpl {
|
||||
|
||||
public AquamorphEntity(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
|
||||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
@ -136,11 +136,9 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl {
|
|||
choice.getChoices().add(choice15);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.Neutral, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Neutral, choice, game)) {
|
||||
discard();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int power = 0;
|
||||
|
|
|
@ -53,20 +53,20 @@ import mage.players.Player;
|
|||
public class ArchangelOfStrife extends CardImpl {
|
||||
|
||||
public ArchangelOfStrife(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}{W}");
|
||||
this.subtype.add(SubType.ANGEL);
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
|
||||
// As Archangel of Strife enters the battlefield, each player chooses war or peace.
|
||||
this.addAbility(new EntersBattlefieldAbility(new ArchangelOfStrifeChooseEffect(), "As Archangel of Strife enters the battlefield, each player chooses war or peace."));
|
||||
|
||||
|
||||
// Creatures controlled by players who chose war get +3/+0.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ArchangelOfStrifeWarEffect()));
|
||||
|
||||
|
||||
// Creatures controlled by players who chose peace get +0/+3.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ArchangelOfStrifePeaceEffect()));
|
||||
}
|
||||
|
@ -83,50 +83,43 @@ public class ArchangelOfStrife extends CardImpl {
|
|||
|
||||
class ArchangelOfStrifeChooseEffect extends OneShotEffect {
|
||||
|
||||
public ArchangelOfStrifeChooseEffect(){
|
||||
public ArchangelOfStrifeChooseEffect() {
|
||||
super(Outcome.Neutral);
|
||||
|
||||
|
||||
this.staticText = "each player chooses war or peace.";
|
||||
}
|
||||
|
||||
public ArchangelOfStrifeChooseEffect(ArchangelOfStrifeChooseEffect effect){
|
||||
|
||||
public ArchangelOfStrifeChooseEffect(ArchangelOfStrifeChooseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
|
||||
|
||||
if (sourcePermanent == null) {
|
||||
sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
||||
}
|
||||
|
||||
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
|
||||
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Select war or peace");
|
||||
choice.getChoices().add("war");
|
||||
choice.getChoices().add("peace");
|
||||
|
||||
while (!choice.isChosen()) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
player.choose(Outcome.Neutral, choice, game);
|
||||
|
||||
if (!player.choose(Outcome.Neutral, choice, game)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (choice.isChosen()) {
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourcePermanent.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice());
|
||||
}
|
||||
|
||||
game.getState().setValue(playerId + "_" + source.getSourceId() + "_modeChoice", choice.getChoice());
|
||||
sourcePermanent.addInfo("_" + playerId +"_modeChoice", "<font color = 'blue'>" + player.getName() + " chose: " + choice.getChoice() + "</font>", game);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(sourcePermanent.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice());
|
||||
}
|
||||
|
||||
game.getState().setValue(playerId + "_" + source.getSourceId() + "_modeChoice", choice.getChoice());
|
||||
sourcePermanent.addInfo("_" + playerId + "_modeChoice", "<font color = 'blue'>" + player.getName() + " chose: " + choice.getChoice() + "</font>", game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -137,29 +130,30 @@ class ArchangelOfStrifeChooseEffect extends OneShotEffect {
|
|||
public Effect copy() {
|
||||
return new ArchangelOfStrifeChooseEffect(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ArchangelOfStrifeWarEffect extends BoostAllEffect{
|
||||
class ArchangelOfStrifeWarEffect extends BoostAllEffect {
|
||||
|
||||
private static final FilterCreaturePermanent creaturefilter = new FilterCreaturePermanent("Creatures controlled by players who chose war");
|
||||
|
||||
public ArchangelOfStrifeWarEffect(){
|
||||
|
||||
public ArchangelOfStrifeWarEffect() {
|
||||
super(3, 0, Duration.WhileOnBattlefield, creaturefilter, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean selectedByRuntimeData(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent != null){
|
||||
if (permanent != null) {
|
||||
UUID controllerId = permanent.getControllerId();
|
||||
|
||||
String choosenMode = (String) game.getState().getValue(controllerId + "_" + source.getSourceId() + "_modeChoice");
|
||||
|
||||
return creaturefilter.match(permanent, game) && choosenMode != null && choosenMode.equals("war");
|
||||
return creaturefilter.match(permanent, game) && choosenMode != null && choosenMode.equals("war");
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public ArchangelOfStrifeWarEffect(ArchangelOfStrifeWarEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
@ -170,26 +164,27 @@ class ArchangelOfStrifeWarEffect extends BoostAllEffect{
|
|||
}
|
||||
}
|
||||
|
||||
class ArchangelOfStrifePeaceEffect extends BoostAllEffect{
|
||||
class ArchangelOfStrifePeaceEffect extends BoostAllEffect {
|
||||
|
||||
private static final FilterCreaturePermanent creaturefilter = new FilterCreaturePermanent("Creatures controlled by players who chose peace");
|
||||
|
||||
public ArchangelOfStrifePeaceEffect(){
|
||||
|
||||
public ArchangelOfStrifePeaceEffect() {
|
||||
super(0, 3, Duration.WhileOnBattlefield, creaturefilter, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean selectedByRuntimeData(Permanent permanent, Ability source, Game game) {
|
||||
if (permanent != null){
|
||||
if (permanent != null) {
|
||||
UUID controllerId = permanent.getControllerId();
|
||||
|
||||
String choosenMode = (String) game.getState().getValue(controllerId + "_" + source.getSourceId() + "_modeChoice");
|
||||
|
||||
return creaturefilter.match(permanent, game) && choosenMode != null && choosenMode.equals("peace");
|
||||
return creaturefilter.match(permanent, game) && choosenMode != null && choosenMode.equals("peace");
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public ArchangelOfStrifePeaceEffect(ArchangelOfStrifePeaceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
@ -198,4 +193,4 @@ class ArchangelOfStrifePeaceEffect extends BoostAllEffect{
|
|||
public ArchangelOfStrifePeaceEffect copy() {
|
||||
return new ArchangelOfStrifePeaceEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainProtectionFromColorTargetEffect;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -101,25 +100,27 @@ class BatheInLightEffect extends OneShotEffect {
|
|||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (target != null) {
|
||||
ChoiceColor colorChoice = new ChoiceColor();
|
||||
if (controller.choose(Outcome.Benefit, colorChoice, game)) {
|
||||
game.informPlayers(target.getName() + ": " + controller.getLogName() + " has chosen " + colorChoice.getChoice());
|
||||
game.getState().setValue(target.getId() + "_color", colorChoice.getColor());
|
||||
|
||||
ObjectColor protectColor = (ObjectColor) game.getState().getValue(target.getId() + "_color");
|
||||
if (protectColor != null) {
|
||||
ContinuousEffect effect = new ProtectionChosenColorTargetEffect();
|
||||
game.addEffect(effect, source);
|
||||
ObjectColor color = target.getColor(game);
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (permanent != target && permanent.getColor(game).shares(color)) {
|
||||
game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, colorChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(target.getName() + ": " + controller.getLogName() + " has chosen " + colorChoice.getChoice());
|
||||
game.getState().setValue(target.getId() + "_color", colorChoice.getColor());
|
||||
|
||||
ObjectColor protectColor = (ObjectColor) game.getState().getValue(target.getId() + "_color");
|
||||
if (protectColor != null) {
|
||||
ContinuousEffect effect = new ProtectionChosenColorTargetEffect();
|
||||
game.addEffect(effect, source);
|
||||
ObjectColor color = target.getColor(game);
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (permanent != target && permanent.getColor(game).shares(color)) {
|
||||
game.getState().setValue(permanent.getId() + "_color", colorChoice.getColor());
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -106,41 +106,41 @@ class BloodOathEffect extends OneShotEffect {
|
|||
if (player != null && opponent != null && sourceObject != null) {
|
||||
Choice choiceImpl = new ChoiceImpl();
|
||||
choiceImpl.setChoices(choice);
|
||||
while (player.canRespond() && !player.choose(Outcome.Neutral, choiceImpl, game)) {
|
||||
}
|
||||
CardType type = null;
|
||||
String choosenType = choiceImpl.getChoice();
|
||||
if (!player.choose(Outcome.Neutral, choiceImpl, game)) {
|
||||
CardType type = null;
|
||||
String choosenType = choiceImpl.getChoice();
|
||||
|
||||
if (choosenType.equals(CardType.ARTIFACT.toString())) {
|
||||
type = CardType.ARTIFACT;
|
||||
} else if (choosenType.equals(CardType.LAND.toString())) {
|
||||
type = CardType.LAND;
|
||||
} else if (choosenType.equals(CardType.CREATURE.toString())) {
|
||||
type = CardType.CREATURE;
|
||||
} else if (choosenType.equals(CardType.ENCHANTMENT.toString())) {
|
||||
type = CardType.ENCHANTMENT;
|
||||
} else if (choosenType.equals(CardType.INSTANT.toString())) {
|
||||
type = CardType.INSTANT;
|
||||
} else if (choosenType.equals(CardType.SORCERY.toString())) {
|
||||
type = CardType.SORCERY;
|
||||
} else if (choosenType.equals(CardType.PLANESWALKER.toString())) {
|
||||
type = CardType.PLANESWALKER;
|
||||
} else if (choosenType.equals(CardType.TRIBAL.toString())) {
|
||||
type = CardType.TRIBAL;
|
||||
}
|
||||
if (type != null) {
|
||||
Cards hand = opponent.getHand();
|
||||
opponent.revealCards(sourceObject.getIdName(), hand, game);
|
||||
Set<Card> cards = hand.getCards(game);
|
||||
int damageToDeal = 0;
|
||||
for (Card card : cards) {
|
||||
if (card != null && card.getCardType().contains(type)) {
|
||||
damageToDeal += 3;
|
||||
}
|
||||
if (choosenType.equals(CardType.ARTIFACT.toString())) {
|
||||
type = CardType.ARTIFACT;
|
||||
} else if (choosenType.equals(CardType.LAND.toString())) {
|
||||
type = CardType.LAND;
|
||||
} else if (choosenType.equals(CardType.CREATURE.toString())) {
|
||||
type = CardType.CREATURE;
|
||||
} else if (choosenType.equals(CardType.ENCHANTMENT.toString())) {
|
||||
type = CardType.ENCHANTMENT;
|
||||
} else if (choosenType.equals(CardType.INSTANT.toString())) {
|
||||
type = CardType.INSTANT;
|
||||
} else if (choosenType.equals(CardType.SORCERY.toString())) {
|
||||
type = CardType.SORCERY;
|
||||
} else if (choosenType.equals(CardType.PLANESWALKER.toString())) {
|
||||
type = CardType.PLANESWALKER;
|
||||
} else if (choosenType.equals(CardType.TRIBAL.toString())) {
|
||||
type = CardType.TRIBAL;
|
||||
}
|
||||
if (type != null) {
|
||||
Cards hand = opponent.getHand();
|
||||
opponent.revealCards(sourceObject.getIdName(), hand, game);
|
||||
Set<Card> cards = hand.getCards(game);
|
||||
int damageToDeal = 0;
|
||||
for (Card card : cards) {
|
||||
if (card != null && card.getCardType().contains(type)) {
|
||||
damageToDeal += 3;
|
||||
}
|
||||
}
|
||||
game.informPlayers(sourceObject.getLogName() + " deals " + (damageToDeal == 0 ? "no" : "" + damageToDeal) + " damage to " + opponent.getLogName());
|
||||
opponent.damage(damageToDeal, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
game.informPlayers(sourceObject.getLogName() + " deals " + (damageToDeal == 0 ? "no" : "" + damageToDeal) + " damage to " + opponent.getLogName());
|
||||
opponent.damage(damageToDeal, source.getSourceId(), game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -45,8 +46,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
|
@ -96,37 +95,28 @@ class BloodlineShamanEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null) {
|
||||
// Choose a creature type.
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
while (!controller.choose(outcome, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (typeChoice.getChoice() != null) {
|
||||
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
|
||||
}
|
||||
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
if (controller != null && controller.choose(outcome, typeChoice, game)) {
|
||||
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
|
||||
FilterCard filterSubtype = new FilterCard();
|
||||
filterSubtype.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
|
||||
// Reveal the top card of your library.
|
||||
if (controller.getLibrary().hasCards()) {
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
Card card = controller.getLibrary().getFromTop(game);
|
||||
Cards cards = new CardsImpl(card);
|
||||
controller.revealCards(sourceObject.getIdName(), cards, game);
|
||||
|
||||
if (card != null) {
|
||||
// If that card is a creature card of the chosen type, put it into your hand.
|
||||
if (filterSubtype.match(card, game)) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
// Otherwise, put it into your graveyard.
|
||||
} else {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
if (card != null) {
|
||||
// If that card is a creature card of the chosen type, put it into your hand.
|
||||
if (filterSubtype.match(card, game)) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
// Otherwise, put it into your graveyard.
|
||||
} else {
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -52,20 +52,20 @@ import mage.target.common.TargetControlledCreaturePermanent;
|
|||
* @author Topher
|
||||
*/
|
||||
public class BurntOffering extends CardImpl {
|
||||
|
||||
|
||||
public BurntOffering(UUID ownerID, CardSetInfo setInfo) {
|
||||
super(ownerID, setInfo, new CardType[]{CardType.INSTANT},"{B}");
|
||||
|
||||
super(ownerID, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
|
||||
|
||||
//As an additional cost to cast Burnt Offering, sacrifice a creature.
|
||||
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
||||
//Add to your mana pool an amount of {B} and/or {R} equal to the sacrificed creature's converted mana cost.
|
||||
this.getSpellAbility().addEffect(new BurntOfferingEffect());
|
||||
}
|
||||
|
||||
|
||||
public BurntOffering(final BurntOffering card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BurntOffering copy() {
|
||||
return new BurntOffering(this);
|
||||
|
@ -73,17 +73,17 @@ public class BurntOffering extends CardImpl {
|
|||
}
|
||||
|
||||
class BurntOfferingEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public BurntOfferingEffect() {
|
||||
super(Outcome.PutManaInPool);
|
||||
this.staticText = "Add X mana in any combination of {B} and/or {R} to your mana pool,"
|
||||
+ " where X is the sacrificed creature's converted mana cost";
|
||||
}
|
||||
|
||||
|
||||
public BurntOfferingEffect(final BurntOfferingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
@ -94,20 +94,18 @@ class BurntOfferingEffect extends OneShotEffect {
|
|||
choices.add("Black");
|
||||
manaChoice.setChoices(choices);
|
||||
manaChoice.setMessage("Select color of mana to add");
|
||||
|
||||
|
||||
int xValue = getCost(source);
|
||||
|
||||
for(int i = 0; i < xValue; i++) {
|
||||
|
||||
for (int i = 0; i < xValue; i++) {
|
||||
Mana mana = new Mana();
|
||||
while(!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
if(!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(manaChoice.getChoice() == null) { //Can happen if player leaves game
|
||||
if (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
switch(manaChoice.getChoice()) {
|
||||
if (manaChoice.getChoice() == null) { //Can happen if player leaves game
|
||||
return false;
|
||||
}
|
||||
switch (manaChoice.getChoice()) {
|
||||
case "Red":
|
||||
mana.increaseRed();
|
||||
break;
|
||||
|
@ -126,18 +124,19 @@ class BurntOfferingEffect extends OneShotEffect {
|
|||
public Effect copy() {
|
||||
return new BurntOfferingEffect(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to determine the CMC of the sacrificed creature.
|
||||
*
|
||||
* @param sourceAbility
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
private int getCost(Ability sourceAbility) {
|
||||
for(Cost cost : sourceAbility.getCosts()) {
|
||||
if(cost instanceof SacrificeTargetCost) {
|
||||
for (Cost cost : sourceAbility.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost) {
|
||||
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
|
||||
int totalCMC = 0;
|
||||
for(Permanent permanent : sacrificeCost.getPermanents()) {
|
||||
for (Permanent permanent : sacrificeCost.getPermanents()) {
|
||||
totalCMC += permanent.getConvertedManaCost();
|
||||
}
|
||||
return totalCMC;
|
||||
|
|
|
@ -107,13 +107,10 @@ class ButcherOfTheHordeEffect extends OneShotEffect {
|
|||
abilities.add(LifelinkAbility.getInstance().getRule());
|
||||
abilities.add(HasteAbility.getInstance().getRule());
|
||||
abilityChoice.setChoices(abilities);
|
||||
while (!abilityChoice.isChosen()) {
|
||||
controller.choose(Outcome.AddAbility, abilityChoice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
controller.choose(Outcome.AddAbility, abilityChoice, game);
|
||||
if (!abilityChoice.isChosen()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String chosen = abilityChoice.getChoice();
|
||||
Ability ability = null;
|
||||
if (VigilanceAbility.getInstance().getRule().equals(chosen)) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -46,8 +47,6 @@ import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
@ -128,13 +127,8 @@ class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but t
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(mageObject);
|
||||
while (!controller.choose(outcome, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(mageObject);
|
||||
if (controller != null && mageObject != null && controller.choose(outcome, typeChoice, game)) {
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -65,7 +63,7 @@ import mage.util.CardUtil;
|
|||
public class CallousOppressor extends CardImpl {
|
||||
|
||||
public CallousOppressor(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
|
||||
this.subtype.add(SubType.CEPHALID);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
@ -97,20 +95,20 @@ public class CallousOppressor extends CardImpl {
|
|||
}
|
||||
|
||||
class CallousOppressorFilter extends FilterCreaturePermanent {
|
||||
|
||||
|
||||
public CallousOppressorFilter() {
|
||||
super("creature that isn't of the chosen type");
|
||||
}
|
||||
|
||||
|
||||
public CallousOppressorFilter(final CallousOppressorFilter filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CallousOppressorFilter copy() {
|
||||
return new CallousOppressorFilter(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
|
||||
if (super.match(permanent, sourceId, playerId, game)) {
|
||||
|
@ -122,7 +120,7 @@ class CallousOppressorFilter extends FilterCreaturePermanent {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class CallousOppressorChooseCreatureTypeEffect extends OneShotEffect {
|
||||
|
@ -156,10 +154,8 @@ class CallousOppressorChooseCreatureTypeEffect extends OneShotEffect {
|
|||
if (opponent != null && mageObject != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(mageObject);
|
||||
typeChoice.setMessage("Choose creature type");
|
||||
while (!opponent.choose(outcome, typeChoice, game)) {
|
||||
if (!opponent.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!opponent.choose(outcome, typeChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
if (typeChoice.getChoice() == null) {
|
||||
return false;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
|
@ -47,8 +48,6 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
|
@ -152,14 +151,8 @@ class CarpetOfFlowersEffect extends ManaEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.Benefit, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (controller != null && controller.choose(Outcome.Benefit, choice, game)) {
|
||||
int count = game.getBattlefield().count(filter, source.getSourceId(), source.getTargets().getFirstTarget(), game);
|
||||
if (count > 0) {
|
||||
Mana mana = new Mana();
|
||||
|
|
|
@ -182,12 +182,7 @@ class ChromeMoxManaEffect extends ManaEffect {
|
|||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
while (!player.choose(outcome, choice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (choice.getChoice() == null) {
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class Clockspinning extends CardImpl {
|
||||
|
||||
public Clockspinning(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}");
|
||||
|
||||
// Buyback {3}
|
||||
this.addAbility(new BuybackAbility("{3}"));
|
||||
|
@ -106,8 +106,12 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
|
|||
}
|
||||
choice.setChoices(choices);
|
||||
choice.setMessage("Choose a counter type to add to " + permanent.getName());
|
||||
controller.choose(Outcome.Neutral, choice, game);
|
||||
counterName = choice.getChoice();
|
||||
if (controller.choose(Outcome.Neutral, choice, game)) {
|
||||
counterName = choice.getChoice();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
for (Counter counter : permanent.getCounters(game).values()) {
|
||||
if (counter.getCount() > 0) {
|
||||
|
@ -134,8 +138,11 @@ class ClockspinningAddOrRemoveCounterEffect extends OneShotEffect {
|
|||
}
|
||||
choice.setChoices(choices);
|
||||
choice.setMessage("Choose a counter type to add to " + card.getName());
|
||||
controller.choose(Outcome.Neutral, choice, game);
|
||||
counterName = choice.getChoice();
|
||||
if (controller.choose(Outcome.Neutral, choice, game)) {
|
||||
counterName = choice.getChoice();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
for (Counter counter : card.getCounters(game).values()) {
|
||||
if (counter.getCount() > 0) {
|
||||
|
|
|
@ -55,7 +55,7 @@ import mage.players.Player;
|
|||
public class CoalitionRelic extends CardImpl {
|
||||
|
||||
public CoalitionRelic(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// {tap}: Add one mana of any color to your mana pool.
|
||||
this.addAbility(new AnyColorManaAbility());
|
||||
|
@ -101,11 +101,8 @@ class CoalitionRelicEffect extends OneShotEffect {
|
|||
Mana mana = new Mana();
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
for (int i = 0; i < chargeCounters; i++) {
|
||||
while (!choice.isChosen()) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
player.choose(outcome, choice, game);
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
choice.increaseMana(mana);
|
||||
choice.clearChoice();
|
||||
|
|
|
@ -102,10 +102,8 @@ class ConundrumSphinxEffect extends OneShotEffect {
|
|||
if (player.getLibrary().hasCards()) {
|
||||
cardChoice.clearChoice();
|
||||
cardChoice.setMessage("Name a card");
|
||||
while (!player.choose(Outcome.DrawCard, cardChoice, game) && player.canRespond()) {
|
||||
if (!player.canRespond()) {
|
||||
continue Players;
|
||||
}
|
||||
if (!player.choose(Outcome.DrawCard, cardChoice, game) && player.canRespond()) {
|
||||
continue Players;
|
||||
}
|
||||
String cardName = cardChoice.getChoice();
|
||||
game.informPlayers(sourceObject.getLogName() + ", player: " + player.getLogName() + ", named: [" + cardName + ']');
|
||||
|
|
|
@ -138,37 +138,34 @@ class CorruptedGrafstoneManaEffect extends ManaEffect {
|
|||
}
|
||||
if (!choice.getChoices().isEmpty()) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (player != null) {
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
player.choose(outcome, choice, game);
|
||||
}
|
||||
if (choice.getChoice() != null) {
|
||||
Mana computedMana = new Mana();
|
||||
switch (choice.getChoice()) {
|
||||
case "Black":
|
||||
computedMana.setBlack(1);
|
||||
break;
|
||||
case "Blue":
|
||||
computedMana.setBlue(1);
|
||||
break;
|
||||
case "Red":
|
||||
computedMana.setRed(1);
|
||||
break;
|
||||
case "Green":
|
||||
computedMana.setGreen(1);
|
||||
break;
|
||||
case "White":
|
||||
computedMana.setWhite(1);
|
||||
break;
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
checkToFirePossibleEvents(computedMana, game, source);
|
||||
player.getManaPool().addMana(computedMana, game, source);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
Mana computedManaHere = new Mana();
|
||||
switch (choice.getChoice()) {
|
||||
case "Black":
|
||||
computedManaHere.setBlack(1);
|
||||
break;
|
||||
case "Blue":
|
||||
computedManaHere.setBlue(1);
|
||||
break;
|
||||
case "Red":
|
||||
computedManaHere.setRed(1);
|
||||
break;
|
||||
case "Green":
|
||||
computedManaHere.setGreen(1);
|
||||
break;
|
||||
case "White":
|
||||
computedManaHere.setWhite(1);
|
||||
break;
|
||||
}
|
||||
checkToFirePossibleEvents(computedManaHere, game, source);
|
||||
player.getManaPool().addMana(computedManaHere, game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
|
@ -43,8 +44,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -52,7 +51,7 @@ import java.util.UUID;
|
|||
public class CranialExtraction extends CardImpl {
|
||||
|
||||
public CranialExtraction(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
|
||||
this.subtype.add(SubType.ARCANE);
|
||||
|
||||
/* Name a nonland card. Search target player's graveyard, hand, and library for
|
||||
|
@ -92,10 +91,8 @@ class CranialExtractionEffect extends SearchTargetGraveyardHandLibraryForCardNam
|
|||
cardChoice.clearChoice();
|
||||
cardChoice.setMessage("Name a nonland card");
|
||||
|
||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
String cardName = cardChoice.getChoice();
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
|
|
|
@ -51,8 +51,7 @@ import mage.players.Player;
|
|||
public class CreepingRenaissance extends CardImpl {
|
||||
|
||||
public CreepingRenaissance(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{G}{G}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}{G}");
|
||||
|
||||
// Choose a permanent type. Return all cards of the chosen type from your graveyard to your hand.
|
||||
this.getSpellAbility().addEffect(new CreepingRenaissanceEffect());
|
||||
|
@ -95,25 +94,24 @@ class CreepingRenaissanceEffect extends OneShotEffect {
|
|||
typeChoice.getChoices().add(CardType.LAND.toString());
|
||||
typeChoice.getChoices().add(CardType.PLANESWALKER.toString());
|
||||
|
||||
while (controller.canRespond() && !controller.choose(Outcome.ReturnToHand, typeChoice, game)) {
|
||||
}
|
||||
|
||||
String typeName = typeChoice.getChoice();
|
||||
CardType chosenType = null;
|
||||
for (CardType cardType : CardType.values()) {
|
||||
if (cardType.toString().equals(typeName)) {
|
||||
chosenType = cardType;
|
||||
}
|
||||
}
|
||||
if (chosenType != null) {
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
if (card.getCardType().contains(chosenType)) {
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
if (controller.choose(Outcome.ReturnToHand, typeChoice, game)) {
|
||||
String typeName = typeChoice.getChoice();
|
||||
CardType chosenType = null;
|
||||
for (CardType cardType : CardType.values()) {
|
||||
if (cardType.toString().equals(typeName)) {
|
||||
chosenType = cardType;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (chosenType != null) {
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
if (card.getCardType().contains(chosenType)) {
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -43,8 +42,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -54,12 +53,12 @@ import mage.players.Player;
|
|||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
||||
*
|
||||
*/
|
||||
public class CrosisThePurger extends CardImpl {
|
||||
|
||||
public CrosisThePurger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{B}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}{R}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
this.power = new MageInt(6);
|
||||
|
@ -69,7 +68,7 @@ public class CrosisThePurger extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Whenever Crosis, the Purger deals combat damage to a player, you may pay {2}{B}. If you do, choose a color, then that player reveals his or her hand and discards all cards of that color.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid(new CrosisThePurgerEffect(),
|
||||
new ManaCostsImpl("{2}{B}")), false, true));
|
||||
new ManaCostsImpl("{2}{B}")), false, true));
|
||||
}
|
||||
|
||||
public CrosisThePurger(final CrosisThePurger card) {
|
||||
|
@ -101,23 +100,23 @@ class CrosisThePurgerEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if(player != null) {
|
||||
if (player != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
player.choose(outcome, choice, game);
|
||||
if(choice.getColor() != null) {
|
||||
if (choice.isChosen()) {
|
||||
game.informPlayers(new StringBuilder(player.getLogName()).append(" chooses ").append(choice.getColor()).toString());
|
||||
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
List<Card> toDiscard = new ArrayList<>();
|
||||
for(UUID cardId : damagedPlayer.getHand()) {
|
||||
for (UUID cardId : damagedPlayer.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if(filter.match(card, game)) {
|
||||
if (filter.match(card, game)) {
|
||||
toDiscard.add(card);
|
||||
}
|
||||
}
|
||||
for(Card card: toDiscard) {
|
||||
for (Card card : toDiscard) {
|
||||
damagedPlayer.discard(card, source, game);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -39,8 +39,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -54,7 +54,7 @@ import mage.players.Player;
|
|||
public class DarigaazTheIgniter extends CardImpl {
|
||||
|
||||
public DarigaazTheIgniter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{R}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{R}{G}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
this.power = new MageInt(6);
|
||||
|
@ -98,30 +98,20 @@ class DarigaazTheIgniterEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceColor choice = new ChoiceColor(true);
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(outcome, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (choice.getColor() != null) {
|
||||
game.informPlayers(controller.getLogName() + " chooses " + choice.getColor());
|
||||
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (damagedPlayer != null) {
|
||||
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
int damage = damagedPlayer.getHand().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
if (damage > 0) {
|
||||
damagedPlayer.damage(damage, source.getSourceId(), game, false, true);
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor(true);
|
||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
||||
game.informPlayers(controller.getLogName() + " chooses " + choice.getColor());
|
||||
Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
if (damagedPlayer != null) {
|
||||
damagedPlayer.revealCards("hand of " + damagedPlayer.getName(), damagedPlayer.getHand(), game);
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
int damage = damagedPlayer.getHand().count(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
if (damage > 0) {
|
||||
damagedPlayer.damage(damage, source.getSourceId(), game, false, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -135,10 +135,8 @@ class DawnsReflectionManaEffect extends ManaEffect {
|
|||
Mana mana = new Mana();
|
||||
for (int i = 0; i < x; i++) {
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
while (!controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
if (!controller.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
return false;
|
||||
}
|
||||
choiceColor.increaseMana(mana);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ import mage.players.Player;
|
|||
public class DemonicConsultation extends CardImpl {
|
||||
|
||||
public DemonicConsultation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
|
||||
|
||||
// Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card. Put that card into your hand and exile all other cards revealed this way.
|
||||
this.getSpellAbility().addEffect(new DemonicConsultationEffect());
|
||||
|
@ -88,10 +88,8 @@ class DemonicConsultationEffect extends OneShotEffect {
|
|||
// Name a card.
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setChoices(CardRepository.instance.getNames());
|
||||
while (!controller.choose(Outcome.Benefit, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
String name = choice.getChoice();
|
||||
game.informPlayers("Card named: " + name);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -43,8 +44,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
@ -52,8 +51,7 @@ import java.util.UUID;
|
|||
public class DistantMelody extends CardImpl {
|
||||
|
||||
public DistantMelody(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
||||
|
||||
// Choose a creature type. Draw a card for each permanent you control of that type.
|
||||
this.getSpellAbility().addEffect(new DistantMelodyEffect());
|
||||
|
@ -70,31 +68,26 @@ public class DistantMelody extends CardImpl {
|
|||
}
|
||||
|
||||
class DistantMelodyEffect extends OneShotEffect {
|
||||
|
||||
|
||||
DistantMelodyEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
this.staticText = "Choose a creature type. Draw a card for each permanent you control of that type";
|
||||
}
|
||||
|
||||
|
||||
DistantMelodyEffect(final DistantMelodyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DistantMelodyEffect copy() {
|
||||
return new DistantMelodyEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
if (controller != null && controller.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
return new DrawCardSourceControllerEffect(new PermanentsOnBattlefieldCount(filter)).apply(game, source);
|
||||
|
|
|
@ -41,8 +41,8 @@ import mage.cards.repository.CardRepository;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -56,7 +56,7 @@ public class DiviningWitch extends CardImpl {
|
|||
|
||||
public DiviningWitch(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
|
||||
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SPELLSHAPER);
|
||||
this.power = new MageInt(1);
|
||||
|
@ -78,7 +78,7 @@ public class DiviningWitch extends CardImpl {
|
|||
return new DiviningWitch(this);
|
||||
}
|
||||
|
||||
private static class DiviningWitchEffect extends OneShotEffect {
|
||||
private static class DiviningWitchEffect extends OneShotEffect {
|
||||
|
||||
DiviningWitchEffect() {
|
||||
super(Outcome.Benefit);
|
||||
|
@ -102,10 +102,8 @@ public class DiviningWitch extends CardImpl {
|
|||
// Name a card.
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setChoices(CardRepository.instance.getNames());
|
||||
while (!controller.choose(Outcome.Benefit, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
String name = choice.getChoice();
|
||||
game.informPlayers("Card named: " + name);
|
||||
|
@ -137,5 +135,3 @@ public class DiviningWitch extends CardImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -109,8 +109,7 @@ class BecomesColorOrColorsEnchantedEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
controller.choose(Outcome.Benefit, choiceColor, game);
|
||||
if (!controller.canRespond()) {
|
||||
if (!controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
return false;
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
|
|
|
@ -40,8 +40,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -55,7 +55,7 @@ import mage.players.Player;
|
|||
public class DromarTheBanisher extends CardImpl {
|
||||
|
||||
public DromarTheBanisher(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{U}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{U}{B}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
|
||||
|
@ -100,8 +100,7 @@ class DromarTheBanisherEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
player.choose(outcome, choice, game);
|
||||
if (choice.getColor() != null) {
|
||||
if (player.choose(outcome, choice, game)) {
|
||||
game.informPlayers(player.getLogName() + " chooses " + choice.getChoice());
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -41,8 +44,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
|
@ -51,10 +54,6 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
@ -62,7 +61,7 @@ import java.util.UUID;
|
|||
public class DwarvenArmorer extends CardImpl {
|
||||
|
||||
public DwarvenArmorer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
|
||||
this.subtype.add(SubType.DWARF);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(2);
|
||||
|
@ -95,8 +94,8 @@ class DwarvenArmorerEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DwarvenArmorerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Put a +0/+1 counter or a +1/+0 counter on target creature.";
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Put a +0/+1 counter or a +1/+0 counter on target creature.";
|
||||
}
|
||||
|
||||
public DwarvenArmorerEffect(final DwarvenArmorerEffect effect) {
|
||||
|
@ -111,19 +110,16 @@ class DwarvenArmorerEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller != null) {
|
||||
if (controller != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose type of counter to add");
|
||||
choice.setChoices(choices);
|
||||
while(!controller.choose(outcome, choice, game)) {
|
||||
if(controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
Counter counter = choice.getChoice().equals("+0/+1") ? CounterType.P0P1.createInstance() : CounterType.P1P0.createInstance();
|
||||
Effect effect = new AddCountersTargetEffect(counter);
|
||||
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
Counter counter = choice.getChoice().equals("+0/+1") ? CounterType.P0P1.createInstance() : CounterType.P1P0.createInstance();
|
||||
Effect effect = new AddCountersTargetEffect(counter);
|
||||
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,23 +31,23 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -125,13 +125,10 @@ class ElementalResonanceEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl();
|
||||
choice.setMessage("Choose a mana combination");
|
||||
choice.getChoices().addAll(manaOptions);
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
manaToAdd = choice.getChoice();
|
||||
if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
manaToAdd = choice.getChoice();
|
||||
} else if (manaOptions.size() == 1) {
|
||||
manaToAdd = manaOptions.get(0);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class ElsewhereFlaskEffect extends OneShotEffect {
|
|||
|
||||
public ElsewhereFlaskEffect() {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "Choose a basic land type. Each land you control becomes that type until end of turn";
|
||||
this.staticText = "Choose a basic land type. Each land you control becomes that type until end of turn";
|
||||
}
|
||||
|
||||
public ElsewhereFlaskEffect(final ElsewhereFlaskEffect effect) {
|
||||
|
@ -94,11 +94,9 @@ class ElsewhereFlaskEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice choice = new ChoiceBasicLandType();
|
||||
if (player.choose(Outcome.Neutral, choice, game)) {
|
||||
game.getState().setValue(source.getSourceId().toString() + "_ElsewhereFlask", choice.getChoice());
|
||||
}
|
||||
Choice choice = new ChoiceBasicLandType();
|
||||
if (player != null && player.choose(Outcome.Neutral, choice, game)) {
|
||||
game.getState().setValue(source.getSourceId().toString() + "_ElsewhereFlask", choice.getChoice());
|
||||
game.addEffect(new ElsewhereFlaskContinuousEffect(), source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ import mage.players.Player;
|
|||
public class ElvishSoultiller extends CardImpl {
|
||||
|
||||
public ElvishSoultiller(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
|
||||
this.subtype.add(SubType.ELF);
|
||||
this.subtype.add(SubType.MUTANT);
|
||||
this.power = new MageInt(5);
|
||||
|
@ -95,13 +95,8 @@ class ElvishSoultillerEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(mageObject);
|
||||
while (!controller.choose(outcome, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(mageObject);
|
||||
if (controller != null && mageObject != null && controller.choose(outcome, typeChoice, game)) {
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import mage.players.Player;
|
|||
public class Extinction extends CardImpl {
|
||||
|
||||
public Extinction(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||
|
||||
// Destroy all creatures of the creature type of your choice.
|
||||
this.getSpellAbility().addEffect(new ExtinctionEffect());
|
||||
|
@ -82,16 +82,9 @@ class ExtinctionEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
while (!player.choose(outcome, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (typeChoice.getChoice() != null) {
|
||||
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
if (player != null && player.choose(outcome, typeChoice, game)) {
|
||||
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
|
||||
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent();
|
||||
filterCreaturePermanent.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) {
|
||||
|
|
|
@ -92,11 +92,8 @@ class FaithsShieldEffect extends OneShotEffect {
|
|||
if (controller != null && mageObject != null) {
|
||||
if (FatefulHourCondition.instance.apply(game, source)) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.Protect, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Protect, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
if (choice.getColor() != null) {
|
||||
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -42,10 +45,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
@ -53,7 +52,7 @@ import java.util.UUID;
|
|||
public class Fatespinner extends CardImpl {
|
||||
|
||||
public Fatespinner(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.power = new MageInt(1);
|
||||
|
@ -105,10 +104,8 @@ class FatespinnerChooseEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose phase or step to skip");
|
||||
choice.setChoices(choices);
|
||||
while (!player.choose(outcome, choice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
String chosenPhase = choice.getChoice();
|
||||
game.informPlayers(player.getLogName() + " has chosen to skip " + chosenPhase.toLowerCase() + '.');
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -43,18 +46,14 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
@ -62,7 +61,7 @@ import java.util.UUID;
|
|||
public class FlowstoneSculpture extends CardImpl {
|
||||
|
||||
public FlowstoneSculpture(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{6}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
|
||||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
@ -100,7 +99,7 @@ class FlowstoneSculptureEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public FlowstoneSculptureEffect(final FlowstoneSculptureEffect effect) {
|
||||
super(effect);
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,36 +110,33 @@ class FlowstoneSculptureEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if(controller != null) {
|
||||
if (controller != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose ability to add");
|
||||
choice.setChoices(choices);
|
||||
while(!controller.choose(outcome, choice, game)) {
|
||||
if(controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String chosen = choice.getChoice();
|
||||
if(chosen.equals("+1/+1 counter")) {
|
||||
return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
|
||||
}
|
||||
else {
|
||||
Ability gainedAbility;
|
||||
switch (chosen) {
|
||||
case "Flying":
|
||||
gainedAbility = FlyingAbility.getInstance();
|
||||
break;
|
||||
case "First strike":
|
||||
gainedAbility = FirstStrikeAbility.getInstance();
|
||||
break;
|
||||
default:
|
||||
gainedAbility = TrampleAbility.getInstance();
|
||||
break;
|
||||
}
|
||||
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source);
|
||||
return true;
|
||||
}
|
||||
String chosen = choice.getChoice();
|
||||
if (chosen.equals("+1/+1 counter")) {
|
||||
return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source);
|
||||
} else {
|
||||
Ability gainedAbility;
|
||||
switch (chosen) {
|
||||
case "Flying":
|
||||
gainedAbility = FlyingAbility.getInstance();
|
||||
break;
|
||||
case "First strike":
|
||||
gainedAbility = FirstStrikeAbility.getInstance();
|
||||
break;
|
||||
default:
|
||||
gainedAbility = TrampleAbility.getInstance();
|
||||
break;
|
||||
}
|
||||
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -51,7 +51,7 @@ import mage.util.CardUtil;
|
|||
public class Fluctuator extends CardImpl {
|
||||
|
||||
public Fluctuator(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// Cycling abilities you activate cost you up to {2} less to activate.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FluctuatorEffect()));
|
||||
|
@ -112,7 +112,8 @@ class FluctuatorEffect extends CostModificationEffectImpl {
|
|||
|
||||
if (controller.choose(Outcome.Benefit, choice, game)) {
|
||||
reduce = Integer.parseInt(choice.getChoice());
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
CardUtil.reduceCost(abilityToModify, reduce);
|
||||
|
|
|
@ -56,7 +56,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
|
|||
public class FoodChain extends CardImpl {
|
||||
|
||||
public FoodChain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||
|
||||
// Exile a creature you control: Add X mana of any one color to your mana pool, where X is the exiled creature's converted mana cost plus one. Spend this mana only to cast creature spells.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new FoodChainManaEffect(), new ExileTargetCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("a creature you control"), true)));
|
||||
|
@ -114,8 +114,7 @@ class FoodChainManaEffect extends ManaEffect {
|
|||
}
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
if (choice.getColor() == null) {
|
||||
if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
Mana chosen = choice.getMana(manaCostExiled + 1);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class GabrielAngelfire extends CardImpl {
|
|||
}
|
||||
|
||||
class GabrielAngelfireGainAbilityEffect extends GainAbilitySourceEffect {
|
||||
|
||||
|
||||
private static final Set<String> choices = new LinkedHashSet<>();
|
||||
private boolean sameStep = true;
|
||||
|
||||
|
@ -112,6 +112,7 @@ class GabrielAngelfireGainAbilityEffect extends GainAbilitySourceEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
@ -121,9 +122,6 @@ class GabrielAngelfireGainAbilityEffect extends GainAbilitySourceEffect {
|
|||
choice.setChoices(choices);
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
switch (choice.getChoice()) {
|
||||
// case "Flying":
|
||||
// ability = FlyingAbility.getInstance();
|
||||
// break;
|
||||
case "First strike":
|
||||
ability = FirstStrikeAbility.getInstance();
|
||||
break;
|
||||
|
@ -137,6 +135,8 @@ class GabrielAngelfireGainAbilityEffect extends GainAbilitySourceEffect {
|
|||
ability = FlyingAbility.getInstance();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,20 +57,20 @@ import mage.target.common.TargetControlledPermanent;
|
|||
public class GoblinClearcutter extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("Forest");
|
||||
|
||||
static {
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate(SubType.FOREST));
|
||||
}
|
||||
|
||||
|
||||
public GoblinClearcutter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
|
||||
this.subtype.add(SubType.GOBLIN);
|
||||
|
||||
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// {T}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G} to your mana pool.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GoblinClearCutterEffect(), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GoblinClearCutterEffect(), new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ public class GoblinClearcutter extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class GoblinClearCutterEffect extends OneShotEffect {
|
||||
|
||||
public GoblinClearCutterEffect() {
|
||||
|
@ -105,7 +104,7 @@ class GoblinClearCutterEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null){
|
||||
if (player != null) {
|
||||
Choice manaChoice = new ChoiceImpl();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
choices.add("Red");
|
||||
|
@ -113,14 +112,9 @@ class GoblinClearCutterEffect extends OneShotEffect {
|
|||
manaChoice.setChoices(choices);
|
||||
manaChoice.setMessage("Select color of mana to add");
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Mana mana = new Mana();
|
||||
while (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (manaChoice.getChoice() == null) { // can happen if player leaves game
|
||||
if (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
switch (manaChoice.getChoice()) {
|
||||
|
|
|
@ -46,9 +46,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
@ -114,7 +114,9 @@ class GolemArtisanEffect extends OneShotEffect {
|
|||
abilities.add(TrampleAbility.getInstance().getRule());
|
||||
abilities.add(HasteAbility.getInstance().getRule());
|
||||
abilityChoice.setChoices(abilities);
|
||||
playerControls.choose(Outcome.AddAbility, abilityChoice, game);
|
||||
if (!playerControls.choose(Outcome.AddAbility, abilityChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String chosen = abilityChoice.getChoice();
|
||||
Ability ability = null;
|
||||
|
|
|
@ -66,7 +66,7 @@ public class GremlinMine extends CardImpl {
|
|||
}
|
||||
|
||||
public GremlinMine(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
|
||||
// {1}, {tap}, Sacrifice Gremlin Mine: Gremlin Mine deals 4 damage to target artifact creature.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(4), new ManaCostsImpl("{1}"));
|
||||
|
@ -110,20 +110,17 @@ class GremlinMineEffect extends OneShotEffect {
|
|||
|
||||
if (player != null && permanent != null) {
|
||||
int existingCount = permanent.getCounters(game).getCount(CounterType.CHARGE);
|
||||
|
||||
if (existingCount > 0) {
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setMessage("Select number of charge counters to remove:");
|
||||
for (Integer i = 0; i <= existingCount; i++) {
|
||||
choice.getChoices().add(i.toString());
|
||||
}
|
||||
|
||||
int amount = 0;
|
||||
if (player.choose(Outcome.Detriment, choice, game)) {
|
||||
amount = Integer.parseInt(choice.getChoice());
|
||||
permanent.removeCounters(CounterType.CHARGE.getName(), Integer.parseInt(choice.getChoice()), game);
|
||||
return true;
|
||||
}
|
||||
|
||||
permanent.removeCounters(CounterType.CHARGE.getName(), amount, game);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -99,11 +99,9 @@ class HallOfGemstoneEffect extends ReplacementEffectImpl {
|
|||
MageObject mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (player != null && mageObject != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while (!choice.isChosen()) {
|
||||
player.choose(outcome, choice, game);
|
||||
if (!player.canRespond()) {
|
||||
return;
|
||||
}
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
discard();
|
||||
return;
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(mageObject.getLogName() + ": " + player.getLogName() + " has chosen " + choice.getChoice());
|
||||
|
|
|
@ -55,7 +55,7 @@ import mage.players.Player;
|
|||
public class HarshMercy extends CardImpl {
|
||||
|
||||
public HarshMercy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}");
|
||||
|
||||
// Each player chooses a creature type. Destroy all creatures that aren't of a type chosen this way. They can't be regenerated.
|
||||
this.getSpellAbility().addEffect(new HarshMercyEffect());
|
||||
|
@ -97,10 +97,8 @@ class HarshMercyEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
while (!player.choose(Outcome.DestroyPermanent, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
continue PlayerIteration;
|
||||
}
|
||||
if (!player.choose(Outcome.DestroyPermanent, typeChoice, game)) {
|
||||
continue PlayerIteration;
|
||||
}
|
||||
String chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null) {
|
||||
|
|
|
@ -50,7 +50,7 @@ import mage.target.common.TargetOpponent;
|
|||
public class InfiniteObliteration extends CardImpl {
|
||||
|
||||
public InfiniteObliteration(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
|
||||
|
||||
// Name a creature card. Search target opponent's graveyard, hand, and library
|
||||
// for any number of cards with that name and exile them. Then that player shuffles his or her library.
|
||||
|
@ -88,10 +88,8 @@ class InfiniteObliterationEffect extends SearchTargetGraveyardHandLibraryForCard
|
|||
cardChoice.clearChoice();
|
||||
cardChoice.setMessage("Name a creature card");
|
||||
|
||||
while (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Exile, cardChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
String cardName;
|
||||
cardName = cardChoice.getChoice();
|
||||
|
|
|
@ -41,9 +41,9 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColorOrArtifact;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
|
@ -60,16 +60,16 @@ import mage.target.common.TargetControlledPermanent;
|
|||
public class JeweledSpirit extends CardImpl {
|
||||
|
||||
public JeweledSpirit(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
|
||||
// Sacrifice two lands: Jeweled Spirit gains protection from artifacts or from the color of your choice until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new JeweledSpiritEffect(),
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new JeweledSpiritEffect(),
|
||||
new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("two lands"), true))));
|
||||
}
|
||||
|
||||
|
@ -84,34 +84,27 @@ public class JeweledSpirit extends CardImpl {
|
|||
}
|
||||
|
||||
class JeweledSpiritEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public JeweledSpiritEffect() {
|
||||
super(Outcome.AddAbility);
|
||||
this.staticText = "{this} gains protection from artifacts or from the color of your choice until end of turn";
|
||||
}
|
||||
|
||||
|
||||
public JeweledSpiritEffect(final JeweledSpiritEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JeweledSpiritEffect copy() {
|
||||
return new JeweledSpiritEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceColorOrArtifact choice = new ChoiceColorOrArtifact();
|
||||
while (!choice.isChosen()) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
controller.choose(outcome, choice, game);
|
||||
}
|
||||
|
||||
FilterCard protectionFilter = new FilterCard();
|
||||
ChoiceColorOrArtifact choice = new ChoiceColorOrArtifact();
|
||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
||||
FilterCard protectionFilter = new FilterCard();
|
||||
if (choice.isArtifactSelected()) {
|
||||
protectionFilter.add(new CardTypePredicate(CardType.ARTIFACT));
|
||||
} else {
|
||||
|
@ -122,7 +115,7 @@ class JeweledSpiritEffect extends OneShotEffect {
|
|||
ContinuousEffect effect = new GainAbilitySourceEffect(protectionAbility, Duration.EndOfTurn);
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -47,10 +50,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
|
@ -127,6 +126,8 @@ class JodahsAvengerEffect extends ContinuousEffectImpl {
|
|||
gainedAbility = ProtectionAbility.from(ObjectColor.RED);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,10 +153,8 @@ class KaronaFalseGodEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (sourceObject != null && controller != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
while (!controller.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
String typeChosen = typeChoice.getChoice();
|
||||
if (!typeChosen.isEmpty()) {
|
||||
|
|
|
@ -54,8 +54,8 @@ import mage.target.common.TargetOpponent;
|
|||
public class LiarsPendulum extends CardImpl {
|
||||
|
||||
public LiarsPendulum(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
|
||||
// {2}, {T}: Choose a card name. Target opponent guesses whether a card with that name is in your hand. You may reveal your hand. If you do and your opponent guessed wrong, draw a card.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LiarsPendulumEffect(), new GenericManaCost(2));
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
@ -73,7 +73,6 @@ public class LiarsPendulum extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class LiarsPendulumEffect extends OneShotEffect {
|
||||
|
||||
public LiarsPendulumEffect() {
|
||||
|
@ -99,27 +98,24 @@ class LiarsPendulumEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl();
|
||||
choice.setChoices(CardRepository.instance.getNames());
|
||||
choice.setMessage("Choose a card name");
|
||||
while (!controller.choose(Outcome.Benefit, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
String cardName = choice.getChoice();
|
||||
game.informPlayers("Card named: " + cardName);
|
||||
boolean opponentGuess = false;
|
||||
|
||||
|
||||
if (opponent.chooseUse(Outcome.Neutral, "Is the chosen card (" + cardName + ") in " + controller.getLogName() + "'s hand?", source, game)) {
|
||||
opponentGuess = true;
|
||||
}
|
||||
boolean rightGuess = !opponentGuess;
|
||||
|
||||
|
||||
for (Card card : controller.getHand().getCards(game)) {
|
||||
if (card.isSplitCard()){
|
||||
if (card.isSplitCard()) {
|
||||
SplitCard splitCard = (SplitCard) card;
|
||||
if (splitCard.getLeftHalfCard().getName().equals(cardName)){
|
||||
if (splitCard.getLeftHalfCard().getName().equals(cardName)) {
|
||||
rightGuess = opponentGuess;
|
||||
}
|
||||
else if (splitCard.getRightHalfCard().getName().equals(cardName)){
|
||||
} else if (splitCard.getRightHalfCard().getName().equals(cardName)) {
|
||||
rightGuess = opponentGuess;
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +124,7 @@ class LiarsPendulumEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
game.informPlayers(opponent.getLogName() + " guesses that " + cardName + " is " + (opponentGuess ? "" : "not") + " in " + controller.getLogName() + "'s hand");
|
||||
|
||||
|
||||
if (controller.chooseUse(outcome, "Reveal your hand?", source, game)) {
|
||||
controller.revealCards("hand of " + controller.getName(), controller.getHand(), game);
|
||||
if (!rightGuess) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -43,8 +44,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author michael.napoleon@gmail.com
|
||||
|
@ -52,8 +51,8 @@ import java.util.UUID;
|
|||
public class LuminescentRain extends CardImpl {
|
||||
|
||||
public LuminescentRain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}");
|
||||
|
||||
// Choose a creature type. You gain 2 life for each permanent you control of that type.
|
||||
this.getSpellAbility().addEffect(new LuminescentRainEffect());
|
||||
}
|
||||
|
@ -68,36 +67,31 @@ public class LuminescentRain extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class LuminescentRainEffect extends OneShotEffect {
|
||||
class LuminescentRainEffect extends OneShotEffect {
|
||||
|
||||
LuminescentRainEffect() {
|
||||
super(Outcome.GainLife);
|
||||
this.staticText = "Choose a creature type. You gain 2 life for each permanent you control of that type.";
|
||||
}
|
||||
LuminescentRainEffect() {
|
||||
super(Outcome.GainLife);
|
||||
this.staticText = "Choose a creature type. You gain 2 life for each permanent you control of that type.";
|
||||
}
|
||||
|
||||
LuminescentRainEffect(final LuminescentRainEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LuminescentRainEffect copy() {
|
||||
return new LuminescentRainEffect(this);
|
||||
}
|
||||
LuminescentRainEffect(final LuminescentRainEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
@Override
|
||||
public LuminescentRainEffect copy() {
|
||||
return new LuminescentRainEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
if (player != null && player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
FilterControlledPermanent filter = new FilterControlledPermanent();
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
return new GainLifeEffect(new PermanentsOnBattlefieldCount(filter, 2)).apply(game, source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -42,18 +45,14 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
|
@ -61,7 +60,7 @@ import java.util.UUID;
|
|||
public class LunarAvenger extends CardImpl {
|
||||
|
||||
public LunarAvenger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{7}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{7}");
|
||||
this.subtype.add(SubType.GOLEM);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
@ -114,12 +113,9 @@ class LunarAvengerEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose ability to add");
|
||||
choice.setChoices(choices);
|
||||
while (!controller.choose(outcome, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Ability gainedAbility;
|
||||
String chosen = choice.getChoice();
|
||||
switch (chosen) {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -109,15 +108,12 @@ class MadScienceFairManaEffect extends ManaEffect {
|
|||
controller.getManaPool().addMana(Mana.ColorlessMana(1), game, source);
|
||||
} else {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
if (choice.getColor() == null) {
|
||||
return false;
|
||||
}
|
||||
Mana chosen = choice.getMana(1);
|
||||
if (chosen != null) {
|
||||
if (controller.choose(Outcome.PutManaInPool, choice, game)) {
|
||||
Mana chosen = choice.getMana(1);
|
||||
checkToFirePossibleEvents(chosen, game, source);
|
||||
controller.getManaPool().addMana(chosen, game, source);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -40,8 +43,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
|
@ -50,10 +53,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
|
@ -67,7 +66,7 @@ public class MaintenanceDroid extends CardImpl {
|
|||
}
|
||||
|
||||
public MaintenanceDroid(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{W}{U}");
|
||||
this.subtype.add(SubType.DROID);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
@ -121,10 +120,8 @@ class MaintenanceDroidEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose mode");
|
||||
choice.setChoices(choices);
|
||||
while (!controller.choose(outcome, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String chosen = choice.getChoice();
|
||||
|
|
|
@ -41,8 +41,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -54,7 +54,7 @@ import mage.players.Player;
|
|||
public class ManaforgeCinder extends CardImpl {
|
||||
|
||||
public ManaforgeCinder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B/R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B/R}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.subtype.add(SubType.SHAMAN);
|
||||
this.power = new MageInt(1);
|
||||
|
@ -62,7 +62,7 @@ public class ManaforgeCinder extends CardImpl {
|
|||
|
||||
// {1}: Add {B} or {R} to your mana pool. Activate this ability no more than three times each turn.
|
||||
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new ManaforgeCinderManaEffect(), new ManaCostsImpl("{1}"), 3));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ManaforgeCinder(final ManaforgeCinder card) {
|
||||
|
@ -75,8 +75,6 @@ public class ManaforgeCinder extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ManaforgeCinderManaEffect extends OneShotEffect {
|
||||
|
||||
public ManaforgeCinderManaEffect() {
|
||||
|
@ -104,10 +102,8 @@ class ManaforgeCinderManaEffect extends OneShotEffect {
|
|||
manaChoice.setChoices(choices);
|
||||
manaChoice.setMessage("Select black or red mana to add to your mana pool");
|
||||
Mana mana = new Mana();
|
||||
while (!controller.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
if (manaChoice.getChoice() == null) {
|
||||
return false;
|
||||
|
|
|
@ -144,10 +144,8 @@ class MarketFestivalManaEffect extends ManaEffect {
|
|||
} else {
|
||||
choiceColor.setMessage("Second mana color for " + sourceObject.getLogName());
|
||||
}
|
||||
while (!controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
return false;
|
||||
}
|
||||
if (choiceColor.getChoice() == null) { // Possible after reconnect?
|
||||
return false;
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -44,10 +48,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
|
@ -91,7 +91,8 @@ class MindblazeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player playerControls = game.getPlayer(source.getControllerId());
|
||||
if (player != null && playerControls != null) {
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (player != null && playerControls != null && sourceObject != null) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
|
||||
cardChoice.clearChoice();
|
||||
|
@ -103,20 +104,14 @@ class MindblazeEffect extends OneShotEffect {
|
|||
}
|
||||
numberChoice.setChoices(numbers);
|
||||
|
||||
while (!playerControls.choose(Outcome.Neutral, cardChoice, game)) {
|
||||
if (!playerControls.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!playerControls.choose(Outcome.Neutral, cardChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
if (!playerControls.choose(Outcome.Neutral, numberChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (!playerControls.choose(Outcome.Neutral, numberChoice, game)) {
|
||||
if (!playerControls.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
game.informPlayers("Mindblaze, named card: [" + cardChoice.getChoice() + ']');
|
||||
game.informPlayers("Mindblaze, chosen number: [" + numberChoice.getChoice() + ']');
|
||||
game.informPlayers(sourceObject.getIdName() + " - Named card: [" + cardChoice.getChoice() + "] - Chosen number: [" + numberChoice.getChoice() + ']');
|
||||
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(player.getLibrary().getCards(game));
|
||||
|
@ -128,6 +123,7 @@ class MindblazeEffect extends OneShotEffect {
|
|||
player.damage(8, source.getSourceId(), game.copy(), false, true);
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -93,10 +93,8 @@ class MistformSliverEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(permanent);
|
||||
while (!player.choose(Outcome.Detriment, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!player.choose(Outcome.Detriment, typeChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
ContinuousEffect effect = new AddCardSubTypeTargetEffect(SubType.byDescription(typeChoice.getChoice()), Duration.EndOfTurn);
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -49,10 +52,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
@ -60,7 +59,7 @@ import java.util.UUID;
|
|||
public class MultiformWonder extends CardImpl {
|
||||
|
||||
public MultiformWonder(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{5}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
|
||||
this.subtype.add(SubType.CONSTRUCT);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
@ -116,10 +115,8 @@ class MultiformWonderEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose ability to add");
|
||||
choice.setChoices(choices);
|
||||
while (!controller.choose(outcome, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Ability gainedAbility;
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
*/
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -47,11 +51,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.players.PlayerList;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
@ -62,7 +61,7 @@ public class MysticBarrier extends CardImpl {
|
|||
static final String ALLOW_ATTACKING_RIGHT = "Allow attacking right";
|
||||
|
||||
public MysticBarrier(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
|
||||
|
||||
// When Mystic Barrier enters the battlefield or at the beginning of your upkeep, choose left or right.
|
||||
this.addAbility(new MysticBarrierTriggeredAbility());
|
||||
|
@ -95,12 +94,12 @@ class MysticBarrierTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public MysticBarrierTriggeredAbility copy() {
|
||||
return new MysticBarrierTriggeredAbility(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.UPKEEP_STEP_PRE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
|
@ -118,14 +117,8 @@ class MysticBarrierTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
class MysticBarrierChooseEffect extends OneShotEffect {
|
||||
|
||||
static final String[] SET_VALUES = new String[] { MysticBarrier.ALLOW_ATTACKING_LEFT, MysticBarrier.ALLOW_ATTACKING_RIGHT };
|
||||
static final String[] SET_VALUES = new String[]{MysticBarrier.ALLOW_ATTACKING_LEFT, MysticBarrier.ALLOW_ATTACKING_RIGHT};
|
||||
static final Set<String> CHOICES = new HashSet<>(Arrays.asList(SET_VALUES));
|
||||
final static Choice DIRECTION_CHOICE = new ChoiceImpl(true);
|
||||
static {
|
||||
DIRECTION_CHOICE.setChoices(CHOICES);
|
||||
DIRECTION_CHOICE.setMessage("Direction each player may only attack to");
|
||||
DIRECTION_CHOICE.isRequired();
|
||||
}
|
||||
|
||||
public MysticBarrierChooseEffect() {
|
||||
super(Outcome.Benefit);
|
||||
|
@ -145,15 +138,14 @@ class MysticBarrierChooseEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
DIRECTION_CHOICE.clearChoice();
|
||||
while (!DIRECTION_CHOICE.isChosen() && controller.canRespond()) {
|
||||
controller.choose(outcome, DIRECTION_CHOICE, game);
|
||||
}
|
||||
if (!DIRECTION_CHOICE.getChoice().isEmpty()) {
|
||||
game.getState().setValue(new StringBuilder("attack_direction_").append(source.getSourceId()).toString(), DIRECTION_CHOICE.getChoice());
|
||||
Choice directionChoice = new ChoiceImpl(true);
|
||||
directionChoice.setChoices(CHOICES);
|
||||
directionChoice.setMessage("Direction each player may only attack to");
|
||||
directionChoice.isRequired();
|
||||
if (!controller.choose(outcome, directionChoice, game)) {
|
||||
game.getState().setValue("attack_direction_" + source.getSourceId(), directionChoice.getChoice());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -161,12 +153,12 @@ class MysticBarrierChooseEffect extends OneShotEffect {
|
|||
|
||||
class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
MysticBarrierReplacementEffect ( ) {
|
||||
MysticBarrierReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Each player may attack only the opponent seated nearest him or her in the last chosen direction and planeswalkers controlled by that player";
|
||||
}
|
||||
|
||||
MysticBarrierReplacementEffect ( MysticBarrierReplacementEffect effect ) {
|
||||
MysticBarrierReplacementEffect(MysticBarrierReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -179,7 +171,7 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getPlayers().size() > 2) {
|
||||
|
@ -217,7 +209,7 @@ class MysticBarrierReplacementEffect extends ReplacementEffectImpl {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.n;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -44,8 +45,6 @@ import mage.game.events.ManaEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
@ -120,8 +119,11 @@ class NakedSingularityEffect extends ReplacementEffectImpl {
|
|||
if (choice.getChoices().size() == 1) {
|
||||
chosenColor = choice.getChoices().iterator().next();
|
||||
} else {
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
chosenColor = choice.getChoice();
|
||||
if (controller.choose(Outcome.PutManaInPool, choice, game)) {
|
||||
chosenColor = choice.getChoice();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ManaEvent manaEvent = (ManaEvent) event;
|
||||
Mana mana = manaEvent.getMana();
|
||||
|
|
|
@ -144,12 +144,7 @@ class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl {
|
|||
if (fromSubType == null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
typeChoice.setMessage("Choose creature type to change to Vampire");
|
||||
while (!controller.choose(outcome, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (typeChoice.getChoice() == null) {
|
||||
if (!controller.choose(outcome, typeChoice, game)) {
|
||||
discard();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -38,10 +38,12 @@ import mage.abilities.keyword.FlyingAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
@ -102,29 +104,24 @@ class OonaQueenOfTheFaeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (controller == null || opponent == null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (controller == null || opponent == null || !controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(outcome, choice, game);
|
||||
if (choice.getColor() != null) {
|
||||
int cardsWithColor = 0;
|
||||
int cardsToExile = Math.min(opponent.getLibrary().size(), source.getManaCostsToPay().getX());
|
||||
for (int i = 0; i < cardsToExile; i++) {
|
||||
Card card = opponent.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
if (card.getColor(game).contains(choice.getColor())) {
|
||||
cardsWithColor++;
|
||||
}
|
||||
card.moveToExile(null, null, source.getSourceId(), game);
|
||||
}
|
||||
int cardsWithColor = 0;
|
||||
Cards cardsToExile = new CardsImpl();
|
||||
cardsToExile.addAll(opponent.getLibrary().getTopCards(game, source.getManaCostsToPay().getX()));
|
||||
|
||||
for (Card card : cardsToExile.getCards(game)) {
|
||||
if (card != null && card.getColor(game).contains(choice.getColor())) {
|
||||
cardsWithColor++;
|
||||
}
|
||||
if (cardsWithColor > 0) {
|
||||
new CreateTokenEffect(new OonaQueenFaerieToken(), cardsWithColor).apply(game, source);
|
||||
}
|
||||
game.informPlayers(new StringBuilder("Oona: ").append(cardsWithColor).append(" Token").append(cardsWithColor != 1 ? "s" : "").append(" created").toString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
|
||||
if (cardsWithColor > 0) {
|
||||
new CreateTokenEffect(new OonaQueenFaerieToken(), cardsWithColor).apply(game, source);
|
||||
}
|
||||
game.informPlayers("Oona: " + cardsWithColor + " Token" + (cardsWithColor != 1 ? "s" : "") + " created");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,14 +64,14 @@ public class OrcishLumberjack extends CardImpl {
|
|||
}
|
||||
|
||||
public OrcishLumberjack(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}");
|
||||
this.subtype.add(SubType.ORC);
|
||||
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// {tap}, Sacrifice a Forest: Add three mana in any combination of {R} and/or {G} to your mana pool.
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new OrcishLumberjackManaEffect(), new TapSourceCost());
|
||||
Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new OrcishLumberjackManaEffect(), new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -106,7 +106,7 @@ class OrcishLumberjackManaEffect extends ManaEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if(player != null){
|
||||
if (player != null) {
|
||||
Choice manaChoice = new ChoiceImpl();
|
||||
Set<String> choices = new LinkedHashSet<>();
|
||||
choices.add("Red");
|
||||
|
@ -115,11 +115,9 @@ class OrcishLumberjackManaEffect extends ManaEffect {
|
|||
manaChoice.setMessage("Select color of mana to add");
|
||||
|
||||
Mana mana = new Mana();
|
||||
for(int i = 0; i < 3; i++){
|
||||
while (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!player.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
switch (manaChoice.getChoice()) {
|
||||
case "Green":
|
||||
|
@ -129,7 +127,7 @@ class OrcishLumberjackManaEffect extends ManaEffect {
|
|||
mana.increaseRed();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
checkToFirePossibleEvents(mana, game, source);
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
|
@ -143,5 +141,4 @@ class OrcishLumberjackManaEffect extends ManaEffect {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -96,8 +96,10 @@ class OrderOfSuccessionEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Map<UUID, UUID> playerCreature = new HashMap<>(2);
|
||||
Choice choice = new ChoiceLeftOrRight();
|
||||
controller.choose(Outcome.Neutral, choice, game);
|
||||
boolean left = choice == null || choice.getChoice().equals("Left"); // to prevent npe
|
||||
if (controller.choose(Outcome.Neutral, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
boolean left = choice.getChoice().equals("Left");
|
||||
PlayerList playerList = game.getState().getPlayerList().copy();
|
||||
// set playerlist to controller
|
||||
while (!playerList.get().equals(source.getControllerId()) && controller.canRespond()) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.costs.common.DiscardTargetCost;
|
||||
|
@ -48,8 +49,6 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author fireshoes
|
||||
*/
|
||||
|
@ -95,20 +94,14 @@ class OutbreakEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
while (!player.choose(outcome, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (typeChoice.getChoice() != null) {
|
||||
game.informPlayers(player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
if (player != null && player.choose(outcome, typeChoice, game)) {
|
||||
game.informPlayers(player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("All creatures of the chosen type");
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
ContinuousEffect effect = new BoostAllEffect(-1, -1, Duration.WhileOnBattlefield, filter, false);
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class PacksDisdain extends CardImpl {
|
||||
|
||||
public PacksDisdain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||
|
||||
// Choose a creature type. Target creature gets -1/-1 until end of turn for each permanent of the chosen type you control.
|
||||
this.getSpellAbility().addEffect(new PacksDisdainEffect());
|
||||
|
@ -92,13 +92,8 @@ class PacksDisdainEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
while (!player.choose(Outcome.UnboostCreature, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
if (player != null && player.choose(Outcome.UnboostCreature, typeChoice, game)) {
|
||||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
DynamicValue negativePermanentsCount = new PermanentsOnBattlefieldCount(filter, -1);
|
||||
|
|
|
@ -42,11 +42,11 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterObject;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -63,7 +63,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class PaleWayfarer extends CardImpl {
|
||||
|
||||
public PaleWayfarer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}{W}");
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
this.subtype.add(SubType.GIANT);
|
||||
|
||||
|
@ -109,15 +109,15 @@ class PaleWayfarerEffect extends OneShotEffect {
|
|||
if (player.choose(Outcome.Neutral, colorChoice, game)) {
|
||||
game.informPlayers(targetCreature.getName() + ": " + player.getLogName() + " has chosen " + colorChoice.getChoice());
|
||||
game.getState().setValue(targetCreature.getId() + "_color", colorChoice.getColor());
|
||||
|
||||
|
||||
ObjectColor protectColor = (ObjectColor) game.getState().getValue(targetCreature.getId() + "_color");
|
||||
if (protectColor != null) {
|
||||
ContinuousEffect effect = new ProtectionChosenColorTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(targetCreature, game));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -129,7 +129,6 @@ class PaleWayfarerEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ProtectionChosenColorTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected ObjectColor chosenColor;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.*;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -45,15 +46,13 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author duncant
|
||||
*/
|
||||
public class PatriarchsBidding extends CardImpl {
|
||||
|
||||
public PatriarchsBidding(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{B}");
|
||||
|
||||
// Each player chooses a creature type. Each player returns all creature cards of a type chosen this way from his or her graveyard to the battlefield.
|
||||
this.getSpellAbility().addEffect(new PatriarchsBiddingEffect());
|
||||
|
@ -94,16 +93,12 @@ class PatriarchsBiddingEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
while (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
break;
|
||||
}
|
||||
if (!player.choose(Outcome.PutCreatureInPlay, typeChoice, game)) {
|
||||
continue;
|
||||
}
|
||||
String chosenType = typeChoice.getChoice();
|
||||
if (chosenType != null) {
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + player.getLogName() + " has chosen " + chosenType);
|
||||
chosenTypes.add(chosenType);
|
||||
}
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + player.getLogName() + " has chosen " + chosenType);
|
||||
chosenTypes.add(chosenType);
|
||||
}
|
||||
|
||||
List<SubtypePredicate> predicates = new ArrayList<>();
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
|
@ -48,8 +49,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
@ -57,7 +56,7 @@ import java.util.UUID;
|
|||
public class PeerPressure extends CardImpl {
|
||||
|
||||
public PeerPressure(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{U}");
|
||||
|
||||
// Choose a creature type. If you control more creatures of that type than each other player, you gain control of all creatures of that type.
|
||||
this.getSpellAbility().addEffect(new PeerPressureEffect());
|
||||
|
@ -92,17 +91,10 @@ class PeerPressureEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Choice choice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
while (!controller.choose(Outcome.GainControl, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Choice choice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
if (controller != null && controller.choose(Outcome.GainControl, choice, game)) {
|
||||
String chosenType = choice.getChoice();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " has chosen " + chosenType);
|
||||
}
|
||||
game.informPlayers(controller.getLogName() + " has chosen " + chosenType);
|
||||
UUID playerWithMost = null;
|
||||
int maxControlled = 0;
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
|
|
|
@ -45,9 +45,9 @@ import mage.choices.Choice;
|
|||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -62,7 +62,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
public class PemminsAura extends CardImpl {
|
||||
|
||||
public PemminsAura(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}{U}");
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
|
@ -126,18 +126,14 @@ class PemminsAuraBoostEnchantedEffect extends OneShotEffect {
|
|||
choice.setMessage("Select how to boost");
|
||||
choice.getChoices().add(CHOICE_1);
|
||||
choice.getChoices().add(CHOICE_2);
|
||||
while (!choice.isChosen()) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
if (choice.getChoice().equals(CHOICE_1)) {
|
||||
game.addEffect(new BoostEnchantedEffect(+1, -1, Duration.EndOfTurn), source);
|
||||
} else {
|
||||
game.addEffect(new BoostEnchantedEffect(-1, +1, Duration.EndOfTurn), source);
|
||||
}
|
||||
controller.choose(outcome, choice, game);
|
||||
return true;
|
||||
}
|
||||
if (choice.getChoice().equals(CHOICE_1)) {
|
||||
game.addEffect(new BoostEnchantedEffect(+1, -1, Duration.EndOfTurn), source);
|
||||
} else {
|
||||
game.addEffect(new BoostEnchantedEffect(-1, +1, Duration.EndOfTurn), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ import mage.target.TargetPlayer;
|
|||
public class Persecute extends CardImpl {
|
||||
|
||||
public Persecute(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
|
||||
|
||||
// Choose a color. Target player reveals his or her hand and discards all cards of that color.
|
||||
this.getSpellAbility().addEffect(new PersecuteEffect());
|
||||
|
@ -89,17 +89,8 @@ class PersecuteEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (controller != null && sourceObject != null && targetPlayer != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(outcome, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (choice.getColor() == null) {
|
||||
return false;
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (controller != null && sourceObject != null && targetPlayer != null && controller.choose(outcome, choice, game)) {
|
||||
Cards hand = targetPlayer.getHand();
|
||||
targetPlayer.revealCards(sourceObject.getIdName(), hand, game);
|
||||
Set<Card> cards = hand.getCards(game);
|
||||
|
|
|
@ -94,15 +94,12 @@ class PetraSphinxEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (controller != null && sourceObject != null && player != null) {
|
||||
|
||||
|
||||
if (player.getLibrary().hasCards()) {
|
||||
Choice cardChoice = new ChoiceImpl();
|
||||
cardChoice.setChoices(CardRepository.instance.getNames());
|
||||
cardChoice.setMessage("Name a card");
|
||||
while (!player.choose(Outcome.DrawCard, cardChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!player.choose(Outcome.DrawCard, cardChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
String cardName = cardChoice.getChoice();
|
||||
game.informPlayers(sourceObject.getLogName() + ", player: " + player.getLogName() + ", named: [" + cardName + ']');
|
||||
|
|
|
@ -52,7 +52,7 @@ import mage.target.TargetSpell;
|
|||
public class PlasmCapture extends CardImpl {
|
||||
|
||||
public PlasmCapture(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}{G}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}{G}{U}{U}");
|
||||
|
||||
// Counter target spell. At the beginning of your next precombat main phase, add X mana in any combination of colors to your mana pool, where X is that spell's converted mana cost.
|
||||
this.getSpellAbility().addTarget(new TargetSpell());
|
||||
|
@ -128,15 +128,11 @@ class PlasmCaptureManaEffect extends ManaEffect {
|
|||
Mana mana = new Mana();
|
||||
for (int i = 0; i < amountOfMana; i++) {
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
while (!player.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!player.choose(Outcome.Benefit, choiceColor, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
choiceColor.increaseMana(mana);
|
||||
}
|
||||
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
return true;
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
|
@ -58,7 +58,7 @@ import mage.players.Player;
|
|||
public class PrimalClay extends CardImpl {
|
||||
|
||||
public PrimalClay(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
|
||||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
|
||||
this.power = new MageInt(0);
|
||||
|
@ -123,13 +123,8 @@ public class PrimalClay extends CardImpl {
|
|||
choice.getChoices().add(choice22);
|
||||
choice.getChoices().add(choice16);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.Neutral, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (controller != null && !controller.choose(Outcome.Neutral, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
int power = 0;
|
||||
int toughness = 0;
|
||||
|
|
|
@ -40,9 +40,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
|
@ -58,7 +58,7 @@ import mage.players.Player;
|
|||
public class PrimalPlasma extends CardImpl {
|
||||
|
||||
public PrimalPlasma(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
|
||||
|
@ -117,20 +117,15 @@ public class PrimalPlasma extends CardImpl {
|
|||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (permanent != null && controller != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
|
||||
choice.getChoices().add(choice33);
|
||||
choice.getChoices().add(choice22);
|
||||
choice.getChoices().add(choice16);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.Neutral, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!controller.choose(Outcome.Neutral, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
int power = 0;
|
||||
int toughness = 0;
|
||||
|
@ -152,8 +147,6 @@ public class PrimalPlasma extends CardImpl {
|
|||
}
|
||||
permanent.getPower().modifyBaseValue(power);
|
||||
permanent.getToughness().modifyBaseValue(toughness);
|
||||
// game.addEffect(new SetPowerToughnessSourceEffect(power, toughness, Duration.Custom, SubLayer.SetPT_7b), source);
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class PrismaticStrands extends CardImpl {
|
|||
}
|
||||
|
||||
public PrismaticStrands(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
|
||||
|
||||
// Prevent all damage that sources of the color of your choice would deal this turn.
|
||||
this.getSpellAbility().addEffect(new PrismaticStrandsEffect());
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -44,8 +45,6 @@ import mage.game.events.ManaEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000 & L_J
|
||||
|
@ -117,7 +116,9 @@ class RealityTwistEffect extends ReplacementEffectImpl {
|
|||
if (choice.getChoices().size() == 1) {
|
||||
chosenColor = choice.getChoices().iterator().next();
|
||||
} else {
|
||||
controller.choose(Outcome.PutManaInPool, choice, game);
|
||||
if (!controller.choose(Outcome.PutManaInPool, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
chosenColor = choice.getChoice();
|
||||
}
|
||||
ManaEvent manaEvent = (ManaEvent) event;
|
||||
|
|
|
@ -48,8 +48,7 @@ import mage.players.Player;
|
|||
public class ReverseTheSands extends CardImpl {
|
||||
|
||||
public ReverseTheSands(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{6}{W}{W}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{6}{W}{W}");
|
||||
|
||||
// Redistribute any number of players' life totals.
|
||||
this.getSpellAbility().addEffect(new ReverseTheSandsEffect());
|
||||
|
@ -100,7 +99,9 @@ class ReverseTheSandsEffect extends OneShotEffect {
|
|||
String selectedChoice;
|
||||
if (choices.size() > 1) {
|
||||
lifeChoice.setMessage("Which players life should get player " + player.getLogName());
|
||||
controller.choose(Outcome.Detriment, lifeChoice, game);
|
||||
if (!controller.choose(Outcome.Detriment, lifeChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
selectedChoice = lifeChoice.getChoice();
|
||||
} else {
|
||||
selectedChoice = choices.iterator().next();
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
@ -130,38 +129,29 @@ class RhysticCaveManaEffect extends ManaEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); //get obj reference to Rhystic Cave
|
||||
if (controller != null) {
|
||||
if (mageObject != null) {
|
||||
ChoiceColor choice = new ChoiceColor(true);
|
||||
controller.choose(outcome, choice, game);
|
||||
if (choice.getColor() != null) {
|
||||
String color = choice.getColor().toString();
|
||||
switch (color) {
|
||||
case "R":
|
||||
chosenMana.setRed(1);
|
||||
break;
|
||||
case "U":
|
||||
chosenMana.setBlue(1);
|
||||
break;
|
||||
case "W":
|
||||
chosenMana.setWhite(1);
|
||||
break;
|
||||
case "B":
|
||||
chosenMana.setBlack(1);
|
||||
break;
|
||||
case "G":
|
||||
chosenMana.setGreen(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
checkToFirePossibleEvents(chosenMana, game, source);
|
||||
controller.getManaPool().addMana(chosenMana, game, source);
|
||||
return true;
|
||||
ChoiceColor choice = new ChoiceColor(true);
|
||||
if (controller != null && controller.choose(outcome, choice, game)) {
|
||||
switch (choice.getColor().toString()) {
|
||||
case "R":
|
||||
chosenMana.setRed(1);
|
||||
break;
|
||||
case "U":
|
||||
chosenMana.setBlue(1);
|
||||
break;
|
||||
case "W":
|
||||
chosenMana.setWhite(1);
|
||||
break;
|
||||
case "B":
|
||||
chosenMana.setBlack(1);
|
||||
break;
|
||||
case "G":
|
||||
chosenMana.setGreen(1);
|
||||
break;
|
||||
}
|
||||
|
||||
checkToFirePossibleEvents(chosenMana, game, source);
|
||||
controller.getManaPool().addMana(chosenMana, game, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -48,8 +49,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author fireshoes
|
||||
*/
|
||||
|
@ -93,16 +92,9 @@ class RiptideChronologistEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
while (!player.choose(outcome, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (typeChoice.getChoice() != null) {
|
||||
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
|
||||
}
|
||||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
if (player != null && player.choose(outcome, typeChoice, game)) {
|
||||
game.informPlayers(sourceObject.getLogName() + " chosen type: " + typeChoice.getChoice());
|
||||
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent();
|
||||
filterCreaturePermanent.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
for (Permanent creature : game.getBattlefield().getActivePermanents(filterCreaturePermanent, source.getSourceId(), game)) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -38,14 +39,12 @@ import mage.cards.*;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceCreatureType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
@ -97,10 +96,8 @@ class RiptideShapeshifterEffect extends OneShotEffect {
|
|||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
Choice choice = new ChoiceCreatureType(sourceObject);
|
||||
while (!controller.choose(Outcome.BoostCreature, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.BoostCreature, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
Cards revealedCards = new CardsImpl();
|
||||
while (controller.getLibrary().hasCards()) {
|
||||
|
|
|
@ -97,7 +97,10 @@ class RiteOfRuinEffect extends OneShotEffect {
|
|||
choice.setMessage("Choose a card type");
|
||||
choice.setChoices(choices);
|
||||
|
||||
while (controller.canRespond() && controller.choose(Outcome.Sacrifice, choice, game) && choices.size() > 1) {
|
||||
while (choices.size() > 1) {
|
||||
if (!controller.choose(Outcome.Sacrifice, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
order.add(getCardType(choice.getChoice()));
|
||||
choices.remove(choice.getChoice());
|
||||
choice.clearChoice();
|
||||
|
|
|
@ -40,8 +40,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -56,7 +56,7 @@ import mage.players.Player;
|
|||
public class RithTheAwakener extends CardImpl {
|
||||
|
||||
public RithTheAwakener(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{G}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{G}{W}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class RithTheAwakener extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Whenever Rith, the Awakener deals combat damage to a player, you may pay {2}{G}. If you do, choose a color, then create a 1/1 green Saproling creature token for each permanent of that color.
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new DoIfCostPaid(new RithTheAwakenerEffect(), new ManaCostsImpl("{2}{G}")), false));
|
||||
new DoIfCostPaid(new RithTheAwakenerEffect(), new ManaCostsImpl("{2}{G}")), false));
|
||||
}
|
||||
|
||||
public RithTheAwakener(final RithTheAwakener card) {
|
||||
|
@ -81,30 +81,29 @@ public class RithTheAwakener extends CardImpl {
|
|||
}
|
||||
|
||||
class RithTheAwakenerEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public RithTheAwakenerEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "choose a color, then create a 1/1 green Saproling creature token for each permanent of that color";
|
||||
}
|
||||
|
||||
|
||||
public RithTheAwakenerEffect(final RithTheAwakenerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RithTheAwakenerEffect copy() {
|
||||
return new RithTheAwakenerEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(outcome, choice, game);
|
||||
if (choice.getColor() != null) {
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
game.informPlayers(new StringBuilder(controller.getLogName()).append(" chooses ").append(choice.getColor()).toString());
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
|
|
|
@ -90,10 +90,8 @@ class RoarOfTheCrowdEffect extends OneShotEffect {
|
|||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Choice typeChoice = new ChoiceCreatureType(game.getObject(source.getSourceId()));
|
||||
while (!player.choose(Outcome.LoseLife, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!player.choose(Outcome.LoseLife, typeChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
FilterControlledPermanent filter = new FilterControlledPermanent();
|
||||
filter.add(new SubtypePredicate(SubType.byDescription(typeChoice.getChoice())));
|
||||
|
@ -101,4 +99,4 @@ class RoarOfTheCrowdEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterEnchantmentPermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
|
@ -55,7 +55,7 @@ import mage.players.Player;
|
|||
public class RootGreevil extends CardImpl {
|
||||
|
||||
public RootGreevil(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
this.subtype.add(SubType.BEAST);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
@ -95,15 +95,12 @@ public class RootGreevil extends CardImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
controller.choose(Outcome.DestroyPermanent, choice, game);
|
||||
if (choice.getColor() != null) {
|
||||
FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
for (Permanent enchantment : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
enchantment.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (controller != null && controller.choose(Outcome.DestroyPermanent, choice, game)) {
|
||||
FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
for (Permanent enchantment : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
enchantment.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SarkhanUnbroken extends CardImpl {
|
|||
}
|
||||
|
||||
public SarkhanUnbroken(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{G}{U}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{G}{U}{R}");
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.SARKHAN);
|
||||
|
||||
|
@ -125,13 +125,9 @@ class SarkhanUnbrokenAbility1 extends OneShotEffect {
|
|||
manaChoice.setMessage("Select color of mana to add");
|
||||
|
||||
Mana mana = new Mana();
|
||||
|
||||
controller.choose(Outcome.Benefit, manaChoice, game);
|
||||
|
||||
if (manaChoice.getChoice() == null) {
|
||||
if (!controller.choose(Outcome.Benefit, manaChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (manaChoice.getChoice()) {
|
||||
case "White":
|
||||
mana.increaseWhite();
|
||||
|
|
|
@ -187,16 +187,10 @@ class SasayasEssenceManaEffectEffect extends ManaEffect {
|
|||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(outcome, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (choice.getChoice() == null) {
|
||||
return false;
|
||||
}
|
||||
switch (choice.getChoice()) {
|
||||
case "Black":
|
||||
newMana.increaseBlack();
|
||||
|
|
|
@ -58,11 +58,11 @@ import mage.util.CardUtil;
|
|||
public class SealOfTheGuildpact extends CardImpl {
|
||||
|
||||
public SealOfTheGuildpact(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||
|
||||
// As Seal of the Guildpact enters the battlefield, choose two colors.
|
||||
this.addAbility(new EntersBattlefieldAbility(new SealOfTheGuildpactChooseColorEffect()));
|
||||
|
||||
|
||||
// Each spell you cast costs {1} less to cast for each of the chosen colors it is.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SealOfTheGuildpactCostReductionEffect()));
|
||||
}
|
||||
|
@ -78,33 +78,27 @@ public class SealOfTheGuildpact extends CardImpl {
|
|||
}
|
||||
|
||||
class SealOfTheGuildpactChooseColorEffect extends OneShotEffect {
|
||||
|
||||
|
||||
SealOfTheGuildpactChooseColorEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "choose two colors";
|
||||
}
|
||||
|
||||
|
||||
SealOfTheGuildpactChooseColorEffect(final SealOfTheGuildpactChooseColorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SealOfTheGuildpactChooseColorEffect copy() {
|
||||
return new SealOfTheGuildpactChooseColorEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
ChoiceColor choice1 = new ChoiceColor();
|
||||
while (!choice1.isChosen()) {
|
||||
controller.choose(Outcome.Benefit, choice1, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ChoiceColor choice1 = new ChoiceColor();
|
||||
if (controller != null && mageObject != null && controller.choose(Outcome.Benefit, choice1, game)) {
|
||||
String color1 = choice1.getChoice();
|
||||
Set<String> choices2 = new HashSet<>();
|
||||
if (!color1.equals("White")) {
|
||||
|
@ -124,11 +118,8 @@ class SealOfTheGuildpactChooseColorEffect extends OneShotEffect {
|
|||
}
|
||||
ChoiceColor choice2 = new ChoiceColor();
|
||||
choice2.setChoices(choices2);
|
||||
while (!choice2.isChosen()) {
|
||||
controller.choose(Outcome.Benefit, choice2, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Benefit, choice2, game)) {
|
||||
return false;
|
||||
}
|
||||
String color2 = choice2.getChoice();
|
||||
if (!game.isSimulation()) {
|
||||
|
@ -178,8 +169,8 @@ class SealOfTheGuildpactCostReductionEffect extends CostModificationEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
return abilityToModify.getControllerId().equals(source.getControllerId()) &&
|
||||
abilityToModify instanceof SpellAbility;
|
||||
return abilityToModify.getControllerId().equals(source.getControllerId())
|
||||
&& abilityToModify instanceof SpellAbility;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -95,24 +95,15 @@ class SehtsTigerEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
while (!choice.isChosen()) {
|
||||
controller.choose(Outcome.Protect, choice, game);
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (choice.getColor() != null) {
|
||||
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
filter.setMessage(choice.getChoice());
|
||||
Ability ability = new ProtectionAbility(filter);
|
||||
game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
|
||||
return true;
|
||||
}
|
||||
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
if (controller != null && mageObject != null && controller.choose(Outcome.Protect, choice, game)) {
|
||||
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + choice.getChoice());
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new ColorPredicate(choice.getColor()));
|
||||
filter.setMessage(choice.getChoice());
|
||||
Ability ability = new ProtectionAbility(filter);
|
||||
game.addEffect(new GainAbilityControllerEffect(ability, Duration.EndOfTurn), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -45,10 +48,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MarcoMarin / HCrescent
|
||||
|
@ -57,7 +56,7 @@ public class Shapeshifter extends CardImpl {
|
|||
|
||||
public Shapeshifter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
|
||||
|
||||
|
||||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(7);
|
||||
|
@ -65,7 +64,7 @@ public class Shapeshifter extends CardImpl {
|
|||
// As Shapeshifter enters the battlefield, choose a number between 0 and 7.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ShapeshifterEffect()));
|
||||
// At the beginning of your upkeep, you may choose a number between 0 and 7.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ShapeshifterEffect(), TargetController.YOU, true));
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new ShapeshifterEffect(), TargetController.YOU, true));
|
||||
// Shapeshifter's power is equal to the last chosen number and its toughness is equal to 7 minus that number.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new ShapeshifterContinuousEffect()));
|
||||
}
|
||||
|
@ -79,22 +78,23 @@ public class Shapeshifter extends CardImpl {
|
|||
return new Shapeshifter(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ShapeshifterEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public ShapeshifterEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Choose a number between 0 and 7.";
|
||||
}
|
||||
|
||||
|
||||
public ShapeshifterEffect(final ShapeshifterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ShapeshifterEffect copy() {
|
||||
return new ShapeshifterEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
@ -110,46 +110,45 @@ class ShapeshifterEffect extends OneShotEffect {
|
|||
numbers.add(Integer.toString(i));
|
||||
}
|
||||
numberChoice.setChoices(numbers);
|
||||
while (!controller.choose(Outcome.Neutral, numberChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(Outcome.Neutral, numberChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers("Shapeshifter, chosen number: [" + numberChoice.getChoice() + ']');
|
||||
game.getState().setValue(source.getSourceId().toString() + "_Shapeshifter", numberChoice.getChoice());
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("lastChosenNumber", CardUtil.addToolTipMarkTags("Last chosen number: " + numberChoice.getChoice()), game);
|
||||
}
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("lastChosenNumber", CardUtil.addToolTipMarkTags("Last chosen number: " + numberChoice.getChoice()), game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ShapeshifterContinuousEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
public ShapeshifterContinuousEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.CharacteristicDefining_7a, Outcome.BoostCreature);
|
||||
staticText = "{this}'s power is equal to the last chosen number and its toughness is equal to 7 minus that number.";
|
||||
}
|
||||
|
||||
|
||||
public ShapeshifterContinuousEffect(final ShapeshifterContinuousEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ShapeshifterContinuousEffect copy() {
|
||||
return new ShapeshifterContinuousEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if(permanent!=null){
|
||||
String lastChosen = (String) game.getState().getValue(source.getSourceId().toString() + "_Shapeshifter");
|
||||
int lastChosenNumber = Integer.parseInt(lastChosen);
|
||||
permanent.getPower().modifyBaseValue(lastChosenNumber);
|
||||
permanent.getToughness().modifyBaseValue(7 - lastChosenNumber);
|
||||
return true;
|
||||
}
|
||||
if (permanent != null) {
|
||||
String lastChosen = (String) game.getState().getValue(source.getSourceId().toString() + "_Shapeshifter");
|
||||
int lastChosenNumber = Integer.parseInt(lastChosen);
|
||||
permanent.getPower().modifyBaseValue(lastChosenNumber);
|
||||
permanent.getToughness().modifyBaseValue(7 - lastChosenNumber);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,9 +45,9 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -60,7 +60,7 @@ import mage.players.Player;
|
|||
public class ShorecrasherElemental extends CardImpl {
|
||||
|
||||
public ShorecrasherElemental(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}{U}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
@ -106,9 +106,9 @@ class ShorecrasherElementalEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent shorecrasherElemental = game.getPermanent(source.getSourceId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (shorecrasherElemental != null &&
|
||||
sourceObject != null &&
|
||||
new MageObjectReference(sourceObject, game).refersTo(shorecrasherElemental, game)) {
|
||||
if (shorecrasherElemental != null
|
||||
&& sourceObject != null
|
||||
&& new MageObjectReference(sourceObject, game).refersTo(shorecrasherElemental, game)) {
|
||||
if (shorecrasherElemental.moveToExile(source.getSourceId(), sourceObject.getName(), source.getSourceId(), game)) {
|
||||
Card card = game.getExile().getCard(source.getSourceId(), game);
|
||||
if (card != null) {
|
||||
|
@ -149,18 +149,14 @@ class ShorecrasherElementalBoostEffect extends OneShotEffect {
|
|||
choice.setMessage("Select how to boost");
|
||||
choice.getChoices().add(CHOICE_1);
|
||||
choice.getChoices().add(CHOICE_2);
|
||||
while (!choice.isChosen()) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
if (choice.getChoice().equals(CHOICE_1)) {
|
||||
game.addEffect(new BoostSourceEffect(+1, -1, Duration.EndOfTurn), source);
|
||||
} else {
|
||||
game.addEffect(new BoostSourceEffect(-1, +1, Duration.EndOfTurn), source);
|
||||
}
|
||||
controller.choose(outcome, choice, game);
|
||||
return true;
|
||||
}
|
||||
if (choice.getChoice().equals(CHOICE_1)) {
|
||||
game.addEffect(new BoostSourceEffect(+1, -1, Duration.EndOfTurn), source);
|
||||
} else {
|
||||
game.addEffect(new BoostSourceEffect(-1, +1, Duration.EndOfTurn), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -41,8 +44,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
@ -50,10 +53,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
|
@ -115,12 +114,9 @@ class SithEvokerEffect extends OneShotEffect {
|
|||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose mode");
|
||||
choice.setChoices(choices);
|
||||
while (!controller.choose(outcome, choice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!controller.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (sourceCard != null) {
|
||||
for (Object cost : source.getCosts()) {
|
||||
|
|
|
@ -41,8 +41,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -56,7 +56,7 @@ import mage.target.common.TargetCardInLibrary;
|
|||
public class SphinxAmbassador extends CardImpl {
|
||||
|
||||
public SphinxAmbassador(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}");
|
||||
this.subtype.add(SubType.SPHINX);
|
||||
|
||||
this.power = new MageInt(5);
|
||||
|
@ -115,16 +115,14 @@ class SphinxAmbassadorEffect extends OneShotEffect {
|
|||
Choice cardChoice = new ChoiceImpl();
|
||||
cardChoice.setChoices(choices);
|
||||
cardChoice.clearChoice();
|
||||
while (!targetPlayer.choose(Outcome.Benefit, cardChoice, game)) {
|
||||
if (!targetPlayer.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!targetPlayer.choose(Outcome.Benefit, cardChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
String cardName = cardChoice.getChoice();
|
||||
|
||||
game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(", named card: [").append(cardName).append(']').toString());
|
||||
game.informPlayers(sourcePermanent.getName() + ", named card: [" + cardName + ']');
|
||||
if (!card.getName().equals(cardName) && card.isCreature()) {
|
||||
if (controller.chooseUse(outcome, new StringBuilder("Put ").append(card.getName()).append(" onto the battlefield?").toString(), source, game)) {
|
||||
if (controller.chooseUse(outcome, "Put " + card.getName() + " onto the battlefield?", source, game)) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,35 +134,34 @@ class SquanderedResourcesEffect extends ManaEffect {
|
|||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
player.choose(outcome, choice, game);
|
||||
}
|
||||
if (choice.getChoice() != null) {
|
||||
Mana mana = new Mana();
|
||||
switch (choice.getChoice()) {
|
||||
case "Black":
|
||||
mana.setBlack(1);
|
||||
break;
|
||||
case "Blue":
|
||||
mana.setBlue(1);
|
||||
break;
|
||||
case "Red":
|
||||
mana.setRed(1);
|
||||
break;
|
||||
case "Green":
|
||||
mana.setGreen(1);
|
||||
break;
|
||||
case "White":
|
||||
mana.setWhite(1);
|
||||
break;
|
||||
case "Colorless":
|
||||
mana.setColorless(1);
|
||||
break;
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
checkToFirePossibleEvents(mana, game, source);
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
Mana mana = new Mana();
|
||||
switch (choice.getChoice()) {
|
||||
case "Black":
|
||||
mana.setBlack(1);
|
||||
break;
|
||||
case "Blue":
|
||||
mana.setBlue(1);
|
||||
break;
|
||||
case "Red":
|
||||
mana.setRed(1);
|
||||
break;
|
||||
case "Green":
|
||||
mana.setGreen(1);
|
||||
break;
|
||||
case "White":
|
||||
mana.setWhite(1);
|
||||
break;
|
||||
case "Colorless":
|
||||
mana.setColorless(1);
|
||||
break;
|
||||
}
|
||||
checkToFirePossibleEvents(mana, game, source);
|
||||
player.getManaPool().addMana(mana, game, source);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -88,10 +88,8 @@ class StandardizeEffect extends OneShotEffect {
|
|||
Choice typeChoice = new ChoiceCreatureType(sourceObject);
|
||||
typeChoice.setMessage("Choose a creature type other than Wall");
|
||||
typeChoice.getChoices().remove("Wall");
|
||||
while (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
if (!player.choose(Outcome.BoostCreature, typeChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(sourceObject.getLogName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
chosenType = typeChoice.getChoice();
|
||||
|
|
|
@ -152,7 +152,9 @@ class StarCompassManaEffect extends ManaEffect {
|
|||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
player.choose(outcome, choice, game);
|
||||
if (!player.choose(outcome, choice, game)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (choice.getChoice() != null) {
|
||||
Mana mana = new Mana();
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
|
@ -42,10 +45,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
@ -53,7 +52,7 @@ import java.util.UUID;
|
|||
public class StorageMatrix extends CardImpl {
|
||||
|
||||
public StorageMatrix(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// As long as Storage Matrix is untapped, each player chooses artifact, creature, or land during his or her untap step. That player can untap only permanents of the chosen type this step.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new StorageMatrixRestrictionEffect()));
|
||||
|
@ -106,12 +105,7 @@ class StorageMatrixRestrictionEffect extends RestrictionEffect {
|
|||
choiceImpl.setMessage("Untap which kind of permanent?");
|
||||
choiceImpl.setChoices(choice);
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player != null) {
|
||||
while (!player.choose(outcome, choiceImpl, game)) {
|
||||
if (!player.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (player != null && player.choose(outcome, choiceImpl, game)) {
|
||||
String choosenType = choiceImpl.getChoice();
|
||||
if (choosenType != null) {
|
||||
game.informPlayers(storageMatrix.getLogName() + ": " + player.getLogName() + " chose to untap " + choosenType);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue