"fix(logic): 修复宠物技能学习校验逻辑并移除冗余战斗效果字段"

This commit is contained in:
1
2025-12-23 13:53:34 +00:00
parent 83ee9fba43
commit 839d02b17f
9 changed files with 20 additions and 29 deletions

View File

@@ -8,6 +8,8 @@ import (
"blazing/logic/service/pet"
"blazing/logic/service/player"
"blazing/modules/blazing/model"
"github.com/samber/lo"
)
func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (result *pet.ChangeSkillOutInfo, err errorcode.ErrorCode) {
@@ -16,6 +18,15 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
}
c.Info.Coins -= 50
_, onpet, ok := c.FindPet(data.CatchTime)
if !ok {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
canleaernskill := onpet.GetLevelRangeCanLearningSkills(1, onpet.Level)
_, ok = lo.Find(canleaernskill, func(item uint32) bool {
return item == data.ReplaceSkill
})
if !ok {
return result, errorcode.ErrorCodes.ErrSystemBusy
}