mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* Shorecrasher Elemental - Fixed that the choice how to boost was not made during resolutiuon (fixes #821).
This commit is contained in:
parent
357aa418f9
commit
4de7e27b8e
1 changed files with 48 additions and 6 deletions
|
@ -30,7 +30,6 @@ package mage.sets.dragonsoftarkir;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -38,6 +37,8 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
|||
import mage.abilities.keyword.MorphAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -45,6 +46,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -63,11 +65,7 @@ public class ShorecrasherElemental extends CardImpl {
|
|||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShorecrasherElementalEffect(), new ManaCostsImpl("{U}")));
|
||||
|
||||
// {1}: Shorecrasher Elemental gets +1/-1 or -1/+1 until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, -1, Duration.EndOfTurn), new ManaCostsImpl("{1}"));
|
||||
Mode mode = new Mode();
|
||||
mode.getEffects().add(new BoostSourceEffect(-1, 1, Duration.EndOfTurn));
|
||||
ability.addMode(mode);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShorecrasherElementalBoostEffect(), new ManaCostsImpl("{1}")));
|
||||
|
||||
// Megamorph {4}{U}
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{4}{U}"), true));
|
||||
|
@ -114,3 +112,47 @@ class ShorecrasherElementalEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ShorecrasherElementalBoostEffect extends OneShotEffect {
|
||||
|
||||
private static String CHOICE_1 = "+1/-1";
|
||||
private static String CHOICE_2 = "-1/+1";
|
||||
|
||||
public ShorecrasherElementalBoostEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "{this} gets +1/-1 or -1/+1 until end of turn";
|
||||
}
|
||||
|
||||
public ShorecrasherElementalBoostEffect(final ShorecrasherElementalBoostEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShorecrasherElementalBoostEffect copy() {
|
||||
return new ShorecrasherElementalBoostEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Select how to boost");
|
||||
choice.getChoices().add(CHOICE_1);
|
||||
choice.getChoices().add(CHOICE_2);
|
||||
while (!choice.isChosen()) {
|
||||
if (!controller.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
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);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue