refactor: 重构宠物初始化逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
提取宠物配置初始化到ConfigBoss方法,简化initplayer代码
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user