Files
bl/logic/service/fight/effect/effect_140.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

36 lines
872 B
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 140: 随机降低对手1/{0}至1/{1}的当前体力值
type Effect140 struct {
node.EffectNode
}
func (e *Effect140) Skill_Use() bool {
maxHp := e.Ctx().Opp.CurPet[0].GetMaxHP()
// 随机降低1/n 到 1/m 的体力
minRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[0]) // 1/n
maxRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m
randDamage := minRatio.Add(maxRatio.Sub(minRatio).Div(alpacadecimal.NewFromInt(2)))
damageZone := &info.DamageZone{
Type: info.DamageType.Percent,
Damage: maxHp.Mul(randDamage),
}
e.Ctx().Opp.Damage(e.Ctx().Our, damageZone)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 140, &Effect140{})
}