|
|
|
|
@ -16,6 +16,7 @@ interface ActionManager { |
|
|
|
|
fun dropNextActions(index: Int) |
|
|
|
|
fun allinAmountSet(positionIndex: Int) |
|
|
|
|
fun blindsUpdated(type: Action.Type, amount: Double) |
|
|
|
|
fun minimumBetAmount(index: Int): Double |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
interface ActionListListener : PlayerSetupCreationListener { |
|
|
|
|
@ -127,6 +128,26 @@ class ActionList(var listener: ActionListListener) : ArrayList<ComputedAction>() |
|
|
|
|
computedAction.setAmount(amount) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Returns the minimum bet amount for an action at the given [index] |
|
|
|
|
*/ |
|
|
|
|
override fun minimumBetAmount(index: Int): Double { |
|
|
|
|
|
|
|
|
|
val street = this[index].street |
|
|
|
|
|
|
|
|
|
// Verify that the amount is correct, at least the amount of the previous raise difference |
|
|
|
|
getStreetLastSignificantAction(street, index - 1)?.action?.let { lastSignificantAction -> |
|
|
|
|
val lastSignificantAmount = lastSignificantAction.amount |
|
|
|
|
if (lastSignificantAmount != null) { |
|
|
|
|
val previousSignificantAmount = getStreetLastSignificantAction(street, lastSignificantAction.index - 1)?.action?.amount ?: 0.0 |
|
|
|
|
val differenceWithPreviousSignificantAmount = lastSignificantAmount - previousSignificantAmount |
|
|
|
|
return lastSignificantAmount + differenceWithPreviousSignificantAmount |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0.0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Fires the listener if the list count has changed |
|
|
|
|
*/ |
|
|
|
|
@ -566,14 +587,14 @@ class ActionList(var listener: ActionListListener) : ArrayList<ComputedAction>() |
|
|
|
|
/*** |
|
|
|
|
* Updates the small blind amount |
|
|
|
|
*/ |
|
|
|
|
fun updateBlinds() { |
|
|
|
|
this.handHistory.smallBlind?.let { sb -> |
|
|
|
|
this.firstOrNull { it.action.type == Action.Type.POST_SB }?.setAmount(sb) |
|
|
|
|
} |
|
|
|
|
this.handHistory.bigBlind?.let { bb -> |
|
|
|
|
this.firstOrNull { it.action.type == Action.Type.POST_BB }?.setAmount(bb) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// fun updateBlinds() { |
|
|
|
|
// this.handHistory.smallBlind?.let { sb -> |
|
|
|
|
// this.firstOrNull { it.action.type == Action.Type.POST_SB }?.setAmount(sb) |
|
|
|
|
// } |
|
|
|
|
// this.handHistory.bigBlind?.let { bb -> |
|
|
|
|
// this.firstOrNull { it.action.type == Action.Type.POST_BB }?.setAmount(bb) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Updates the remaining stacks for each action of the big blind |
|
|
|
|
|