package effect import ( "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" "github.com/alpacahq/alpacadecimal" ) // 140 - 降低对手1/n至1/m体力 type Effect140 struct { node.EffectNode } func (e *Effect140) Skill_Use() bool { maxHp := e.Ctx().Opp.CurrentPet.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{}) }