feat(fight): 添加 BOSS 战斗逻辑与地图交互功能

- 在 fight_boss.go 中增加对 BOSS 血量是否为 0 的判断,避免无效赋值
- 在 map.go 中移除旧的测试代码,并将 Canmon 状态设置移至 MapList 方法中
- 新增 Attack_Boss 接口方法用于处理玩家攻击 BOSS 请求
- 修改 MapBossInfo 结构体字段类型
This commit is contained in:
2025-12-09 14:52:55 +08:00
parent 2633402b52
commit f6a305de77
9 changed files with 214 additions and 28 deletions

View File

@@ -5,6 +5,7 @@ import (
"blazing/common/utils"
"blazing/logic/service/common"
"blazing/logic/service/maps/info"
maps "blazing/logic/service/maps/info"
csmap "github.com/mhmtszr/concurrent-swiss-map"
@@ -20,12 +21,13 @@ type Space struct {
//ID uint32 // 地图ID
Name string //地图名称
Owner ARENA
info.MapBossInfo
}
// NewSyncMap 创建一个新的玩家同步map
func NewSpace() *Space {
return &Space{
ret := &Space{
User: csmap.New[uint32, common.PlayerI](
// set the number of map shards. the default value is 32.
csmap.WithShardCount[uint32, common.PlayerI](32),
@@ -57,6 +59,8 @@ func NewSpace() *Space {
// csmap.WithSize[string, int](1000),
),
}
return ret
}
// 获取星球
@@ -77,7 +81,7 @@ func GetSpace(id uint32) *Space {
if t.Super == 0 {
t.Super = uint32(v.ID)
}
t.gettimeboss(uint32(v.ID))
_, ok := maphot[t.Super]
if !ok {
var t1 int32