From 726a2d6cb5c79e1abc95e7c8645344fedc6e2ed5 Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Wed, 24 Sep 2025 20:17:44 +0000 Subject: [PATCH] =?UTF-8?q?refactor(fight/effect):=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E7=B2=BE=E7=81=B5=E5=88=87=E6=8D=A2=E7=9B=B8=E5=85=B3=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=8E=A5=E5=8F=A3=E5=B9=B6=E4=BC=98=E5=8C=96=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E6=8C=81=E7=BB=AD=E6=97=B6=E9=97=B4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/service/fight/effect/effect_62.go | 2 +- logic/service/fight/input/effecti.go | 8 +++---- logic/service/fight/playeraction.go | 28 ++++++++++++++++++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/logic/service/fight/effect/effect_62.go b/logic/service/fight/effect/effect_62.go index 48d250a6..fe21bfc5 100644 --- a/logic/service/fight/effect/effect_62.go +++ b/logic/service/fight/effect/effect_62.go @@ -47,7 +47,7 @@ func (e *Effect62) AfterHit(*input.Input, *info.SkillEntity) { func (e *Effect62) SetArgs(t *input.Input, a ...int) { e.EffectNode.SetArgs(t, a...) - e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) //激活前无限挂载 + e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } diff --git a/logic/service/fight/input/effecti.go b/logic/service/fight/input/effecti.go index b7a80c0c..3a622a39 100644 --- a/logic/service/fight/input/effecti.go +++ b/logic/service/fight/input/effecti.go @@ -48,10 +48,10 @@ type Effect interface { // OnHeal() bool // 治疗生效时触发 // // 精灵切换相关触发 - // OnSwitchIn() bool // 精灵出战 / 上场时触发 - // OnSwitchOut() bool // 精灵下场时触发 - // OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发 - // OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发 + OnSwitchIn() bool // 精灵出战 / 上场时触发 + OnSwitchOut() bool // 精灵下场时触发 + OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发 + OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发 // PreBattleEnd() bool //战斗结束前 // OnBattleEnd() bool //战斗结束 diff --git a/logic/service/fight/playeraction.go b/logic/service/fight/playeraction.go index 16b508d8..1ea3bd88 100644 --- a/logic/service/fight/playeraction.go +++ b/logic/service/fight/playeraction.go @@ -4,6 +4,7 @@ import ( "blazing/common/data/xmlres" "blazing/logic/service/common" "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" "blazing/logic/service/player" "math" @@ -36,14 +37,31 @@ func (f *FightC) ChangePet(c common.PlayerI, id uint32) { BaseAction: NewBaseAction(c.GetInfo().UserID), } f.Switch = append(f.Switch, ret) - if c.GetInfo().UserID == f.ownerID { + f.GetInputByPlayer(c, false).Exec(func(t input.Effect) bool { - f.GetInputByPlayer(c, false).CurrentPet, ret.Reason = f.GetInputByPlayer(c, false).GetPet(id) - } else { + t.OnOwnerSwitchOut() - f.GetInputByPlayer(c, true).CurrentPet, ret.Reason = f.GetInputByPlayer(c, true).GetPet(id) - } + return true + }) + f.GetInputByPlayer(c, true).Exec(func(t input.Effect) bool { + t.OnSwitchOut() + + return true + }) + f.GetInputByPlayer(c, false).CurrentPet, ret.Reason = f.GetInputByPlayer(c, false).GetPet(id) + f.GetInputByPlayer(c, false).Exec(func(t input.Effect) bool { + + t.OnOwnerSwitchIn() + + return true + }) + f.GetInputByPlayer(c, true).Exec(func(t input.Effect) bool { + + t.OnSwitchIn() + + return true + }) f.actionChan <- ret }