refactor: 重构 Prop 字段位置至 baseplayer
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-04-05 07:45:51 +08:00
committed by cnb
parent 87145579e6
commit 37cd641942
3 changed files with 10 additions and 8 deletions

View File

@@ -4,5 +4,5 @@ type AI_player struct {
baseplayer
CanCapture int
Prop [6]int8
}

View File

@@ -15,17 +15,13 @@ type baseplayer struct {
//canFight uint32
FightC common.FightI //绑定战斗标识 替代本身的是否战斗标记 //IsFighting bool
*info.PlayerCaptureContext
Prop [6]int8
}
// NewPlayerCaptureContext 创建用户捕捉上下文(每次登录调用)
func newbaseplayer() baseplayer {
ret := baseplayer{}
ret.PlayerCaptureContext = &info.PlayerCaptureContext{
Denominator: 1000,
DecayFactor: 0.10, // 15%衰减率
MinDecayNum: 1,
Guarantees: make(map[int]int),
}
return ret
}

View File

@@ -2,6 +2,7 @@ package player
import (
"blazing/logic/service/common"
"blazing/logic/service/fight/info"
"blazing/modules/base/service"
"blazing/modules/player/model"
"time"
@@ -22,7 +23,12 @@ func NewPlayer(opts gnet.Conn) *Player {
HavePVPinfo: make([]common.PlayerI, 0),
baseplayer: newbaseplayer(),
}
p.PlayerCaptureContext = &info.PlayerCaptureContext{
Denominator: 1000,
DecayFactor: 0.10, // 15%衰减率
MinDecayNum: 1,
Guarantees: make(map[int]int),
}
p.User = service.NewBaseSysUserService()
p.monsters = generateThreeUniqueNumbers()
p.Done = NewDone(p) //发布订阅事件