Files
bl/logic/service/fight/effect/effect_124_126.go
2025-12-24 19:17:39 +08:00

72 lines
2.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/action"
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// -----------------------------------------------------------
// 效果124命中后{0}%概率随机对方一个属性{1}个等级
// -----------------------------------------------------------
type Effect124 struct {
node.EffectNode
}
func (e *Effect124) OnSkill() bool {
if !e.Hit() {
return true
}
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 := int(e.Input.FightC.GetRand().Int31n(6))
opType := info.AbilityOpType.ADD
if changeAmount < 0 {
opType = info.AbilityOpType.SUB
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
return true
}
// -----------------------------------------------------------
// 效果126{0}回合内每回合自身攻击和速度提高{1}个等级
// -----------------------------------------------------------
type Effect126 struct {
node.EffectNode
}
func (e *Effect126) SetArgs(t *input.Input, a ...int) {
e.EffectNode.SetArgs(t, a...)
e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0])
}
func (e *Effect126) Turn_Start(_, _ *action.SelectSkillAction) {
changeAmount := int(e.Args()[1].IntPart())
// 攻击等级+1 (属性索引0)
e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount), info.AbilityOpType.ADD)
// 速度等级+1 (属性索引4)
e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount), info.AbilityOpType.ADD)
}
// -----------------------------------------------------------
// 初始化
// -----------------------------------------------------------
func init() {
input.InitEffect(input.EffectType.Skill, 124, &Effect124{})
input.InitEffect(input.EffectType.Skill, 126, &Effect126{})
}