refactor(fight): 重构战斗逻辑和数据结构

- 重构了 Input 结构体和相关方法,新增 NewInput 函数
- 优化了 NodeManager 结构体和 Exec 方法的实现
- 调整了 FightC 结构体和 enterturn 方法的逻辑
- 修改了 BattleSkillEntity 结构体,移除了冗余字段
- 更新了 EffectNode 中的相关方法,使其适应新的逻辑
This commit is contained in:
2025-09-14 04:48:38 +08:00
parent 9d87ce9e46
commit 93ae004683
11 changed files with 64 additions and 560 deletions

View File

@@ -5,6 +5,7 @@ import (
"blazing/logic/service/fight/info"
"github.com/jinzhu/copier"
"github.com/mohae/deepcopy"
"github.com/shopspring/decimal"
)
@@ -22,11 +23,21 @@ type Input struct {
First bool
}
func NewInput(c common.FightI, p common.PlayerI) *Input {
ret := &Input{FightC: c, Player: p}
t, _ := NodeM[0]
ret.Effect.AddEffect(deepcopy.Copy(t).(Effect)) //添加默认基类,实现继承
p.SetFightC(c) //给玩家设置战斗容器
return ret
}
func (i *Input) GetPetInfo() *info.BattlePetEntity {
return i.CurrentPet
}
// 这个每回合都会调用
func (i *Input) InitAttackValue() {
i.AttackValue = info.NewAttackValue(i.Player.ID())