```
feat(pet): 宠物治疗逻辑重构并新增治愈方法 将原有的宠物治疗逻辑提取为 PetInfo.Cure() 方法,统一处理血量和技能PP恢复。 同时优化经验分配逻辑,确保升级后正确扣除经验池并处理满级情况。 ```
This commit is contained in:
@@ -125,15 +125,7 @@ func (h *Controller) PetOneCure(
|
||||
return item.CatchTime == data.CatchTime
|
||||
})
|
||||
if ok {
|
||||
onpet.Hp = onpet.MaxHp
|
||||
for i := 0; i < 4; i++ {
|
||||
maxPP, ok := xmlres.SkillMap[int(onpet.SkillList[i].ID)]
|
||||
// 恢复至最大PP值(从配置表获取)
|
||||
if onpet.SkillList[i].ID != 0 && ok {
|
||||
onpet.SkillList[i].PP = uint32(maxPP.MaxPP)
|
||||
|
||||
}
|
||||
}
|
||||
onpet.Cure()
|
||||
}
|
||||
|
||||
return &pet.PetOneCureOutboundInfo{
|
||||
@@ -178,11 +170,13 @@ func (h Controller) SetPetExp(data *pet.PetSetExpInboundInfo, c *player.Player)
|
||||
return item.CatchTime == data.CatchTime
|
||||
})
|
||||
if ok {
|
||||
c.AddPetExp(onpet, data.Exp)
|
||||
|
||||
c.AddPetExp(onpet, data.Exp)
|
||||
}
|
||||
|
||||
return &pet.PetSetExpOutboundInfo{}, 0
|
||||
return &pet.PetSetExpOutboundInfo{
|
||||
c.Info.ExpPool,
|
||||
}, 0
|
||||
}
|
||||
func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (result *pet.ChangeSkillOutInfo, err errorcode.ErrorCode) {
|
||||
_, onpet, ok := FindWithIndex(c.Info.PetList, func(item model.PetInfo) bool {
|
||||
|
||||
Reference in New Issue
Block a user