mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-06-05 13:52:54 +00:00
Fixed resume battle max HP display bug.
This commit is contained in:
parent
2201b7d0fe
commit
65a7ccb221
@ -10,5 +10,7 @@ data class PVPDataModel (
|
||||
val playerAttackDamage: Int,
|
||||
val opponentAttackDamage: Int,
|
||||
val winner: String,
|
||||
val opponentCharaId: String? = null // TODO: Server will add this - opponent's charaId from the match
|
||||
val opponentCharaId: String? = null, // Server provides opponent's charaId from the match
|
||||
val playerMaxHP: Int? = null, // Server should provide max HP for resumed matches
|
||||
val opponentMaxHP: Int? = null // Server should provide max HP for resumed matches
|
||||
):java.io.Serializable
|
||||
@ -2502,9 +2502,14 @@ fun BattlesScreen() {
|
||||
println("BATTLESCREEN: Clicked opponent: ${clickedOpponent.name} (${clickedOpponent.charaId}), baseHp: ${clickedOpponent.baseHp}")
|
||||
|
||||
// Update player character HP from API response
|
||||
// Use playerMaxHP from API if available, otherwise use current HP as fallback
|
||||
// NOTE: Server should provide playerMaxHP for resumed matches since DB stats use different scaling
|
||||
val playerMaxHp = apiResult.playerMaxHP ?: apiResult.playerHP
|
||||
println("BATTLESCREEN: Resuming match - playerMaxHP from API: ${apiResult.playerMaxHP}, using: $playerMaxHp")
|
||||
|
||||
activeCharacter = activeCharacter?.copy(
|
||||
baseHp = apiResult.playerHP,
|
||||
currentHp = apiResult.playerHP
|
||||
baseHp = playerMaxHp, // Use max HP from API (or current HP as fallback)
|
||||
currentHp = apiResult.playerHP // Current HP from API
|
||||
)
|
||||
|
||||
// Find the actual opponent from the match
|
||||
@ -2583,9 +2588,13 @@ fun BattlesScreen() {
|
||||
println("BATTLESCREEN: Selected opponent for resume: ${actualOpponent.name} (${actualOpponent.charaId}), baseHp: ${actualOpponent.baseHp}, currentHp: ${apiResult.opponentHP}")
|
||||
|
||||
// Update opponent with correct HP from match
|
||||
// Use the actual baseHp from the opponent, but set currentHp to the match HP
|
||||
// Use opponentMaxHP from API if available, otherwise use opponent's baseHp from opponentsList
|
||||
// NOTE: Server should provide opponentMaxHP for resumed matches since DB stats use different scaling
|
||||
val opponentMaxHp = apiResult.opponentMaxHP ?: actualOpponent.baseHp
|
||||
println("BATTLESCREEN: Resuming match - opponentMaxHP from API: ${apiResult.opponentMaxHP}, using: $opponentMaxHp")
|
||||
|
||||
selectedOpponent = actualOpponent.copy(
|
||||
baseHp = actualOpponent.baseHp, // Keep original baseHp
|
||||
baseHp = opponentMaxHp, // Use max HP from API (or opponent's baseHp as fallback)
|
||||
currentHp = apiResult.opponentHP // Use current HP from match
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user