71 lines
1.8 KiB
Go
71 lines
1.8 KiB
Go
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))
|
||
}
|
||
}
|