38 lines
823 B
Go
38 lines
823 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 161: {0}%降低自身当前体力值的1/{1}
|
|
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.CurPet[0].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{})
|
|
|
|
}
|