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

56 lines
1.3 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"
"github.com/gogf/gf/v2/util/grand"
)
// Effect 124: 命中后,{0}%概率随机对方一个属性{1}个等级
type Effect124 struct {
node.EffectNode
}
func (e *Effect124) OnSkill() bool {
chance := int(e.Args()[0].IntPart())
changeAmount := int(e.Args()[1].IntPart())
ok, _, _ := e.Input.Player.Roll(chance, 100)
if !ok {
return true
}
// 随机选择一个属性0-5包含攻击、防御、特攻、特防、速度、命中
propIndex := grand.Intn(6)
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount))
return true
}
// Effect 126: {0}回合内每回合自身攻击和速度提高{1}个等级
type Effect126 struct {
RoundEffectSideArg0Base
}
func (e *Effect126) Skill_Use() bool {
changeAmount := int(e.Args()[1].IntPart())
// 攻击等级+1 (属性索引0)
e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount))
// 速度等级+1 (属性索引4)
e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount))
return true
}
// -----------------------------------------------------------
// 初始化
// -----------------------------------------------------------
func init() {
input.InitEffect(input.EffectType.Skill, 124, &Effect124{})
input.InitEffect(input.EffectType.Skill, 126, &Effect126{})
}