* Naked Singularity, Reality Twist - fixed rollback error on disconnect while choosing mana color (#7296);

This commit is contained in:
Oleg Agafonov 2020-12-28 05:58:19 +04:00
parent 04980bf369
commit e23fe7016d
2 changed files with 13 additions and 14 deletions

View file

@ -1,7 +1,5 @@
package mage.cards.n; package mage.cards.n;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -19,8 +17,9 @@ import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author emerald000 * @author emerald000
*/ */
public final class NakedSingularity extends CardImpl { public final class NakedSingularity extends CardImpl {
@ -93,11 +92,11 @@ class NakedSingularityEffect extends ReplacementEffectImpl {
if (choice.getChoices().size() == 1) { if (choice.getChoices().size() == 1) {
chosenColor = choice.getChoices().iterator().next(); chosenColor = choice.getChoices().iterator().next();
} else { } else {
if (controller.choose(Outcome.PutManaInPool, choice, game)) { controller.choose(Outcome.PutManaInPool, choice, game);
chosenColor = choice.getChoice(); chosenColor = choice.getChoice();
} else { }
return false; if (chosenColor == null) {
} return false;
} }
ManaEvent manaEvent = (ManaEvent) event; ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana(); Mana mana = manaEvent.getMana();

View file

@ -1,7 +1,5 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -19,8 +17,9 @@ import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
/** /**
*
* @author emerald000 & L_J * @author emerald000 & L_J
*/ */
public final class RealityTwist extends CardImpl { public final class RealityTwist extends CardImpl {
@ -90,11 +89,12 @@ class RealityTwistEffect extends ReplacementEffectImpl {
if (choice.getChoices().size() == 1) { if (choice.getChoices().size() == 1) {
chosenColor = choice.getChoices().iterator().next(); chosenColor = choice.getChoices().iterator().next();
} else { } else {
if (!controller.choose(Outcome.PutManaInPool, choice, game)) { controller.choose(Outcome.PutManaInPool, choice, game);
return false;
}
chosenColor = choice.getChoice(); chosenColor = choice.getChoice();
} }
if (chosenColor == null) {
return false;
}
ManaEvent manaEvent = (ManaEvent) event; ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana(); Mana mana = manaEvent.getMana();
int amount = mana.count(); int amount = mana.count();