战斗修改

This commit is contained in:
2025-09-29 02:40:35 +08:00
parent 7df70f2375
commit 91d0d29ec9
28 changed files with 332 additions and 281 deletions

View File

@@ -0,0 +1,53 @@
package node
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
func (e *EffectNode) Skill_Pre(ctx input.Ctx) {
}
func (e *EffectNode) Skill_PreUse(ctx input.Ctx) {
}
func (e *EffectNode) OnSkill(ctx input.Ctx) {
if e.Effect != nil {
if e.Hit() { //没命中
e.OnHit(ctx.Input, ctx.SkillEntity)
} else {
e.OnMiss(ctx.Input, ctx.SkillEntity)
}
}
}
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 //如果需要存活
}