* Angelic Skirmisher - Fixed that the ability choice caused error.

This commit is contained in:
LevelX2 2016-06-18 10:47:40 +02:00
parent 7750bc2cd9
commit bdebcbaf63
2 changed files with 34 additions and 27 deletions

View file

@ -74,7 +74,6 @@ public class TundraKavu extends CardImpl {
}
}
class TundraKavuEffect extends BecomesBasicLandTargetEffect {
public TundraKavuEffect() {
@ -86,6 +85,7 @@ class TundraKavuEffect extends BecomesBasicLandTargetEffect {
super(effect);
}
@Override
public TundraKavuEffect copy() {
return new TundraKavuEffect(this);
}
@ -94,14 +94,18 @@ class TundraKavuEffect extends BecomesBasicLandTargetEffect {
public void init(Ability source, Game game) {
landTypes.clear();
Player controller = game.getPlayer(source.getControllerId());
if(controller != null) {
if (controller != null) {
Set<String> choiceSet = new LinkedHashSet<>();
choiceSet.add("Island");
choiceSet.add("Plains");
ChoiceImpl choice = new ChoiceImpl(true);
choice.setChoices(choiceSet);
choice.setMessage("Choose a basic land type");
controller.choose(outcome, choice, game);
while (!controller.choose(outcome, choice, game)) {
if (!controller.canRespond()) {
return;
}
}
landTypes.add(choice.getChoice());
} else {
this.discard();

View file

@ -85,6 +85,7 @@ public class AngelicSkirmisher extends CardImpl {
}
class AngelicSkirmisherEffect extends OneShotEffect {
AngelicSkirmisherEffect() {
super(Outcome.AddAbility);
staticText = "choose first strike, vigilance or lifelink. Creatures you control gain that ability until end of turn";
@ -96,7 +97,6 @@ class AngelicSkirmisherEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (controller != null && sourcePermanent != null) {
@ -107,29 +107,32 @@ class AngelicSkirmisherEffect extends OneShotEffect {
abilityChoices.add("Vigilance");
abilityChoices.add("Lifelink");
abilityChoice.setChoices(abilityChoices);
Ability ability = null;
switch (abilityChoice.getChoice()) {
case "First strike":
ability = FirstStrikeAbility.getInstance();
break;
case "Vigilance":
ability = VigilanceAbility.getInstance();
break;
case "Lifelink":
ability = LifelinkAbility.getInstance();
break;
default:
break;
while (!controller.choose(outcome, abilityChoice, game)) {
if (!controller.canRespond()) {
return false;
}
}
if (ability != null) {
GainAbilityControlledEffect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, new FilterControlledCreaturePermanent());
game.addEffect(effect, source);
game.informPlayers(new StringBuilder(sourcePermanent.getName())
.append(": ")
.append(controller.getLogName())
.append(" has chosen ")
.append(abilityChoice.getChoice().toLowerCase()).toString());
return true;
Ability ability = null;
if (abilityChoice.getChoice() != null) {
switch (abilityChoice.getChoice()) {
case "First strike":
ability = FirstStrikeAbility.getInstance();
break;
case "Vigilance":
ability = VigilanceAbility.getInstance();
break;
case "Lifelink":
ability = LifelinkAbility.getInstance();
break;
default:
break;
}
if (ability != null) {
GainAbilityControlledEffect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, new FilterControlledCreaturePermanent());
game.addEffect(effect, source);
game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " has chosen " + abilityChoice.getChoice().toLowerCase());
return true;
}
}
}
return false;