战斗修改
This commit is contained in:
53
logic/service/fight/node/skill.go
Normal file
53
logic/service/fight/node/skill.go
Normal 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 //如果需要存活
|
||||
}
|
||||
Reference in New Issue
Block a user