```
feat(pet): 添加学习力分配功能并优化相关逻辑 - 新增 PetEVdiy 接口用于自定义宠物学习力分配 - 限制单次学习力分配不超过510,单项不超过255 - 学习力池 EVPool 字段添加到 PlayerInfo 结构体 - 使用 github.com/samber/lo 简化数组求和操作 - 更新 fight_boss 逻辑以正确处理 BOSS 战斗后经验与学习力奖励发放 - 调整任务列表中部分
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
func processMonID(bm string) string {
|
||||
@@ -156,24 +157,27 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn
|
||||
fight.NewFight(c, ai, func(foi *info.FightOverInfo) {
|
||||
c.Done.Exec(model.MilestoneMode.Moster, []uint32{c.Info.MapID, moinfo.PetList[0].ID, uint32(foi.Reason)}, func(results *model.MilestoneEX) uint32 {
|
||||
if foi.Reason == 0 && foi.WinnerId == c.Info.UserID {
|
||||
|
||||
exp := uint32(xmlres.PetMAP[int(mo.ID)].YieldingExp) * mo.Level / 7
|
||||
items := &info.S2C_GET_BOSS_MONSTER{
|
||||
//EV: 45,
|
||||
EXP: exp * 2,
|
||||
}
|
||||
if refpet.Item != 0 {
|
||||
items := &info.S2C_GET_BOSS_MONSTER{}
|
||||
|
||||
items.ItemList = c.ItemAdd(model.ItemInfo{
|
||||
ItemId: refpet.Item,
|
||||
ItemCnt: uint32(grand.Intn(2) + 1),
|
||||
})
|
||||
c.SendPackCmd(8004, items)
|
||||
}
|
||||
|
||||
foi.Winpet.AddEV(gconv.Uint32s(strings.Split(xmlres.PetMAP[int(mo.ID)].YieldingEV, " ")))
|
||||
exp := uint32(xmlres.PetMAP[int(mo.ID)].YieldingExp) * mo.Level / 7
|
||||
}
|
||||
evs := gconv.Uint32s(strings.Split(xmlres.PetMAP[int(mo.ID)].YieldingEV, " "))
|
||||
items.EV = lo.Sum(evs)
|
||||
c.Info.EVPool += lo.Sum(evs) //给予累计学习力
|
||||
foi.Winpet.AddEV(evs)
|
||||
|
||||
c.Info.ExpPool += exp * 4
|
||||
c.AddPetExp(foi.Winpet, uint32(exp)*2)
|
||||
// c.SendPackCmd(2509, &info.PET_WAR_EXP_NOTICE{
|
||||
// EXP: exp * 2,
|
||||
// })
|
||||
|
||||
c.SendPackCmd(8004, items)
|
||||
}
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user