Files
bl/logic/service/fight/node/node.go
昔念 96b5dbb425 feat(fight): 重构属性同步与反转效果逻辑
统一处理效果45、51、55、56的属性同步与反转逻辑,优化代码结构并提高可维护性。新增通用效果结构体 `EffectPropSyncReverse` 和操作类型定义,集中管理不同属性操作行为。

fix(controller): 修复玩家离开地图逻辑错误

修正 `FRESH_LEAVE_FIGHT_LEVEL` 接口中 defer 调用为进入地图,并发送角色信息包给客户端以确保状态一致。

feat(effect): 新增天敌机制核心逻辑占位

在 `NewSel14` 效果中添加 `Turn_Start` 方法,实现若遇到天敌则害怕多回合的核心逻辑框架。

chore(config): 更新Boss配置怪物ID及血量

调整Boss ID为2的怪物配置,替换原有Monster ID并设置血量为10,用于测试或平衡调整。

refactor(fight): 优化战斗循环和精灵切换逻辑

整理战斗主循环中的血量赋值语句格式,调整精灵切换时变量顺序以避免潜在问题,并修复死亡标记逻辑。

refactor(node): 恢复BoolisFalse方法实现

取消注释 `BoolisFalse` 方法内容,恢复其正常功能以便其他模块正确判断布尔条件。

style(logic): 格式化代码空行和缩进

清理多余空行,对齐导入语句与其他代码块格式,增强整体代码可读性。

debug(effect): 增加烧伤伤害调试打印

在持续伤害效果中加入println语句,输出实际造成的真实伤害数值便于排查问题。
2025-12-18 23:57:17 +08:00

135 lines
2.6 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 node
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"sync"
"github.com/alpacahq/alpacadecimal"
)
// 检查,激活,延后
// /基础节点
type EffectNode struct {
duration int // 默认为-1 持续回合/次0 = 即时生效,>0 = 回合数 ,负数是永久) \
Input *input.Input
stacks int // 当前层数
id input.EffectIDCombiner
canStack bool // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
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
ctx input.Ctx
//增加owner target如果owner target都为自身就回合效果结束后再使用回合效果
}
func (e *EffectNode) Alive(t ...bool) bool {
if len(t) > 0 {
e.alive = t[0]
}
return e.alive
}
func (e *EffectNode) GetInput() *input.Input {
return e.Input
}
func (e *EffectNode) Ctx() *input.Ctx {
return &e.ctx
}
func (e *EffectNode) Stack(t ...int) int {
if len(t) > 0 {
e.stacks = t[0]
}
return e.stacks
}
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 {
if len(t) > 0 {
e.canStack = t[0]
}
return e.canStack
}
// 回合类改成int.max,然后魂印类重写切换精灵替换
func (e *EffectNode) Duration(t ...int) int {
if len(t) > 0 {
e.duration = t[0]
}
return e.duration
}
// 设置参数,加上设置输入源
func (e *EffectNode) SetArgs(t *input.Input, a ...int) {
e.Input = t
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
}
func (e *EffectNode) Prop_Befer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool {
return true
}
func (e *EffectNode) BoolisFalse(t ...bool) bool {
if len(t) > 0 {
if t[0] == false {
return true
}
return false
}
return false
}