Files
bl/logic/service/fight/effect/583.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

46 lines
845 B
Go

package effect
import (
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 583: 使对手随机{0}项技能的PP值归零
type Effect583 struct {
node.EffectNode
}
func (e *Effect583) OnSkill() bool {
skills := e.Ctx().Opp.CurPet[0].Info.SkillList
if len(skills) == 0 {
return true
}
count := int(e.Args()[0].IntPart())
if count <= 0 {
return true
}
if count > len(skills) {
count = len(skills)
}
indexes := make([]int, len(skills))
for i := range indexes {
indexes[i] = i
}
for i := 0; i < count; i++ {
j := i + grand.Intn(len(indexes)-i)
indexes[i], indexes[j] = indexes[j], indexes[i]
e.Ctx().Opp.CurPet[0].Info.SkillList[indexes[i]].PP = 0
}
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 583, &Effect583{})
}