refactor(pet): 优化宠物治疗逻辑,仅在等级变化时重新计算面板,并合并技能PP恢复条件判断
增加竞态分析
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -22,7 +22,7 @@
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": ["-port=1"],
|
||||
"args": ["-port=1"," -race"],
|
||||
"program": "${workspaceFolder}/logic",
|
||||
|
||||
}, {
|
||||
|
||||
@@ -121,12 +121,9 @@ func (h *Controller) PetOneCure(
|
||||
if ok {
|
||||
onpet.Hp = onpet.MaxHp
|
||||
for i := 0; i < 4; i++ {
|
||||
// 跳过无效技能
|
||||
if onpet.SkillList[i].ID == 0 {
|
||||
continue
|
||||
}
|
||||
maxPP, ok := xmlres.SkillMap[int(onpet.SkillList[i].ID)]
|
||||
// 恢复至最大PP值(从配置表获取)
|
||||
if maxPP, ok := xmlres.SkillMap[int(onpet.SkillList[i].ID)]; ok {
|
||||
if onpet.SkillList[i].ID != 0 && ok {
|
||||
onpet.SkillList[i].PP = uint32(maxPP.MaxPP)
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,10 @@ func (p *Player) AddPetExp(pet *model.PetInfo, addExp uint32) {
|
||||
}
|
||||
|
||||
// 重新计算面板
|
||||
pet.CalculatePetPane()
|
||||
if originalLevel != pet.Level {
|
||||
pet.CalculatePetPane()
|
||||
}
|
||||
|
||||
// 发送经验更新消息
|
||||
//player.SendMessage(generatePetUpdateInfo(petEntity, originalExp+addExp-exp, addition))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user