refactor(fight/xmlres): 重构效果参数处理逻辑,新增JSON解析支持并优化战斗伤害计算

This commit is contained in:
1
2025-09-23 17:34:58 +00:00
parent 53d4fafe73
commit 1245471129
13 changed files with 157 additions and 124 deletions

View File

@@ -13,9 +13,9 @@ type EffectNode struct {
//次数相当于重写回合
duration int // 默认为-1 持续回合/次0 = 即时生效,>0 = 回合数 ,负数是永久) \
Input *input.Input
stacks int // 当前层数
ArgSize int
Input *input.Input
stacks int // 当前层数
MaxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
SideEffectArgs []int // 附加效果参数
Owner bool //是否作用自身
@@ -51,9 +51,9 @@ func (this *EffectNode) SetOwner(b bool) {
this.Owner = b
}
func (this *EffectNode) Stack(t int) int {
if t != 0 {
this.stacks = t
func (this *EffectNode) Stack(t ...int) int {
if len(t) > 0 {
this.stacks = t[0]
}
return this.stacks
@@ -64,8 +64,10 @@ func (this *EffectNode) GetMaxStack() int {
return this.MaxStack
}
func (this *EffectNode) Duration(t int) int {
func (this *EffectNode) Duration(t ...int) int {
if len(t) > 0 {
this.duration = t[0]
}
return this.duration
}
@@ -80,11 +82,7 @@ func (this *EffectNode) SetInput(args *input.Input) {
this.Input = args
}
func (this *EffectNode) GetArgSize() int {
return this.ArgSize
}
func (this *EffectNode) AttackTime(*input.Input, *input.Input) bool {
return true