Files
bl/logic/service/fight/effect/effect_7.go
昔念 c916440033 ```
feat(fight): 完善战斗系统中道具使用逻辑与血量恢复机制

- 修改 item.go 中 Item 结构体,将 Bonus 字段类型由 string
2025-11-08 16:38:41 +08:00

44 lines
836 B
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/shopspring/decimal"
)
/**
* 对方体力高于自己时才能命中,将对方体力减到和自己相同
*/
func init() {
input.InitEffect(input.EffectType.Skill, 7, &Effect7{
EffectNode: node.EffectNode{},
})
}
type Effect7 struct {
node.EffectNode
}
func (e *Effect7) Skill_Hit_Pre(ctx input.Ctx) bool {
if ctx.CurrentPet.Info.Hp <= e.Input.CurrentPet.Info.Hp {
ctx.SkillEntity.Accuracy = 0
}
return true
}
func (e *Effect7) Damage_Floor(ctx input.Ctx) bool {
if !e.Hit() {
return true
}
if ctx.DamageZone.Type == info.DamageType.Red {
ctx.DamageZone.Damage = decimal.NewFromInt(int64(ctx.CurrentPet.Info.Hp - e.Input.CurrentPet.Info.Hp))
}
return true
}