Files
bl/logic/service/fight/effect/504.go
xinian 6c75b106b3
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构战斗效果实现
2026-03-08 15:26:07 +08:00

36 lines
890 B
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// 504 - m%令对手害怕,若没有触发害怕效果,则对手攻击,防御,特攻,特防,速度,命中等级下降
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:] {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), int8(effectId), info.AbilityOpType.SUB)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 504, &Effect504{})
}