feat(player): 添加 UseCoins 方法统一处理玩家金币消耗逻辑 重构购买物品和变更外观功能,使用 UseCoins 方法替代手动操作 Coins 字段, 确保金币扣除的安全性和一致性。同时修复可能因并发导致的金币超扣问题。 此外,调整部分战斗系统接口参数传递方式,将 DamageZone 指
60 lines
1.2 KiB
Go
60 lines
1.2 KiB
Go
package node
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
)
|
|
|
|
func (e *EffectNode) Skill_Pre() bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Calculate_Pre() bool {
|
|
return true
|
|
}
|
|
|
|
func (e *EffectNode) Skill_Hit() bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Skill_Hit_ex() bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) OnSkill() bool {
|
|
// if e.Effect != nil {
|
|
// if e.Hit() { //没命中
|
|
// e.Effect.OnHit(ctx.Input, ctx.SkillEntity)
|
|
// } else {
|
|
// e.Effect.OnMiss(ctx.Input, ctx.SkillEntity)
|
|
// }
|
|
// }
|
|
return true
|
|
}
|
|
|
|
func (e *EffectNode) Skill_Can() bool {
|
|
|
|
return e.Input.CurrentPet.HP != 0
|
|
}
|
|
|
|
func (e *EffectNode) Skill_Use_ex() bool {
|
|
return true
|
|
}
|
|
func (e *EffectNode) Skill_Useed() 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
|
|
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 //如果需要存活
|
|
}
|