35 lines
801 B
Go
35 lines
801 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/action"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// 406 - 2 n回合内受到攻击m%几率回复k点体力
|
|
type Effect406 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect406) Skill_Use_ex() bool {
|
|
|
|
chance := e.Args()[1].IntPart()
|
|
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
|
if success {
|
|
healAmount := alpacadecimal.NewFromInt(int64(e.Args()[2].IntPart()))
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func (e *Effect406) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.EffectNode.Duration(a[0]) // 持续n回合
|
|
}
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 406, &Effect406{})
|
|
|
|
}
|