Files
bl/logic/service/fight/effect/176.go
xinian 78a68148ce
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
chore: update fight logic and effect implementations
2026-04-05 02:25:44 +08:00

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.CarrierInput().InitEffect(input.EffectType.Status, selectedStatus)
if statusEffect != nil {
e.TargetInput().AddEffect(e.CarrierInput(), statusEffect)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 176, &Effect176{})
}