* @return message to show if on client.
*/
@Override
protected String applyAction(PlayerAction action, Player player) {
PokerPlayer p = (PokerPlayer) player;
PokerAction act = (PokerAction) action;
PokerController pc = (PokerController) controller_;
String msg = null;
int callAmount = pc.getCurrentMaxContribution() - p.getContribution();
PokerRound round = pc.getRound();
switch (act.getActionName()) {
case FOLD :
p.setFold(true);
msg = p.getName() + " folded.";
break;
case CALL :
// GameContext.log(0,"PGV: robot call amount = currentMaxContrib - robot.getContrib) = "
// + pc.getCurrentMaxContribution()+" - "+robot.getContribution());
if (callAmount <= p.getCash()) {
p.contributeToPot(round, callAmount);
msg = p.getName() + " has called by adding "+ callAmount + " to the pot.";
} else {
p.setFold(true);
msg = p.getName() + " folded.";
}
break;
case RAISE :
p.contributeToPot(round, callAmount);
int raise = act.getRaiseAmount();
p.contributeToPot(round, raise);
msg = p.getName() + " has met the " + callAmount + ", and rasied the pot by " + raise;
break;
}
return msg;
}