45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/gogf/gf/v2/util/grand"
|
|
)
|
|
|
|
// Effect 176: {0}%概率令对手随机进入烧伤、冻伤、中毒、麻痹、害怕、睡眠中的一种异常状态
|
|
type Effect176 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect176) OnSkill() bool {
|
|
chance := e.Args()[0].IntPart()
|
|
success, _, _ := e.Input.Player.Roll(int(chance), 100)
|
|
|
|
if success {
|
|
statusTypes := []int{
|
|
int(info.PetStatus.Burned),
|
|
int(info.PetStatus.Frozen),
|
|
int(info.PetStatus.Poisoned),
|
|
int(info.PetStatus.Paralysis),
|
|
int(info.PetStatus.Fear),
|
|
int(info.PetStatus.Sleep),
|
|
}
|
|
|
|
randomIndex := grand.Intn(len(statusTypes))
|
|
selectedStatus := statusTypes[randomIndex]
|
|
|
|
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, selectedStatus)
|
|
if statusEffect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEffect)
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 176, &Effect176{})
|
|
|
|
}
|