``` refactor(player): 移除AI_player冗余方法并优化baseplayer结构

This commit is contained in:
1
2025-12-29 14:26:46 +00:00
parent 214bf4ce93
commit 1e9176c4ae
2 changed files with 13 additions and 12 deletions

View File

@@ -1,7 +1,6 @@
package player package player
import ( import (
"blazing/logic/service/common"
"blazing/logic/service/fight/info" "blazing/logic/service/fight/info"
"blazing/modules/blazing/model" "blazing/modules/blazing/model"
) )
@@ -34,12 +33,6 @@ func (p *AI_player) GetPetInfo() []model.PetInfo {
func (lw *AI_player) SendLoadPercent(info.LoadPercentOutboundInfo) { func (lw *AI_player) SendLoadPercent(info.LoadPercentOutboundInfo) {
}
func (f *AI_player) InvitePlayer(ff common.PlayerI) {
}
func (p *AI_player) QuitFight() {
} }
func (p *AI_player) CanFight() bool { func (p *AI_player) CanFight() bool {

View File

@@ -12,6 +12,7 @@ import (
) )
type baseplayer struct { type baseplayer struct {
//Fightinfo info.Fightinfo
Info *model.PlayerInfo Info *model.PlayerInfo
//canFight uint32 //canFight uint32
FightC common.FightI //绑定战斗标识 替代本身的是否战斗标记 //IsFighting bool FightC common.FightI //绑定战斗标识 替代本身的是否战斗标记 //IsFighting bool
@@ -23,11 +24,11 @@ func newbaseplayer() baseplayer {
rng := rand.New(rand.NewSource(time.Now().UnixNano() + int64(grand.Intn(1000000)))) rng := rand.New(rand.NewSource(time.Now().UnixNano() + int64(grand.Intn(1000000))))
ret := baseplayer{} ret := baseplayer{}
ret.PlayerCaptureContext = &info.PlayerCaptureContext{ ret.PlayerCaptureContext = &info.PlayerCaptureContext{
rng, Random: rng,
1000, Denominator: 1000,
0.10, // 15%衰减率 DecayFactor: 0.10, // 15%衰减率
1, MinDecayNum: 1,
make(map[int]int), Guarantees: make(map[int]int),
} }
return ret return ret
} }
@@ -37,6 +38,13 @@ func (p *baseplayer) GetInfo() *model.PlayerInfo {
return p.Info return p.Info
} }
func (f *baseplayer) InvitePlayer(ff common.PlayerI) {
}
func (p *baseplayer) QuitFight() {
}
// SetFightC 设置玩家战斗控制器 // SetFightC 设置玩家战斗控制器
func (f *baseplayer) SetFightC(fightController common.FightI) { func (f *baseplayer) SetFightC(fightController common.FightI) {
f.FightC = fightController f.FightC = fightController