refactor(effect): 重构效果节点生命周期管理及属主控制逻辑

- 将Alive()方法改为Alive(bool)可设置方法,替代NotALive()
- 将GetOwner()改为Owner(bool)可设置方法
- 修复效果初始化时默认激活状态
- 优化效果叠层和取消逻辑
- 修正超时处理日志输出
This commit is contained in:
1
2025-11-03 14:46:33 +00:00
parent 1ebf500121
commit 35935549bd
13 changed files with 77 additions and 125 deletions

View File

@@ -15,18 +15,21 @@ type EffectNode struct {
id int
maxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
SideEffectArgs []int // 附加效果参数
Owner bool //是否作用自身
owner bool //是否作用自身
Success bool // 是否执行成功 成功XXX失败XXX
arget bool // 传出作用对象,默认0是自身,1是作用于对面
Flag int //过滤掉的战斗类型 pvp pve boss战斗,野怪全部生效
notAlive bool // 是否失效 effect返回值是否被取消是否被删除
alive bool // 是否失效 effect返回值是否被取消是否被删除
hit bool
//增加owner target如果owner target都为自身就回合效果结束后再使用回合效果
}
func (this *EffectNode) Alive() bool {
func (e *EffectNode) Alive(t ...bool) bool {
if len(t) > 0 {
e.alive = t[0]
}
return !this.notAlive
return e.alive
}
func (e *EffectNode) GetInput() *input.Input {
@@ -34,74 +37,69 @@ func (e *EffectNode) GetInput() *input.Input {
return e.Input
}
func (e *EffectNode) NotALive() {
e.notAlive = true
}
func (e *EffectNode) GetOwner() bool {
return e.Owner
}
func (e *EffectNode) SetOwner(b bool) {
e.Owner = b
}
func (this *EffectNode) Stack(t ...int) int {
func (e *EffectNode) Owner(t ...bool) bool {
if len(t) > 0 {
this.stacks = t[0]
e.owner = t[0]
}
return this.stacks
return e.owner
}
func (this *EffectNode) ID(t ...int) int {
func (e *EffectNode) Stack(t ...int) int {
if len(t) > 0 {
this.id = t[0]
e.stacks = t[0]
}
return this.id
return e.stacks
}
func (this *EffectNode) Hit(t ...bool) bool {
func (e *EffectNode) ID(t ...int) int {
if len(t) > 0 {
this.hit = t[0]
e.id = t[0]
}
return this.hit
return e.id
}
func (this *EffectNode) MaxStack(t ...int) int {
func (e *EffectNode) Hit(t ...bool) bool {
if len(t) > 0 {
this.maxStack = t[0]
e.hit = t[0]
}
return this.maxStack
return e.hit
}
func (this *EffectNode) Duration(t ...int) int {
func (e *EffectNode) MaxStack(t ...int) int {
if len(t) > 0 {
this.duration = t[0]
e.maxStack = t[0]
}
return this.duration
return e.maxStack
}
func (e *EffectNode) Duration(t ...int) int {
if len(t) > 0 {
e.duration = t[0]
}
return e.duration
}
// 设置参数,加上设置输入源
func (this *EffectNode) SetArgs(t *input.Input, a ...int) {
this.Input = t
this.SideEffectArgs = a
func (e *EffectNode) SetArgs(t *input.Input, a ...int) {
e.Input = t
e.SideEffectArgs = a
}
func (this *EffectNode) GetArgs() []int {
func (e *EffectNode) GetArgs() []int {
return this.SideEffectArgs
return e.SideEffectArgs
}
func (this *EffectNode) AttackTime(*input.Input, *input.Input) bool {
func (e *EffectNode) AttackTime(*input.Input, *input.Input) bool {
return true