``refactor(pet): 优化宠物经验计算逻辑,使用NextLvExp替代临时计算``
This commit is contained in:
@@ -40,12 +40,11 @@ func (p *Player) AddPetExp(petinfo *model.PetInfo, addExp uint32, bro bool) {
|
||||
basic := xmlres.PetMAP[int(petinfo.ID)]
|
||||
for {
|
||||
|
||||
needExp := calculateExperience(petinfo.Level, basic.GetBasic())
|
||||
needExp -= petinfo.Exp
|
||||
if addExp >= needExp {
|
||||
if addExp >= petinfo.NextLvExp {
|
||||
petinfo.NextLvExp = calculateExperience(petinfo.Level, basic.GetBasic())
|
||||
basic := xmlres.PetMAP[int(petinfo.ID)]
|
||||
addExp -= needExp
|
||||
p.Info.ExpPool -= needExp //减去已使用的经验
|
||||
addExp -= petinfo.NextLvExp
|
||||
p.Info.ExpPool -= petinfo.NextLvExp //减去已使用的经验
|
||||
petinfo.Level++
|
||||
petinfo.Exp = 0
|
||||
if originalLevel < 100 && petinfo.Level == 100 { //升到100了
|
||||
@@ -70,7 +69,7 @@ func (p *Player) AddPetExp(petinfo *model.PetInfo, addExp uint32, bro bool) {
|
||||
}
|
||||
|
||||
}
|
||||
petinfo.NextLvExp = calculateExperience(petinfo.Level, basic.GetBasic())
|
||||
|
||||
//治疗
|
||||
if petinfo.Level != originalLevel {
|
||||
petinfo.Cure()
|
||||
|
||||
Reference in New Issue
Block a user