36 lines
753 B
Go
36 lines
753 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/action"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
"github.com/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
// Effect 450: 随机恢复{0}到{1}点生命值
|
|
type Effect450 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect450) OnSkill() bool {
|
|
minHeal := e.Args()[0].IntPart()
|
|
maxHeal := e.Args()[1].IntPart()
|
|
|
|
randomVal := minHeal
|
|
rangeVal := int(maxHeal - minHeal)
|
|
if rangeVal > 0 {
|
|
randomVal += int64(grand.Intn(rangeVal))
|
|
}
|
|
|
|
healAmount := alpacadecimal.NewFromInt(randomVal)
|
|
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
|
|
|
return true
|
|
}
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 450, &Effect450{})
|
|
|
|
}
|