Files
bl/logic/service/fight/effect/effect_prop.go
昔念 36f7aae476
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
refactor(fight): 统一技能使用方法命名规范

将多个战斗相关的结构体中的技能使用方法名从不一致的命名
(SkillUseed, OnSkill)统一改为Skill_Use,提高代码一致性。

同时优化了Effect3效果处理逻辑,简化了属性遍历方式,
并修复了先手控制逻辑中的EffectCache处理方式。

BREAKING CHANGE: 技能使用
2026-03-09 17:14:41 +08:00

62 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect3能力操作类效果重置/反转/偷取等)
type Effect3 struct {
node.EffectNode
Reverse bool
Level int8
}
// ----------------------
// 执行时逻辑
// ----------------------
func (e *Effect3) Skill_Use() bool {
for i, v := range e.Ctx().Our.Prop[:] {
if v < 0 {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0)
}
}
return true
}
// Effect3能力操作类效果重置/反转/偷取等)
type Effect33 struct {
node.EffectNode
Reverse bool
Level int8
}
// ----------------------
// 执行时逻辑
// ----------------------
func (e *Effect33) Skill_Use() bool {
for i, v := range e.Ctx().Opp.Prop[:] {
if v > 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 0)
}
}
return true
}
// ----------------------
// 注册所有效果
// ----------------------
func init() {
// {3, false, 0}, // 解除自身能力下降状态
// {33, true, 0}, // 消除对手能力提升状态{3, false, 0}, // 解除自身能力下降状态
// {33, true, 0}, // 消除对手能力提升状态
input.InitEffect(input.EffectType.Skill, 3, &Effect3{})
input.InitEffect(input.EffectType.Skill, 33, &Effect33{})
}