feat(fight_boss): 重构Boss战斗逻辑并修复捕捉功能 - 移除未使用的taskID和canCapture变量 - 简化Boss数据获取逻辑,移除注释掉的旧代码 - 更新捕捉机制使用bosinfo[0].IsCapture
This commit is contained in:
@@ -29,8 +29,6 @@ func (Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, p *playe
|
||||
var monster *model.PetInfo
|
||||
monsterInfo := &model.PlayerInfo{}
|
||||
|
||||
var taskID int
|
||||
var canCapture int
|
||||
mdata := service.NewMapNodeService().GetDataNode(p.Info.MapID, data.BossId)
|
||||
if mdata == nil {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
@@ -75,67 +73,14 @@ func (Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, p *playe
|
||||
monsterInfo.PetList = append(monsterInfo.PetList, *monster)
|
||||
}
|
||||
if bosinfo[0].IsCapture == 1 {
|
||||
canCapture = xmlres.PetMAP[int(monster.ID)].CatchRate
|
||||
|
||||
if grand.Meet(1, 500) {
|
||||
monsterInfo.PetList[0].RandomByWeightShiny()
|
||||
}
|
||||
|
||||
}
|
||||
monsterInfo.Nick = mdata.NodeName //xmlres.PetMAP[int(monster.ID)].DefName
|
||||
// for _, bc := range mdata.Bosses {
|
||||
|
||||
// if bc.Id == nil {
|
||||
|
||||
// bc.Id = gconv.PtrInt(0)
|
||||
// }
|
||||
|
||||
// if (bc.Id == nil && data.BossId == 0) || uint32(*bc.Id) == data.BossId { //打默认第一个boss
|
||||
// if bc.TaskID != nil {
|
||||
// taskID = *bc.TaskID
|
||||
// }
|
||||
|
||||
// for i, bm := range bc.BossMon {
|
||||
|
||||
// monster = model.GenPetInfo(
|
||||
// gconv.Int(processMonID(bm.MonID)), dv, //24个体
|
||||
// -1,
|
||||
// 0, //野怪没特性
|
||||
|
||||
// bm.Lv, nil, 0)
|
||||
// monster.CatchTime = uint32(i)
|
||||
// if bm.Hp != 0 {
|
||||
// monster.Hp = uint32(bm.Hp)
|
||||
// monster.MaxHp = uint32(bm.Hp)
|
||||
// }
|
||||
|
||||
// for _, v := range strings.Split(bm.NewSeIdxs, " ") {
|
||||
// idx := gconv.Uint16(v)
|
||||
|
||||
// if idx == 0 {
|
||||
// continue
|
||||
// }
|
||||
|
||||
// EID, args := service.NewEffectService().Args(uint32(idx))
|
||||
// monster.EffectInfo = append(monster.EffectInfo, model.PetEffectInfo{
|
||||
// Idx: idx,
|
||||
// EID: gconv.Uint16(EID),
|
||||
// Args: gconv.Ints(args),
|
||||
// })
|
||||
// }
|
||||
// monsterInfo.PetList = append(monsterInfo.PetList, *monster)
|
||||
// }
|
||||
// if bc.BossCatchable == 1 {
|
||||
// canCapture = xmlres.PetMAP[int(monster.ID)].CatchRate
|
||||
// if grand.Meet(1, 500) {
|
||||
// monsterInfo.PetList[0].RandomByWeightShiny()
|
||||
// }
|
||||
|
||||
// }
|
||||
// monsterInfo.Nick = bc.Name //xmlres.PetMAP[int(monster.ID)].DefName
|
||||
// break
|
||||
// }
|
||||
|
||||
// }
|
||||
if len(monsterInfo.PetList) == 0 {
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
|
||||
}
|
||||
@@ -143,12 +88,15 @@ func (Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, p *playe
|
||||
p.Fightinfo.Mode = info.BattleMode.MULTI_MODE
|
||||
|
||||
ai := player.NewAI_player(monsterInfo)
|
||||
ai.CanCapture = canCapture
|
||||
ai.CanCapture = bosinfo[0].IsCapture
|
||||
if xmlres.PetMAP[int(monster.ID)].CatchRate == 0 {
|
||||
ai.CanCapture = 0
|
||||
}
|
||||
ai.Prop[0] = 2
|
||||
fight.NewFight(p, ai, func(foi info.FightOverInfo) {
|
||||
if taskID != 0 {
|
||||
if mdata.WinBonusID != 0 {
|
||||
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
|
||||
p.SptCompletedTask(taskID, 1)
|
||||
p.SptCompletedTask(mdata.WinBonusID, 1)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user