Files
bl/logic/service/fight/effect/504.go
xinian 875ad668aa
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现战斗效果逻辑和接口重构
2026-03-28 21:57:22 +08:00

39 lines
843 B
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// Effect 504: {0}%令对手害怕,若没有触发害怕效果,则对手{1}
type Effect504 struct {
node.EffectNode
}
func (e *Effect504) OnSkill() bool {
chance := e.Args()[0].IntPart()
success, _, _ := e.Input.Player.Roll(int(chance), 100)
if success {
// 令对手害怕
fearEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Fear))
if fearEffect != nil {
e.Ctx().Opp.AddEffect(e.Ctx().Our, fearEffect)
}
} else {
for i, effectId := range e.SideEffectArgs[1:] {
if effectId != 0 {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId))
}
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 504, &Effect504{})
}