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

@@ -280,6 +280,9 @@ public abstract class PlayerController {
public abstract String chooseCardName(SpellAbility sa, Predicate<PaperCard> cpp, String valid, String message);
// 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

@@ -288,8 +288,10 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
activator = sp.getActivatingPlayer();
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);
}
else {

View File

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