重构了技能攻击处理逻辑,调整了命中判断和效果应用的顺序。 新增 `Calculate_Pre` 接口方法用于实现无视类效果。 修复技能是否命中的判断逻辑,确保效果命中状态正确传递。 清理上回合缓存的效果数据,保证每回合初始状态干净。 统一使用 `IsFirst` 方法判断先后手,提升代码一致性。 完善玩家离线时的数据保存顺序,避免重复操作。 更新依赖模块版本信息。
62 lines
1.3 KiB
Go
62 lines
1.3 KiB
Go
package node
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
)
|
|
|
|
func (e *EffectNode) Skill_Pre(ctx input.Ctx) bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Calculate_Pre(ctx input.Ctx) bool {
|
|
return true
|
|
}
|
|
|
|
func (e *EffectNode) Skill_Hit_Pre(ctx input.Ctx) bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Skill_Hit(ctx input.Ctx) bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Skill_Hit_to(ctx input.Ctx) bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) OnSkill(ctx input.Ctx) bool {
|
|
if e.Effect != nil {
|
|
if e.Hit() { //没命中
|
|
e.OnHit(ctx.Input, ctx.SkillEntity)
|
|
} else {
|
|
e.OnMiss(ctx.Input, ctx.SkillEntity)
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *EffectNode) Skill_Can(ctx input.Ctx) bool {
|
|
|
|
return e.Input.CurrentPet.HP != 0
|
|
}
|
|
|
|
func (e *EffectNode) Skill_Use(ctx input.Ctx) bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Skill_Useed(ctx input.Ctx) bool {
|
|
if e.Effect != nil {
|
|
if e.Input.CurrentPet.Info.Hp == 0 {
|
|
e.OnDefeat(ctx.Input, ctx.SkillEntity) //死亡
|
|
|
|
} else {
|
|
e.OnAlive(ctx.Input, ctx.SkillEntity) //存活
|
|
}
|
|
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect interface {
|
|
OnMiss(opp *input.Input, skill *info.SkillEntity)
|
|
OnHit(opp *input.Input, skill *info.SkillEntity)
|
|
OnDefeat(opp *input.Input, skill *info.SkillEntity) bool //如果需要死亡
|
|
OnAlive(opp *input.Input, skill *info.SkillEntity) bool //如果需要存活
|
|
}
|