refactor: 重构宠物初始化逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

提取宠物配置初始化到ConfigBoss方法,简化initplayer代码
This commit is contained in:
xinian
2026-03-07 11:30:17 +08:00
committed by cnb
parent 2dab20653f
commit bbaa71f4b2
4 changed files with 59 additions and 69 deletions

View File

@@ -60,35 +60,7 @@ func (Controller) PlayerFightBoss(data1 *fight.ChallengeBossInboundInfo, p *play
int(bm.Lv), nil, 0)
monster.CatchTime = uint32(i)
if bm.Hp != 0 {
monster.Hp = uint32(bm.Hp)
monster.MaxHp = uint32(bm.Hp)
}
if len(bm.Prop) == 5 {
monster.Prop = [5]uint32(bm.Prop)
}
if len(bm.SKill) != 0 {
for i := 0; i < 4; i++ {
if bm.SKill[i] != 0 {
monster.SkillList[i].ID = bm.SKill[i]
}
}
}
effects := service.NewEffectService().Args(bm.Effect)
for _, v := range effects {
monster.EffectInfo = append(monster.EffectInfo, model.PetEffectInfo{
Idx: uint16(v.SeIdx),
EID: gconv.Uint16(v.Eid),
Args: gconv.Ints(v.Args),
})
}
monster.ConfigBoss(bm.PetBaseConfig)
monsterInfo.PetList = append(monsterInfo.PetList, *monster)
}