Files
bl/logic/service/fight/effect/prop.go
2025-11-11 05:54:24 +00:00

71 lines
1.8 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/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect3能力操作类效果重置/反转/偷取等)
type Effect3 struct {
node.EffectNode
Reverse bool
Level int8
OpType info.EnumAbilityOpType
}
// ----------------------
// 执行时逻辑
// ----------------------
func (e *Effect3) OnSkill() bool {
if !e.Hit() {
return true
}
// 遍历六项能力值(攻击、防御、速度等)
for i := 0; i < 6; i++ {
if e.Reverse {
// 对对手生效
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType)
} else {
// 对自己生效
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType)
}
}
return true
}
// ----------------------
// 工厂函数
// ----------------------
func newEffect3(reverse bool, level int8, opType info.EnumAbilityOpType) *Effect3 {
return &Effect3{
Reverse: reverse,
Level: level,
OpType: opType,
}
}
// ----------------------
// 注册所有效果
// ----------------------
func init() {
effects := []struct {
id int
reverse bool
level int8
opType info.EnumAbilityOpType
}{
{3, false, -1, info.AbilityOpType.RESET}, // 解除自身能力下降状态
{33, true, 1, info.AbilityOpType.RESET}, // 消除对手能力提升状态
{63, false, 0, info.AbilityOpType.AbilityOpBounceWeaken}, // 将能力下降反馈给对手
{85, false, -1, info.AbilityOpType.AbilityOpStealStrengthen}, // 将对手提升效果转移到自己
{143, true, 1, info.AbilityOpType.AbilityOpReverse}, // 反转对手能力提升为下降
}
for _, e := range effects {
input.InitEffect(input.EffectType.Skill, e.id, newEffect3(e.reverse, e.level, e.opType))
}
}