Files
bl/logic/service/fight/node/node.go

175 lines
3.3 KiB
Go
Raw Normal View History

2025-08-26 19:46:29 +08:00
package node
import (
element "blazing/common/data/Element"
"blazing/logic/service/fight/input"
"sync"
"github.com/alpacahq/alpacadecimal"
)
2025-08-26 19:46:29 +08:00
2026-04-04 06:11:01 +08:00
type EffectContextHolder struct {
input.Ctx
}
// 检查,激活,延后
// /基础节点
type EffectNode struct {
duration int // 默认为-1 持续回合/次0 = 即时生效,>0 = 回合数 ,负数是永久) \
Input *input.Input
stacks int // 当前层数
id input.EffectIDCombiner
canStack bool // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
isFirst bool
2025-08-27 14:41:06 +00:00
SideEffectArgs []int // 附加效果参数
// owner bool //是否作用自身
Success bool // 是否执行成功 成功XXX失败XXX
arget bool // 传出作用对象,默认0是自身,1是作用于对面
Flag int //过滤掉的战斗类型 pvp pve boss战斗,野怪全部生效
alive bool // 是否失效 effect返回值是否被取消是否被删除
hit bool
trunl sync.Once
2026-04-04 06:11:01 +08:00
EffectContextHolder
//增加owner target如果owner target都为自身就回合效果结束后再使用回合效果
2025-08-26 19:46:29 +08:00
}
func (e *EffectNode) Alive(t ...bool) bool {
if len(t) > 0 {
2026-01-22 16:01:52 +00:00
// println("效果失效", e.id.GetEffectType(), e.ID().Suffix(), t[0])
e.alive = t[0]
}
return e.alive
}
2025-09-29 02:40:35 +08:00
func (e *EffectNode) GetInput() *input.Input {
2025-08-26 19:46:29 +08:00
2025-09-29 02:40:35 +08:00
return e.Input
2025-09-29 02:40:35 +08:00
}
2025-11-11 05:54:24 +00:00
func (e *EffectNode) Ctx() *input.Ctx {
2025-09-29 02:40:35 +08:00
2026-04-04 06:11:01 +08:00
return &e.EffectContextHolder.Ctx
2025-11-11 05:54:24 +00:00
}
func (e *EffectNode) Stack(t ...int) int {
if len(t) > 0 {
e.stacks = t[0]
2025-08-26 19:46:29 +08:00
}
return e.stacks
2025-08-26 19:46:29 +08:00
}
func (e *EffectNode) ID(t ...input.EffectIDCombiner) input.EffectIDCombiner {
if len(t) > 0 {
e.id = t[0]
}
return e.id
}
// func (e *EffectNode) Hit(t ...bool) bool {
// if len(t) > 0 {
// // println("效果命中", e.id.GetEffectType(), e.id.Suffix(), t[0])
// e.hit = t[0]
// }
// return e.hit
// }
func (e *EffectNode) CanStack(t ...bool) bool {
2025-08-26 19:46:29 +08:00
if len(t) > 0 {
e.canStack = t[0]
}
return e.canStack
2025-08-26 19:46:29 +08:00
}
func (e *EffectNode) IsFirst(t ...bool) bool {
if len(t) > 0 {
e.isFirst = t[0]
}
return e.isFirst
2025-08-26 19:46:29 +08:00
}
2025-11-21 05:47:51 +00:00
// 回合类改成int.max,然后魂印类重写切换精灵替换
func (e *EffectNode) Duration(t ...int) int {
if len(t) > 0 {
e.duration = t[0]
}
return e.duration
2025-08-26 19:46:29 +08:00
}
// 设置参数,加上设置输入源
func (e *EffectNode) SetArgs(t *input.Input, a ...int) {
e.Input = t
2026-04-04 04:28:04 +08:00
if len(a) > 0 {
e.SideEffectArgs = a
}
}
func (e *EffectNode) Args() []alpacadecimal.Decimal {
var ret []alpacadecimal.Decimal
for _, v := range e.SideEffectArgs {
ret = append(ret, alpacadecimal.NewFromInt(int64(v)))
}
return ret
}
func (e *EffectNode) AttackTime(*input.Input, *input.Input) bool {
return true
2025-09-29 02:40:35 +08:00
}
func (e *EffectNode) PropBefer(in *input.Input, prop int8, level int8) bool {
2025-09-29 02:40:35 +08:00
return true
}
2025-11-17 19:31:51 +00:00
func (e *EffectNode) ISNaturalEnemy() bool {
2026-04-04 04:34:43 +08:00
t, _ := element.Calculator.GetOffensiveMultiplier(e.Ctx().Opp.CurPet[0].Type, e.Ctx().Our.CurPet[0].Type)
if t <= 1 {
return false
}
return true
}
2026-01-22 16:01:52 +00:00
// func (e *EffectNode) BoolisFalse(t ...bool) bool {
2026-01-22 16:01:52 +00:00
// if len(t) > 0 {
// if t[0] == false {
// return true
2026-01-22 16:01:52 +00:00
// }
// return false
// }
// return false
// }
// func (e *EffectNode) BoolisTrue(t ...bool) bool {
2026-01-22 16:01:52 +00:00
// if len(t) > 0 {
// if t[0] == true {
// return true
// }
// return false
// }
// return false
// }