|
|
|
|
@ -1,7 +1,5 @@ |
|
|
|
|
package net.pokeranalytics.android.ui.modules.handhistory.model |
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
|
import android.graphics.Canvas |
|
|
|
|
import net.pokeranalytics.android.exceptions.PAIllegalStateException |
|
|
|
|
import net.pokeranalytics.android.model.handhistory.Position |
|
|
|
|
import net.pokeranalytics.android.model.handhistory.Street |
|
|
|
|
@ -10,7 +8,7 @@ import net.pokeranalytics.android.model.realm.handhistory.HandHistory |
|
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.toReadRow |
|
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.HandRowType |
|
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.replayer.HandStep |
|
|
|
|
import net.pokeranalytics.android.ui.modules.handhistory.replayer.ReplayerAnimator |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import kotlin.math.max |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
@ -188,27 +186,6 @@ class ComputedAction(var manager: ActionManager, |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* Sets the effective amount of the action |
|
|
|
|
* Also calculates the player remaining stack if possible |
|
|
|
|
*/ |
|
|
|
|
// private fun setEffectiveAmount(amount: Double) { |
|
|
|
|
// this.action.effectiveAmount = amount |
|
|
|
|
// |
|
|
|
|
// val oldEffective = this.action.effectiveAmount |
|
|
|
|
// |
|
|
|
|
// this.stackBeforeActing?.let { |
|
|
|
|
// |
|
|
|
|
// val oldPlayerRemainingStack = it + oldEffective |
|
|
|
|
// val revisedAmount = min(amount, oldPlayerRemainingStack) |
|
|
|
|
// val remainingStack = it - revisedAmount + oldEffective |
|
|
|
|
// this.stackBeforeActing = remainingStack |
|
|
|
|
// |
|
|
|
|
// this.action.toggleType(remainingStack) |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
override fun isFieldNeedsInput(tag: Int, handHistory: HandHistory): Boolean { |
|
|
|
|
return when (tag) { |
|
|
|
|
Tag.ACTION.ordinal -> this.action.type == null |
|
|
|
|
@ -248,7 +225,13 @@ class ComputedAction(var manager: ActionManager, |
|
|
|
|
val significantAmount = significantAction.action.amount ?: 0.0 |
|
|
|
|
val committedAmount = getPreviouslyCommittedAmount() |
|
|
|
|
|
|
|
|
|
this.action.effectiveAmount = max(significantAmount - committedAmount, 0.0) |
|
|
|
|
val effectiveAmount = significantAmount - committedAmount |
|
|
|
|
this.action.effectiveAmount = if (effectiveAmount >= 0) { |
|
|
|
|
effectiveAmount |
|
|
|
|
} else { |
|
|
|
|
Timber.w("Putting 0.0 as effectiveAmount in the action instead of the calculated: $effectiveAmount") |
|
|
|
|
0.0 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun getStreetLastSignificantAction(): ComputedAction? { |
|
|
|
|
@ -307,22 +290,4 @@ class ComputedAction(var manager: ActionManager, |
|
|
|
|
override val positionIndex: Int |
|
|
|
|
get() { return this.action.position } |
|
|
|
|
|
|
|
|
|
val previousAction: ComputedAction? |
|
|
|
|
get() { |
|
|
|
|
return this.manager.previousAction(this) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// override fun draw(configuration: ReplayerConfiguration, canvas: Canvas, context: Context) { |
|
|
|
|
// TableDrawer.drawAction(this, true, configuration, canvas, context) |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
override fun frames( |
|
|
|
|
animator: ReplayerAnimator, |
|
|
|
|
canvas: Canvas, |
|
|
|
|
context: Context, |
|
|
|
|
update: () -> Unit |
|
|
|
|
) { |
|
|
|
|
// TODO("Not yet implemented") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |