Files
bl/logic/service/fight/effect/effct_122.go
xinian f35af82bec
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 优化先手判断逻辑,增加IsFirst接口
2026-03-09 12:28:37 +08:00

59 lines
1.2 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/input"
"blazing/logic/service/fight/node"
)
func init() {
input.InitEffect(input.EffectType.Skill, 122, &Effect122{
isfrist: true,
rev: true,
})
input.InitEffect(input.EffectType.Skill, 148, &Effect122{
isfrist: false,
rev: true,
})
input.InitEffect(input.EffectType.Skill, 588, &Effect122{
isfrist: true,
rev: false,
})
input.InitEffect(input.EffectType.Skill, 186, &Effect122{
isfrist: false,
rev: false,
})
}
// -----------------------------------------------------------
// 效果122先出手时{1}%改变对方{0}等级{2}
// -----------------------------------------------------------
type Effect122 struct {
node.EffectNode
isfrist bool
rev bool
}
func (e *Effect122) OnSkill() bool {
if e.IsFirst() == e.isfrist {
propIndex := int(e.Args()[0].IntPart())
chance := int(e.Args()[1].IntPart())
changeAmount := int(e.Args()[2].IntPart())
ok, _, _ := e.Input.Player.Roll(chance, 100)
if ok {
if e.rev {
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
} else {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
}
}
}
return true
}