mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Inform the human which turn position he's in during the Mulligan Input
This commit is contained in:
@@ -62,10 +62,19 @@ public class InputMulligan extends Input {
|
|||||||
ButtonUtil.setButtonText("No", "Yes");
|
ButtonUtil.setButtonText("No", "Yes");
|
||||||
ButtonUtil.enableAllFocusOk();
|
ButtonUtil.enableAllFocusOk();
|
||||||
|
|
||||||
final String str =
|
GameState game = Singletons.getModel().getGame();
|
||||||
(Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().equals(Singletons.getControl().getPlayer())
|
Player startingPlayer = game.getPhaseHandler().getPlayerTurn();
|
||||||
? "You're going first. " : "The computer is going first. ");
|
Player localPlayer = Singletons.getControl().getPlayer();
|
||||||
CMatchUI.SINGLETON_INSTANCE.showMessage(str + "Do you want to Mulligan?");
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(startingPlayer.getName()).append(" is going first. ");
|
||||||
|
|
||||||
|
if (!startingPlayer.equals(localPlayer)) {
|
||||||
|
sb.append("You are going ").append(game.getOrdinalPosition(localPlayer, startingPlayer)).append(". ");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append("Do you want to Mulligan?");
|
||||||
|
CMatchUI.SINGLETON_INSTANCE.showMessage(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
|||||||
@@ -478,6 +478,21 @@ public class GameState {
|
|||||||
return roIngamePlayers.get(iPlayer);
|
return roIngamePlayers.get(iPlayer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOrdinalPosition(Player player, Player startingPlayer) {
|
||||||
|
int startPosition = roIngamePlayers.indexOf(startingPlayer);
|
||||||
|
int position = roIngamePlayers.indexOf(player) + startPosition + 1;
|
||||||
|
String[] sufixes = new String[] { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" };
|
||||||
|
switch (position % 100) {
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
return position + "th";
|
||||||
|
default:
|
||||||
|
return position + sufixes[position % 10];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only game knows how to get suitable players out of just connected clients.
|
* Only game knows how to get suitable players out of just connected clients.
|
||||||
|
|||||||
Reference in New Issue
Block a user