fix: 修复宠物升级经验显示与动态结算
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-04-15 15:34:16 +08:00
parent 5a81534e84
commit 61a135b3a7
4 changed files with 60 additions and 31 deletions

View File

@@ -15,21 +15,18 @@ func petSetExpLimit(currentPet *playermodel.PetInfo) int64 {
}
simulatedPet := *currentPet
var allowedExp int64
allowedExp := simulatedPet.NextLvExp - simulatedPet.Exp
if allowedExp < 0 {
allowedExp = 0
}
for simulatedPet.Level < 100 {
needExp := simulatedPet.NextLvExp - simulatedPet.Exp
if needExp <= 0 {
simulatedPet.Exp = simulatedPet.NextLvExp
simulatedPet.Level++
simulatedPet.Update(true)
continue
}
allowedExp += needExp
simulatedPet.Exp += needExp
for simulatedPet.Level < 100 && simulatedPet.NextLvExp > 0 {
simulatedPet.Level++
simulatedPet.Update(true)
if simulatedPet.Level >= 100 {
break
}
allowedExp += simulatedPet.NextLvExp
}
return allowedExp