refactor(fight): 重构战斗系统效果和技能逻辑

- 移除了未使用的 Effect0 基类效果
- 优化了技能施放和效果执行的逻辑
- 调整了命中和闪避的计算方式
-
This commit is contained in:
2025-09-14 16:56:31 +08:00
parent 93ae004683
commit 929b0c9006
7 changed files with 86 additions and 74 deletions

View File

@@ -18,14 +18,17 @@ type Input struct {
*info.AttackValue
FightC common.FightI
// info.BattleActionI
Effect NodeManager //effects容器OurEffect node.NodeManager //effects容器
Damage decimal.Decimal //造成伤害
First bool
Effect NodeManager //effects容器 技能的
Prop NodeManager //属性容器
Status NodeManager //状态容器
NewSeIdx NodeManager //全局容器
Damage decimal.Decimal //造成伤害
First bool //是否先手
}
func NewInput(c common.FightI, p common.PlayerI) *Input {
ret := &Input{FightC: c, Player: p}
t, _ := NodeM[0]
t := NodeM[0]
ret.Effect.AddEffect(deepcopy.Copy(t).(Effect)) //添加默认基类,实现继承
p.SetFightC(c) //给玩家设置战斗容器
return ret

View File

@@ -20,12 +20,12 @@ type Effect interface {
// OnDamage() bool // 造成伤害时触发
//使用技能 可以取消用技能节点
SetArgs(param []int)
IsCrit(attacker, defender *Input, skill *info.BattleSkillEntity) uint32 //是否暴击
IsCrit(attacker, defender *Input, skill *info.BattleSkillEntity) //是否暴击
CalculateDamage(attacker, defender *Input, skill *info.BattleSkillEntity) //击判定成功且伤害计算前触发
// Shield() bool // 护盾值变化时触发
// PostDamage() bool // 伤害结算后触发(血量扣除后)
IsHit(attacker, defender *Input, skill *info.BattleSkillEntity) uint32 //闪避率计算,,实际上是修改命中的判断
TakeHit(attacker, defender *Input, skill *info.BattleSkillEntity) uint32 //闪避率计算,,实际上是修改命中的判断
IsHit(attacker, defender *Input, skill *info.BattleSkillEntity) //闪避率计算,,实际上是修改命中的判断
TakeHit(attacker, defender *Input, skill *info.BattleSkillEntity) //闪避率计算,,实际上是修改命中的判断
//() bool // 暴击伤害结算后触发
// OnHit() bool // 技能命中时触发