Files
bl/logic/service/fight/effect/effect_stat.go
昔念 9d87ce9e46 refactor(fight): 重构战斗系统
- 移除 NodeManager 相关代码,改为使用 input 包中的 Effect
- 重构 FightC 结构,添加 GetRand 方法
- 新增 BaseAction 结构和 NewBaseAction 函数
- 更新 effect 包中的 Effect 结构和相关方法
- 调整 BattleSkillEntity 中的 AttackTime 方法,增加 Hit 字段
- 更新 AttackValue 结构,保留原有的 AttackTime 字段
- 重构战斗逻辑,包括回合开始前的处理、技能使用、伤害计算等
2025-09-14 03:36:26 +08:00

50 lines
1.0 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 effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
func init() {
//技能使用成功时m%自身XX等级+/-n
input.InitEffect(4, NewEffectStat(false))
//技能使用成功时m%对方XX等级+/-n
input.InitEffect(5, NewEffectStat(true))
}
func NewEffectStat(b bool) input.Effect {
return &EffectStat{
node.EffectNode{
ArgSize: 3,
},
b,
}
}
type EffectStat struct {
node.EffectNode
etype bool
}
// func (this *EffectStat) GetPet() {
// ff := this.EffectNode.GetOwnerPet()
// offsetC := unsafe.Offsetof(ff.Atk) // c字段的偏移量通常为4+16=20
// // 2. 将结构体指针转换为原始内存地址uintptr
// baseAddr := uintptr(unsafe.Pointer(&offsetC))
// // 3. 计算字段地址并赋值
// // 给a字段赋值通过偏移量
// addrA := unsafe.Pointer(baseAddr + 4) //根据攻击算其他字段
// *(*uint32)(addrA) = 100
// }
func (this *EffectStat) SkillUseEnd() {
if !this.etype { //自身
} else { //对方
}
}