mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Mana Vault - Fixed that it doesn't return mana if payment is cancelled (fixes #4473)
This commit is contained in:
parent
e9db2a68f1
commit
7e73cf5d34
1 changed files with 12 additions and 7 deletions
|
@ -80,6 +80,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
|
||||
&& executingEffects.size() > 0 && (!optional || player.chooseUse(executingEffects.get(0).getOutcome(), message, source, game))) {
|
||||
cost.clearPaid();
|
||||
int bookmark = game.bookmarkState();
|
||||
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
|
||||
for (Effect effect : executingEffects) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
|
@ -90,13 +91,17 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
player.resetStoredBookmark(game); // otherwise you can e.g. undo card drawn with Mentor of the Meek
|
||||
} else if (!otherwiseEffects.isEmpty()) {
|
||||
for (Effect effect : otherwiseEffects) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
if (effect instanceof OneShotEffect) {
|
||||
result &= effect.apply(game, source);
|
||||
} else {
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
} else {
|
||||
// Paying cost was cancels so try to undo payment so far
|
||||
game.restoreState(bookmark, DoIfCostPaid.class.getName());
|
||||
if (!otherwiseEffects.isEmpty()) {
|
||||
for (Effect effect : otherwiseEffects) {
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
if (effect instanceof OneShotEffect) {
|
||||
result &= effect.apply(game, source);
|
||||
} else {
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue