From 8bf0ea37fd87865a204efa1adb4709095a602e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <1@72wo.cn> Date: Mon, 15 Sep 2025 23:18:09 +0800 Subject: [PATCH] =?UTF-8?q?refactor(fight):=20=E4=BC=98=E5=8C=96=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E6=89=A7=E8=A1=8C=E9=80=BB=E8=BE=91=E5=92=8C=E7=B2=BE?= =?UTF-8?q?=E7=81=B5=E7=89=B9=E6=80=A7=E4=BF=A1=E6=81=AF=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化 Input 结构中的 AddEffect 和 Exec 方法,提高效果执行效率 - 重构 PetEffectInfo 结构,增加特效相关字段并调整命名 - 更新 PlayerInfo 结构中相关字段的描述和默认值 --- logic/service/fight/input/nodemanger.go | 9 ++++----- modules/blazing/model/pet.go | 23 +++++++++++++++-------- modules/blazing/model/player.go | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/logic/service/fight/input/nodemanger.go b/logic/service/fight/input/nodemanger.go index a100cfaa..bf9f31f3 100644 --- a/logic/service/fight/input/nodemanger.go +++ b/logic/service/fight/input/nodemanger.go @@ -100,10 +100,11 @@ func getTypeName(v interface{}) string { } func (c *Input) AddEffect(e Effect) { - + e.SetInput(c) // 如果已有同 ID 的效果,尝试叠加 for _, eff := range c.Effects { if eff.ID() == e.ID() { + //设置输入源 if eff.Stack(0) < eff.MaxStack() { //如果小于最大叠层 eff.Stack(eff.Stack(0)) //获取到当前叠层数然后叠加 } else { @@ -112,7 +113,7 @@ func (c *Input) AddEffect(e Effect) { eff.Duration(eff.Duration(0)) } - eff.SetInput(c) //设置输入源 + return } } @@ -136,8 +137,6 @@ func (c *Input) RemoveEffect(e Effect) { // 返回值:所有 Effect 的方法返回值列表 func (c *Input) Exec(fn func(Effect) bool) bool { - var results bool - for _, effect := range c.Effects { if effect.Alive() { result := fn(effect) @@ -149,7 +148,7 @@ func (c *Input) Exec(fn func(Effect) bool) bool { } - return results + return true } // 消除回合类效果 efftype 输入是消对方的还是自己的,false是自己,true是对方 diff --git a/modules/blazing/model/pet.go b/modules/blazing/model/pet.go index 50cb95d4..2c6258e1 100644 --- a/modules/blazing/model/pet.go +++ b/modules/blazing/model/pet.go @@ -274,15 +274,22 @@ type PetInfo struct { } // PetEffectInfo 精灵特性信息结构 +// +// +// +// +// +// +// type PetEffectInfo struct { - ItemID uint32 `struc:"uint32" json:"item_id"` - Status byte `struc:"byte" json:"status"` - LeftCount byte `struc:"byte" json:"left_count"` - EID uint16 `struc:"uint16" json:"effect_id"` - Args1 byte `struc:"byte" json:"reserve1"` - Reserve2 byte `struc:"byte" json:"reserve2"` - Args2 byte `struc:"byte" json:"reserve3"` - Reserve4 [13]byte `struc:"[13]byte" json:"reserve4"` + ItemID uint32 `struc:"uint32" json:"item_id"` //如果是能量珠,就显示 + Status byte `struc:"byte" json:"status"` //特性为1,能量珠为2 + LeftCount byte `struc:"byte" json:"left_count"` //剩余次数 + EID uint16 `struc:"uint16" json:"effect_id"` //特效ID + Args1 byte `struc:"byte" json:"reserve1"` //参数1 + Args2 byte `struc:"byte" json:"reserve3"` //参数2 + Args []int `struc:"skip" json:"Args"` //自定义参数装载 + } // SkillInfo 精灵技能信息结构(SkillInfo) diff --git a/modules/blazing/model/player.go b/modules/blazing/model/player.go index 693f4c7b..5128da4a 100644 --- a/modules/blazing/model/player.go +++ b/modules/blazing/model/player.go @@ -74,10 +74,10 @@ type PlayerInfo struct { NewInviteeCount uint32 `struc:"uint32" json:"new_invitee_count"` // 固定0 VipLevel uint32 `struc:"uint32" default:"8" json:"vip_level"` // 固定8 VipValue uint32 `struc:"uint32" default:"80000" json:"vip_value"` // 固定80000 - VipStage uint32 `struc:"uint32" default:"1" json:"vip_stage"` // 固定1 - AutoCharge uint32 `struc:"uint32" default:"1" json:"auto_charge"` // 固定1 - VipEndTime uint32 `struc:"uint32" default:"4294967295" json:"vip_end_time"` // 尽可能大值 - FreshManBonus uint32 `struc:"uint32" json:"fresh_man_bonus"` // 固定0 + VipStage uint32 `struc:"uint32" default:"1" json:"vip_stage"` // 超no的外形等级建议固定1 + AutoCharge uint32 `struc:"uint32" default:"1" json:"auto_charge"` // nono是否自动充电 + VipEndTime uint32 `struc:"uint32" default:"4294967295" json:"vip_end_time"` // 超no的结束时间建议尽可能大 + FreshManBonus uint32 `struc:"uint32" json:"fresh_man_bonus"` // 邀请活动建议先给固定值0 NonoChipList [80]byte `struc:"[80]byte" json:"nono_chip_list"` // 超no芯片列表 DailyResArr [50]byte `struc:"[50]byte" default:"0" json:"daily_res_arr"` // 每日任务状态 40+是谱尼的 TeacherID uint32 `struc:"uint32" json:"teacher_id"` // 教官id @@ -92,12 +92,12 @@ type PlayerInfo struct { CurrentFreshStage uint32 `struc:"uint32" json:"current_fresh_stage"` // 当前试炼层数 MaxFreshStage uint32 `struc:"uint32" json:"max_fresh_stage"` // 最高试炼层 MaxArenaWins uint32 `struc:"uint32" json:"max_arena_wins"` // 星际擂台连胜 - TwoTimes uint32 `struc:"uint32" default:"0" json:"two_times"` // 默认0 - ThreeTimes uint32 `struc:"uint32" default:"0" json:"three_times"` // 默认0 - AutoFight uint32 `struc:"uint32" default:"0" json:"auto_fight"` // 默认0 - AutoFightTime uint32 `struc:"uint32" default:"0" json:"auto_fight_time"` // 默认0 - EnergyTime uint32 `struc:"uint32" default:"0" json:"energy_time"` // 默认0 - LearnTimes uint32 `struc:"uint32" default:"0" json:"learn_times"` // 默认0 + TwoTimes uint32 `struc:"uint32" default:"0" json:"two_times"` // 双倍经验加速器剩余使用次数 + ThreeTimes uint32 `struc:"uint32" default:"0" json:"three_times"` // 三倍经验加速器剩余使用次数 + AutoFight uint32 `struc:"uint32" default:"0" json:"auto_fight"` // 是否自动战斗 + AutoFightTime uint32 `struc:"uint32" default:"0" json:"auto_fight_time"` // 自动战斗剩余的场次 + EnergyTime uint32 `struc:"uint32" default:"0" json:"energy_time"` // 能量吸收仪剩余次数 + LearnTimes uint32 `struc:"uint32" default:"0" json:"learn_times"` // 学习力吸收仪剩余次数 MonBattleMedal uint32 `struc:"uint32" default:"0" json:"mon_battle_medal"` // 默认0 RecordCount uint32 `struc:"uint32" default:"0" json:"record_count"` // 默认0 ObtainTm uint32 `struc:"uint32" default:"0" json:"obtain_tm"` // 默认0