Files
bl/logic/service/fight/effect/effect_517.go
昔念 bd09013d85
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
```
fix(fight): 修复技能效果ID配置错误

- 修复NewSeIdx_66.go中空指针检查,避免程序崩溃
- 修正effect/407.go中技能ID从138改为407
- 修正effect/440.go中技能ID从138改为440,并修复类型引用错误
- 修正effect/523.go中属性设置对象错误,从Ctx().Opp改为Ctx().Our
- 修正effect_517.go中技能ID从452改为517
```
2026-03-11 23:38:51 +08:00

40 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 517 - n%概率使对手害怕每损失m%体力害怕几率提升k%
type Effect517 struct {
node.EffectNode
}
func (e *Effect517) OnSkill() bool {
baseChance := e.Args()[0].IntPart()
lostHpPercent := (e.Ctx().Opp.CurrentPet.GetMaxHP().Sub(e.Ctx().Opp.CurrentPet.GetHP())).Div(e.Ctx().Opp.CurrentPet.GetMaxHP()).Mul(alpacadecimal.NewFromInt(100)).IntPart()
// 计算额外几率
additionalStacks := lostHpPercent / e.Args()[1].IntPart()
extraChance := additionalStacks * e.Args()[2].IntPart()
totalChance := baseChance + extraChance
success, _, _ := e.Input.Player.Roll(int(totalChance), 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)
}
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 517, &Effect517{})
}