Fixed some wrong usages of canRespond.

This commit is contained in:
LevelX2 2016-10-02 17:55:49 +02:00
parent 34442ca00a
commit da685472d8
8 changed files with 34 additions and 37 deletions

View file

@ -68,7 +68,7 @@ public class LunarAvenger extends CardImpl {
this.addAbility(new SunburstAbility(this));
// Remove a +1/+1 counter from Lunar Avenger: Lunar Avenger gains your choice of flying, first strike, or haste until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LunarAvengerEffect(),
new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1))));
new RemoveCountersSourceCost(CounterType.P1P1.createInstance(1))));
}
public LunarAvenger(final LunarAvenger card) {
@ -81,7 +81,6 @@ public class LunarAvenger extends CardImpl {
}
}
class LunarAvengerEffect extends OneShotEffect {
private static final HashSet<String> choices = new HashSet<>();
@ -109,31 +108,29 @@ class LunarAvengerEffect 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()) {
while (!controller.choose(outcome, choice, game)) {
if (!controller.canRespond()) {
return false;
}
}
}
Ability gainedAbility;
String chosen = choice.getChoice();
if(chosen.equals("Flying")) {
gainedAbility = FlyingAbility.getInstance();
}
else if(chosen.equals("First strike")) {
gainedAbility = FirstStrikeAbility.getInstance();
}
else {
gainedAbility = HasteAbility.getInstance();
}
Ability gainedAbility;
String chosen = choice.getChoice();
if (chosen.equals("Flying")) {
gainedAbility = FlyingAbility.getInstance();
} else if (chosen.equals("First strike")) {
gainedAbility = FirstStrikeAbility.getInstance();
} else {
gainedAbility = HasteAbility.getInstance();
}
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn), source);
return true;
}
return false;
game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn), source);
return true;
}
return false;
}
}

View file

@ -121,7 +121,7 @@ class MultiformWonderEffect extends OneShotEffect {
choice.setMessage("Choose ability to add");
choice.setChoices(choices);
while (!controller.choose(outcome, choice, game)) {
if (controller.canRespond()) {
if (!controller.canRespond()) {
return false;
}
}

View file

@ -44,8 +44,8 @@ import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
/**
@ -64,7 +64,7 @@ public class Fatespinner extends CardImpl {
// At the beginning of each opponent's upkeep, that player chooses draw step, main phase, or combat phase. The player skips each instance of the chosen step or phase this turn.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new FatespinnerChooseEffect(),
TargetController.OPPONENT, false, true));
TargetController.OPPONENT, false, true));
}
public Fatespinner(final Fatespinner card) {
@ -88,8 +88,8 @@ class FatespinnerChooseEffect extends OneShotEffect {
}
public FatespinnerChooseEffect() {
super(Outcome.Detriment);
staticText = "At the beginning of each opponent's upkeep, that player chooses draw step, main phase, or combat phase. The player skips each instance of the chosen step or phase this turn.";
super(Outcome.Detriment);
staticText = "At the beginning of each opponent's upkeep, that player chooses draw step, main phase, or combat phase. The player skips each instance of the chosen step or phase this turn.";
}
public FatespinnerChooseEffect(final FatespinnerChooseEffect effect) {
@ -104,12 +104,12 @@ class FatespinnerChooseEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if(player != null) {
if (player != null) {
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()) {
while (!player.choose(outcome, choice, game)) {
if (!player.canRespond()) {
return false;
}
}
@ -150,15 +150,15 @@ class FatespinnerSkipEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
EventType type = event.getType();
return ((phase.equals("Draw step") && type == EventType.DRAW_STEP)
|| (phase.equals("Main phase") && (type == EventType.PRECOMBAT_MAIN_PHASE || type == EventType.POSTCOMBAT_MAIN_PHASE))
|| (phase.equals("Combat phase") && type == EventType.COMBAT_PHASE));
|| (phase.equals("Main phase") && (type == EventType.PRECOMBAT_MAIN_PHASE || type == EventType.POSTCOMBAT_MAIN_PHASE))
|| (phase.equals("Combat phase") && type == EventType.COMBAT_PHASE));
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
EventType type = event.getType();
return (type == EventType.DRAW_STEP || type == EventType.PRECOMBAT_MAIN_PHASE
|| type == EventType.POSTCOMBAT_MAIN_PHASE || type == EventType.COMBAT_PHASE);
|| type == EventType.POSTCOMBAT_MAIN_PHASE || type == EventType.COMBAT_PHASE);
}
@Override

View file

@ -107,7 +107,7 @@ class StorageMatrixRestrictionEffect extends RestrictionEffect {
Player player = game.getPlayer(game.getActivePlayerId());
if (player != null) {
while (!player.choose(outcome, choiceImpl, game)) {
if (player.canRespond()) {
if (!player.canRespond()) {
return false;
}
}

View file

@ -133,7 +133,7 @@ class AurraSingBaneOfJediEffect extends OneShotEffect {
choice.setMessage("Choose mode");
choice.setChoices(choices);
while (!controller.choose(outcome, choice, game)) {
if (controller.canRespond()) {
if (!controller.canRespond()) {
return false;
}
}

View file

@ -120,7 +120,7 @@ class MaintenanceDroidEffect extends OneShotEffect {
choice.setMessage("Choose mode");
choice.setChoices(choices);
while (!controller.choose(outcome, choice, game)) {
if (controller.canRespond()) {
if (!controller.canRespond()) {
return false;
}
}

View file

@ -114,7 +114,7 @@ class SithEvokerEffect extends OneShotEffect {
choice.setMessage("Choose mode");
choice.setChoices(choices);
while (!controller.choose(outcome, choice, game)) {
if (controller.canRespond()) {
if (!controller.canRespond()) {
return false;
}
}

View file

@ -111,7 +111,7 @@ class TeferisRealmEffect extends OneShotEffect {
choiceImpl.setMessage("Phase out which kind of permanents?");
choiceImpl.setChoices(choices);
while (!player.choose(outcome, choiceImpl, game)) {
if (player.canRespond()) {
if (!player.canRespond()) {
return false;
}
}