feat(pet): 添加精灵进化功能并优化融合系统

- 新增PetELV方法实现精灵进化功能,支持分支进化选择
- 添加进化相关的数据结构定义
- 实现进化材料检查和扣除逻辑
- 优化宠物融合失败处理机制

fix(fight): 修复战斗系统和效果计算问题

- 修复NewSeIdx_11和effect_60中的伤害计算逻辑
- 修复战斗状态判断条件,避免非PVP模式下的错误处理
- 优化战斗回合处理流程,修复效果缓存清空时机
- 修复effect_69
This commit is contained in:
2026-01-03 01:35:32 +08:00
parent c056fdcebc
commit a62b94446a
17 changed files with 323 additions and 66 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/alpacahq/alpacadecimal"
"github.com/gogf/gf/v2/util/grand"
"github.com/samber/lo"
)
func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result *pet.PetFusionInfo, err errorcode.ErrorCode) {
@@ -49,11 +50,34 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
resid := int(service.NewPetFusionService().Data(Mcatchpetinfo.ID, Auxpetinfo.ID, Mcatchpetinfo.Level+Auxpetinfo.Level))
if resid == 0 {
//todo失败降低等级
_, ok := lo.Find(data.GoldItem1[:], func(item uint32) bool {
return item == 300044
})
if c.Service.Item.CheakItem(300044) > 0 && ok {
c.Service.Item.UPDATE(300044, -1)
} else {
if Auxpetinfo.Level > 5 {
Auxpetinfo.Level = Auxpetinfo.Level - 5
} else {
Auxpetinfo.Level = 1
}
}
return &pet.PetFusionInfo{}, 0
}
for _, v := range data.Item1 {
if c.Service.Item.CheakItem(v) == 0 {
return &pet.PetFusionInfo{}, 0
}
}
effect := int(service.NewPetFusionMaterialService().Data(data.Item1))
if effect == 0 {
return &pet.PetFusionInfo{}, 0
}
@@ -77,9 +101,23 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
}
c.Service.Pet.PetAdd(r)
println(c.Info.UserID, "进行融合", len(c.Info.PetList), Mcatchpetinfo.ID, Auxpetinfo.ID, r.ID)
c.PetDel(data.Auxcatchtime)
c.PetDel(data.Mcatchtime)
c.PetDel(data.Mcatchtime)
_, ok2 := lo.Find(data.GoldItem1[:], func(item uint32) bool {
return item == 300043
})
if c.Service.Item.CheakItem(300043) > 0 && ok2 {
c.Service.Item.UPDATE(300044, -1)
} else {
c.PetDel(data.Auxcatchtime)
}
for _, v := range data.Item1 {
c.Service.Item.UPDATE(v, -1)
}
//todo材料扣除
return &pet.PetFusionInfo{
ObtainTime: r.CatchTime,