Files
bl/logic/service/fight/effect/527.go
xinian 875ad668aa
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现战斗效果逻辑和接口重构
2026-03-28 21:57:22 +08:00

50 lines
974 B
Go

package effect
import (
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// Effect 527: 使用技能时体力低于1/{0},则{1}回合内免疫异常状态
type Effect527 struct {
RoundEffectArg0Base
can bool
}
func (e *Effect527) EFFect_Befer(in *input.Input, effEffect input.Effect) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if !e.can {
return true
}
if in != e.Ctx().Opp {
return true
}
if input.IS_Stat(effEffect) {
return false
}
return true
}
func (e *Effect527) OnSkill() bool {
divisor := e.Args()[0] // 除数
// 检查当前体力是否低于最大体力的 1/divisor
currentHP := alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.Hp))
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
threshold := maxHP.Div(divisor)
if currentHP.Cmp(threshold) < 0 {
e.can = true
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 527, &Effect527{})
}