fix: 修复宠物升级经验显示与动态结算
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user