From 55409f803cfcb430b0d674bb5eb0beb758479c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <1@72wo.cn> Date: Thu, 4 Sep 2025 03:07:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor(logic):=20=E9=87=8D=E6=9E=84=E6=88=98?= =?UTF-8?q?=E6=96=97=E9=80=BB=E8=BE=91=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了未使用的变量和注释 - 添加了战斗回合循环的框架 - 删除了重复的代码片段 - 优化了代码结构,提高了可读性和可维护性 --- logic/service/fightc.go | 58 +---------------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/logic/service/fightc.go b/logic/service/fightc.go index 057a247b..c163833b 100644 --- a/logic/service/fightc.go +++ b/logic/service/fightc.go @@ -81,64 +81,8 @@ func (f *FightC) NewFight(i *info.NoteReadyToFightInfo, plays PlayerI) { } - //调用技能产生effect参数后,创建effect实例,而非技能创建 - c := info.NewBattleContainer1v1(*i) //创建战斗容器 - t := info.BattleSkillEntity{} // - t.SideEffectArgs = []int{1, 2, 3} - //先提交effecet后然后计算伤害 + for { //战斗回合循环 - //物理和特殊,百分比和固定伤害也算,真实伤害不分类别,故直接扣血就行,不需要计算 - if t.Category() == info.Category.PHYSICAL || t.Category() == info.Category.SPECIAL { - - c.Effects.Exec(func(e info.Effect) bool { - - if e.Type() == 0 { //判断是自己的效果 - return e.PreDamage() //执行预处理效果 - } - return true - }) - - // Apply pre-damage effects for pet sources - // battle.applyEffects(context, EffectTrigger.PreDamage) - // if (context.crit) { - // battle.applyEffects(context, EffectTrigger.OnCritPreDamage) // Trigger crit pre-damage effects - // } - //假如说这里需要能力提升 - // c.Exec(func(e Effect) func() { - // return e.OnBeforeAddMark() - // }) - //添加印记前的效果如果有任何一个false,说明组织了添加效果 - //这里能力提升 - // c.Exec(func(e Effect) bool { - // return e.OnAnyMarkAdded() - // }) - - // var candidates []*Effect - // for _, eff := range c.Effects { - // if eff.Trigger == trigger { - // candidates = append(candidates, eff) - // } - // } - - // // 按优先级排序 - // sort.SliceStable(candidates, func(i, j int) bool { - // return candidates[i].Priority > candidates[j].Priority - // }) - - // // 执行 - // for _, eff := range candidates { - // ctx.Effect = eff - // keep := eff.Apply(ctx) - - // if !keep { - // // 持续回合结束 / 返回 false 的 effect 删除 - // c.removeEffect(eff) - // } - - // if ctx.Done { - // break // 被拦截 - // } - // } } }