mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Some fixes for Miracle keyword. Added displaying spell in the stack
This commit is contained in:
parent
ca56f3b498
commit
f8af7202ef
1 changed files with 18 additions and 4 deletions
|
|
@ -37,6 +37,7 @@ import mage.abilities.keyword.MiracleAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.WatcherImpl;
|
||||
|
||||
|
|
@ -91,12 +92,25 @@ public class MiracleWatcher extends WatcherImpl<MiracleWatcher> {
|
|||
for (Ability ability : card.getAbilities()) {
|
||||
if (ability instanceof MiracleAbility) {
|
||||
Player controller = game.getPlayer(ability.getControllerId());
|
||||
// FIXME: I don't like that I need to call it manually
|
||||
// it's the place for bugs
|
||||
game.getContinuousEffects().costModification(ability, game);
|
||||
ManaCosts<ManaCost> manaCostsToPay = ability.getManaCostsToPay();
|
||||
if (controller != null && controller.chooseUse(Constants.Outcome.Benefit, "Use Miracle " + manaCostsToPay.getText() + "?", game)) {
|
||||
if (manaCostsToPay.pay(ability, game, ability.getSourceId(), ability.getControllerId(), false)) {
|
||||
controller.cast(card.getSpellAbility(), game, true);
|
||||
if (controller != null) {
|
||||
game.getStack().add(new StackAbility(ability, controller.getId()));
|
||||
if (controller.chooseUse(Constants.Outcome.Benefit, "Use Miracle " + manaCostsToPay.getText() + "?", game)) {
|
||||
game.getStack().poll();
|
||||
ManaCosts costRef = card.getSpellAbility().getManaCostsToPay();
|
||||
// replace with the new cost
|
||||
costRef.clear();
|
||||
for (ManaCost manaCost : manaCostsToPay) {
|
||||
costRef.add(manaCost);
|
||||
}
|
||||
controller.cast(card.getSpellAbility(), game, false);
|
||||
break;
|
||||
} else {
|
||||
game.getStack().poll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue