From 069d961585223cd25c96f05b6b159f106fc502a3 Mon Sep 17 00:00:00 2001 From: xinian Date: Sun, 8 Mar 2026 16:22:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E6=95=88?= =?UTF-8?q?=E6=9E=9C=20150=E3=80=81196=E3=80=81437=20=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/service/fight/effect/150.go | 28 ++++++++++ logic/service/fight/effect/196.go | 36 +++++++++++++ logic/service/fight/effect/437.go | 30 +++++++++++ logic/service/fight/effect/497.go | 4 -- logic/service/fight/effect/back.go1 | 83 ----------------------------- 5 files changed, 94 insertions(+), 87 deletions(-) create mode 100644 logic/service/fight/effect/150.go create mode 100644 logic/service/fight/effect/196.go create mode 100644 logic/service/fight/effect/437.go diff --git a/logic/service/fight/effect/150.go b/logic/service/fight/effect/150.go new file mode 100644 index 00000000..6ba21b30 --- /dev/null +++ b/logic/service/fight/effect/150.go @@ -0,0 +1,28 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 150 - n回合内,对手每回合防御和特防等级m +type Effect150 struct { + node.EffectNode +} + +func (e *Effect150) Action_end() bool { + e.Ctx().Opp.SetProp(e.Ctx().Opp, 1, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + + e.Ctx().Opp.SetProp(e.Ctx().Opp, 3, int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + return true +} +func (e *Effect150) SetArgs(t *input.Input, a ...int) { + e.EffectNode.SetArgs(t, a...) + + e.EffectNode.Duration(a[0]) // 持续m回合 +} +func init() { + input.InitEffect(input.EffectType.Skill, 150, &Effect150{}) + +} diff --git a/logic/service/fight/effect/196.go b/logic/service/fight/effect/196.go new file mode 100644 index 00000000..05043ebd --- /dev/null +++ b/logic/service/fight/effect/196.go @@ -0,0 +1,36 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 196 - n%令对方XX等级-m;若先出手,则j%使对方XX等级-k +type Effect196 struct { + node.EffectNode +} + +func (e *Effect196) OnSkill() bool { + if e.Input.FightC.IsFirst(e.Input.Player) { // 先出手 + chance := e.Args()[4].IntPart() // j% + effectValue := e.Args()[5].IntPart() // 等级-k + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[3].IntPart()), int8(effectValue), info.AbilityOpType.SUB) + } + } else { // 后出手 + chance := e.Args()[1].IntPart() // j% + effectValue := e.Args()[2].IntPart() // 等级-k + success, _, _ := e.Input.Player.Roll(int(chance), 100) + if success { + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.Args()[0].IntPart()), int8(effectValue), info.AbilityOpType.SUB) + } + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 196, &Effect196{}) + +} diff --git a/logic/service/fight/effect/437.go b/logic/service/fight/effect/437.go new file mode 100644 index 00000000..c83fe626 --- /dev/null +++ b/logic/service/fight/effect/437.go @@ -0,0 +1,30 @@ +package effect + +import ( + "blazing/logic/service/fight/info" + "blazing/logic/service/fight/input" + "blazing/logic/service/fight/node" +) + +// 437 - 若对手处于能力强化状态,则对手XX等级m +type Effect437 struct { + node.EffectNode +} + +func (e *Effect437) OnSkill() bool { + + for _, v := range e.Ctx().Opp.Prop[:] { + if v > 0 { + + e.Ctx().Opp.SetProp(e.Ctx().Opp, int8(e.SideEffectArgs[0]), int8(e.SideEffectArgs[1]), info.AbilityOpType.SUB) + return true + } + + } + + return true +} +func init() { + input.InitEffect(input.EffectType.Skill, 437, &Effect437{}) + +} diff --git a/logic/service/fight/effect/497.go b/logic/service/fight/effect/497.go index b2251eca..d6c92510 100644 --- a/logic/service/fight/effect/497.go +++ b/logic/service/fight/effect/497.go @@ -36,10 +36,6 @@ func (e *Effect497) OnSkill() bool { return true } -func (e *Effect497) SetArgs(t *input.Input, a ...int) { - e.EffectNode.SetArgs(t, a...) - -} func init() { t := &Effect497{} t.Duration(-1) //次数类无限回合 diff --git a/logic/service/fight/effect/back.go1 b/logic/service/fight/effect/back.go1 index b66c8fe6..a2dc46b9 100644 --- a/logic/service/fight/effect/back.go1 +++ b/logic/service/fight/effect/back.go1 @@ -773,27 +773,6 @@ func (e *Effect156) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(a[0]) // 持续n回合 } -// 437 - 若对手处于能力强化状态,则对手XX等级m -type Effect437 struct { - node.EffectNode -} - -func (e *Effect437) OnSkill() bool { - if e.Ctx().Opp.CurrentPet.HasPositiveBuff() { // 对手处于能力强化状态 - effectType := int(e.Args()[0].IntPart()) // XX类型 - effectValue := int(e.Args()[1].IntPart()) // 等级m - - // 应用负面效果来抵消强化 - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if statusEffect != nil { - statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - - return true -} - // 486 - 下n回合若自身选择使用技能则无视对手能力提升状态 type Effect486 struct { node.EffectNode @@ -845,43 +824,6 @@ func (e *Effect429) SetArgs(t *input.Input, a ...int) { e.incrementPerUse = a[1] // 每次增加n点 } -// 196 - n%令对方XX等级-m;若先出手,则j%使对方XX等级-k -type Effect196 struct { - node.EffectNode -} - -func (e *Effect196) OnSkill() bool { - if e.Ctx().Our.Speed > e.Ctx().Opp.Speed { // 先出手 - chance := e.Args()[2].IntPart() // j% - effectValue := e.Args()[3].IntPart() // 等级-k - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - effectType := int(e.Args()[4].IntPart()) // XX类型 - - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if statusEffect != nil { - statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - } else { // 后出手 - chance := e.Args()[0].IntPart() // n% - effectValue := e.Args()[1].IntPart() // 等级-m - success, _, _ := e.Input.Player.Roll(int(chance), 100) - if success { - effectType := int(e.Args()[4].IntPart()) // XX类型 - - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, effectType) - if statusEffect != nil { - statusEffect.SetArgs(e.Ctx().Our, -effectValue) // 负值表示降低 - e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect) - } - } - } - - return true -} - // 471 - 先出手时n回合内免疫异常状态 type Effect471 struct { node.EffectNode @@ -899,31 +841,6 @@ func (e *Effect471) OnSkill() bool { return true } -// 150 - n回合内,对手每回合防御和特防等级m -type Effect150 struct { - node.EffectNode -} - -func (e *Effect150) OnSkill() bool { - // 降低对手防御 - defDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.DefDown)) - if defDownEffect != nil { - defDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m - defDownEffect.Duration(int(e.Args()[0].IntPart())) // n回合 - e.Ctx().Opp.AddEffect(e.Ctx().Our, defDownEffect) - } - - // 降低对手特防 - spDefDownEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.SpDefDown)) - if spDefDownEffect != nil { - spDefDownEffect.SetArgs(e.Ctx().Our, int(e.Args()[1].IntPart())) // m - spDefDownEffect.Duration(int(e.Args()[0].IntPart())) // n回合 - e.Ctx().Opp.AddEffect(e.Ctx().Our, spDefDownEffect) - } - - return true -} - // 197 - n回合内若被对方击败,则对手所有能力加强状态消失 type Effect197 struct { node.EffectNode