feat(pet): 宠物治疗逻辑重构并新增治愈方法

将原有的宠物治疗逻辑提取为 PetInfo.Cure() 方法,统一处理血量和技能PP恢复。
同时优化经验分配逻辑,确保升级后正确扣除经验池并处理满级情况。

```
This commit is contained in:
2025-10-13 19:46:19 +08:00
parent 79213c67d6
commit 5e53b9caaa
5 changed files with 45 additions and 30 deletions

View File

@@ -88,7 +88,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// log.Printf("任务86未知分支out_id=%d默认奖励布布种子", data.OutState)
}
// 生成宠物pet_dv=31锁个体
r := model.GenPetInfo(petType, 31, -1, 0, 0, 5)
r := c.GenPetInfo(petType, 31, -1, 0, 0, 5)
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)
@@ -154,7 +154,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// 遗迹中的精灵信号(奖励奇塔)
case 28:
// out_id=1宠物类型102奇塔
r := model.GenPetInfo(102, 31, -1, 0, 0, 5) // pet_dv默认-1随机个体
r := c.GenPetInfo(102, 31, -1, 0, 0, 5) // pet_dv默认-1随机个体
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)
@@ -173,7 +173,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// 时空之门(奖励迪卢卡)
case 40:
// out_id=1宠物类型139迪卢卡
r := model.GenPetInfo(139, 31, -1, 0, 0, 5)
r := c.GenPetInfo(139, 31, -1, 0, 0, 5)
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)
@@ -197,7 +197,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// 密林中的托尼(奖励托尼+物品)
case 49:
// 1. 奖励宠物托尼类型158
r := model.GenPetInfo(158, 31, -1, 0, 0, 5)
r := c.GenPetInfo(158, 31, -1, 0, 0, 5)
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)
@@ -289,7 +289,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// 赛尔号大整修奖励TOE+物品)
case 71:
// 1. 奖励宠物TOE类型213
r := model.GenPetInfo(213, 31, -1, 0, 0, 5)
r := c.GenPetInfo(213, 31, -1, 0, 0, 5)
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)
@@ -380,7 +380,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// 站长归来(奖励尼布+物品)
case 92:
// 1. 奖励宠物尼布类型95
r := model.GenPetInfo(95, 31, -1, 0, 0, 5)
r := c.GenPetInfo(95, 31, -1, 0, 0, 5)
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)
@@ -462,7 +462,7 @@ func (h Controller) Complete_Task(data *task.CompleteTaskInboundInfo, c *player.
// 寻找迷失的心(奖励史空+物品)
case 133:
// 1. 奖励宠物史空类型381
r := model.GenPetInfo(381, 31, -1, 0, 0, 5)
r := c.GenPetInfo(381, 31, -1, 0, 0, 5)
result.CaptureTime = r.CatchTime
result.PetTypeId = r.ID
c.Service.PetAdd(*r)