```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(boss-fight): 添加boss id验证并修复捕捉机制

- 在玩家挑战boss时添加boss ids
This commit is contained in:
昔念
2026-02-26 00:05:43 +08:00
parent f7e5880092
commit dee5278f52
2 changed files with 18 additions and 4 deletions

View File

@@ -34,6 +34,9 @@ func (Controller) PlayerFightBoss(data1 *fight.ChallengeBossInboundInfo, p *play
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
}
if len(mdata.BossIds) == 0 {
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
}
bosinfo := service.NewBossService().Get(mdata.BossIds[0])
if bosinfo == nil {
return nil, errorcode.ErrorCodes.ErrPokemonNotExists
@@ -85,9 +88,13 @@ func (Controller) PlayerFightBoss(data1 *fight.ChallengeBossInboundInfo, p *play
ai := player.NewAI_player(monsterInfo)
ai.CanCapture = bosinfo[0].IsCapture
if xmlres.PetMAP[int(monster.ID)].CatchRate == 0 {
ai.CanCapture = 0
if bosinfo[0].IsCapture != 0 {
ai.CanCapture = xmlres.PetMAP[int(monster.ID)].CatchRate
if xmlres.PetMAP[int(monster.ID)].CatchRate == 0 {
ai.CanCapture = 0
}
}
ai.Prop[0] = 2
fight.NewFight(p, ai, func(foi info.FightOverInfo) {
if mdata.WinBonusID != 0 {