refactor(fight): 重构战斗系统

- 移除 Player 结构中的 IsFighting 字段,使用 FightID 替代
- 优化 Move 结构,重新排序字段并添加注释
- 修改 EffectNode 和相关结构,统一使用 Ctx 字段名称
- 重构 Battle 和 BattlePetEntity 结构,简化属性并优化布局
- 更新战斗逻辑,调整效果应用和回合处理机制
This commit is contained in:
2025-09-03 00:37:05 +08:00
parent 39893e4df9
commit c42e392efe
9 changed files with 65 additions and 50 deletions

View File

@@ -3,6 +3,7 @@ package effect
import (
"blazing/logic/service/fight/battle/node"
"blazing/logic/service/fight/info"
"unsafe"
)
func init() {
@@ -17,6 +18,18 @@ type EffectStat struct {
etype bool
}
func (this *EffectStat) GetPet() {
ff := this.EffectNode.GetOwnerPet()
offsetC := unsafe.Offsetof(ff.Attack) // c字段的偏移量通常为4+16=20
// 2. 将结构体指针转换为原始内存地址uintptr
baseAddr := uintptr(unsafe.Pointer(&offsetC))
// 3. 计算字段地址并赋值
// 给a字段赋值通过偏移量
addrA := unsafe.Pointer(baseAddr + 4) //根据攻击算其他字段
*(*uint32)(addrA) = 100
}
func (this *EffectStat) TYPE() bool {
return this.etype
}