package effect import ( "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" "github.com/alpacahq/alpacadecimal" ) // 161 - n%降低自身当前体力值的1/m type Effect161 struct { node.EffectNode } func (e *Effect161) Skill_Use() bool { chance := e.Args()[0].IntPart() success, _, _ := e.Input.Player.Roll(int(chance), 100) if success { currentHp := e.Ctx().Our.CurrentPet.GetHP() damageRatio := alpacadecimal.NewFromFloat(1.0).Div(e.Args()[1]) // 1/m damageAmount := currentHp.Mul(damageRatio) damageZone := &info.DamageZone{ Type: info.DamageType.Percent, Damage: damageAmount, } e.Ctx().Our.Damage(e.Ctx().Our, damageZone) } return true } func init() { input.InitEffect(input.EffectType.Skill, 161, &Effect161{}) }