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

feat(fight): 添加旧组队协议支持并优化战斗系统

- 实现了旧组队协议相关功能,包括GroupReadyFightFinish、GroupUseSkill、
  GroupUseItem、GroupChangePet和GroupEscape方法
- 新增组队战斗相关的入站信息结构体定义
- 实现了组队BOSS战斗逻辑,添加groupBossSlotLimit常量
- 重构宠物技能设置逻辑,调整金币消耗时机
- 优化战斗循环逻辑,添加对无行动槽位的处理
- 改进AI行动逻辑,增加多位置目标选择
This commit is contained in:
昔念
2026-04-08 01:28:55 +08:00
parent 918cdeac0e
commit 0051ac0be8
21 changed files with 993 additions and 67 deletions

View File

@@ -7,6 +7,8 @@ import (
"blazing/logic/service/fight/info"
spaceinfo "blazing/logic/service/space/info"
"blazing/modules/player/model"
"github.com/gogf/gf/v2/util/grand"
)
type baseplayer struct {
@@ -85,6 +87,21 @@ func (f *baseplayer) GetPlayerCaptureContext() *info.PlayerCaptureContext {
return f.PlayerCaptureContext
}
func (f *baseplayer) Roll(numerator, denominator int) (bool, float64, float64) {
if denominator <= 0 {
return false, 0, 0
}
if numerator < 0 {
numerator = 0
}
if numerator > denominator {
numerator = denominator
}
base := float64(numerator) / float64(denominator) * 100
return grand.Intn(denominator) < numerator, base, 0
}
// FindPet 根据捕捉时间查找宠物
// 返回值: (索引, 宠物信息, 是否找到)
func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {