mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
added methods to query player if he wants to take turn first
It is used by new revision of GameNew that I don't commit yet because it contains other changes unsafe for todays release
This commit is contained in:
@@ -65,7 +65,7 @@ public abstract class PlayerController {
|
||||
*/
|
||||
public void passPriority() {
|
||||
PhaseHandler handler = game.getPhaseHandler();
|
||||
// may pass only priority is has
|
||||
|
||||
if ( handler.getPriorityPlayer() == getPlayer() )
|
||||
game.getPhaseHandler().passPriority();
|
||||
}
|
||||
@@ -95,5 +95,6 @@ public abstract class PlayerController {
|
||||
public Card chooseSingleCardForEffect(List<Card> sourceList, SpellAbility sa, String title) { return chooseSingleCardForEffect(sourceList, sa, title, false); }
|
||||
public abstract Card chooseSingleCardForEffect(List<Card> sourceList, SpellAbility sa, String title, boolean isOptional);
|
||||
public abstract boolean confirmAction(SpellAbility sa, String mode, String message);
|
||||
public abstract boolean getWillPlayOnFirstTurn(String message);
|
||||
public abstract boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message);
|
||||
}
|
||||
|
||||
@@ -198,6 +198,10 @@ public class PlayerControllerAi extends PlayerController {
|
||||
return brains.confirmAction(sa, mode, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getWillPlayOnFirstTurn(String message) {
|
||||
return true; // AI is brave :)
|
||||
}
|
||||
@Override
|
||||
public boolean confirmStaticApplication(Card hostCard, GameEntity affected, String logic, String message) {
|
||||
return brains.confirmStaticApplication(hostCard, affected, logic, message);
|
||||
|
||||
@@ -250,5 +250,14 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
return GuiDialog.confirm(hostCard, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getWillPlayOnFirstTurn(String message) {
|
||||
final String[] possibleValues = { "Play", "Draw" };
|
||||
|
||||
final Object playDraw = JOptionPane.showOptionDialog(null, message + "\n\nWould you like to play or draw?",
|
||||
"Play or Draw?", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
|
||||
possibleValues, possibleValues[0]);
|
||||
|
||||
return !playDraw.equals(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user