|
|
|
@ -823,10 +823,37 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra |
|
|
|
|
|
|
|
|
|
|
|
fun setAnte(ante: Double) { |
|
|
|
fun setAnte(ante: Double) { |
|
|
|
this.handHistory.ante = ante |
|
|
|
this.handHistory.ante = ante |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val positionIndexes = (0..this.handHistory.numberOfPlayers).toList() |
|
|
|
|
|
|
|
updatePlayerRemainingStacks(positionIndexes) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setBigBlindAnte(bigBlindAnte: Boolean) { |
|
|
|
fun setBigBlindAnte(bigBlindAnte: Boolean) { |
|
|
|
this.handHistory.bigBlindAnte = bigBlindAnte |
|
|
|
this.handHistory.bigBlindAnte = bigBlindAnte |
|
|
|
|
|
|
|
val bbIndex = this.sortedActions.positions.indexOf(Position.BB) |
|
|
|
|
|
|
|
updatePlayerRemainingStacks(listOf(bbIndex)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun updatePlayerRemainingStacks(positions: List<Int>) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val ante = if (this.handHistory.bigBlindAnte) this.handHistory.bigBlind ?: 0.0 else this.handHistory.ante |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
positions.forEach { position -> |
|
|
|
|
|
|
|
this.handHistory.playerSetupForPosition(position)?.stack?.let { initialStack -> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var remainingStack = initialStack - ante |
|
|
|
|
|
|
|
val playerActions = this.sortedActions.filter { it.action.position == position } |
|
|
|
|
|
|
|
playerActions.forEach { |
|
|
|
|
|
|
|
remainingStack -= it.action.effectiveAmount |
|
|
|
|
|
|
|
it.playerRemainingStack = remainingStack |
|
|
|
|
|
|
|
if (it.action.type?.isAllin == true) { |
|
|
|
|
|
|
|
it.action.amount = remainingStack |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |