Prevent abilities being put on the Undo stack if not activated by Gui player

This commit is contained in:
drdev
2014-08-30 21:11:16 +00:00
parent 3227bd6963
commit 16c140c7ad
3 changed files with 12 additions and 4 deletions

View File

@@ -282,4 +282,7 @@ public abstract class PlayerController {
// better to have this odd method than those if playerType comparison in ChangeZone // better to have this odd method than those if playerType comparison in ChangeZone
public abstract Card chooseSingleCardForZoneChange(ZoneType destination, List<ZoneType> origin, SpellAbility sa, List<Card> fetchList, String selectPrompt, boolean b, Player decider); public abstract Card chooseSingleCardForZoneChange(ZoneType destination, List<ZoneType> origin, SpellAbility sa, List<Card> fetchList, String selectPrompt, boolean b, Player decider);
public boolean isGuiPlayer() {
return false;
}
} }

View File

@@ -289,7 +289,9 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
System.out.println(source.getName() + " - activatingPlayer not set before adding to stack."); System.out.println(source.getName() + " - activatingPlayer not set before adding to stack.");
} }
if (sp.isUndoable()) { //either push onto or clear undo stack based on where spell/ability is undoable //either push onto or clear undo stack based on whether
//spell/ability is undoable and activator is the Gui player
if (sp.isUndoable() && activator.getController().isGuiPlayer()) {
undoStack.push(sp); undoStack.push(sp);
} }
else { else {

View File

@@ -1165,4 +1165,7 @@ public class PlayerControllerHuman extends PlayerController {
return chooseSingleEntityForEffect(fetchList, sa, selectPrompt, b, decider); return chooseSingleEntityForEffect(fetchList, sa, selectPrompt, b, decider);
} }
public boolean isGuiPlayer() {
return lobbyPlayer == GuiBase.getInterface().getGuiPlayer();
}
} }