Files
bl/logic/service/fight/effect/effect_124_126.go
昔念 85f15a72aa ```
refactor(fight): 统一战斗系统方法命名规范并优化逻辑

- 将所有下划线命名的方法统一为驼峰命名,如 Turn_Start 改为 TurnStart,
  Action_end_ex 改为 ActionEndEx,Turn_End 改为 TurnEnd
- 新增 IsOwner() 方法用于判断当前精灵是否为场上的当前宠物
- 将硬编码的 CatchTime 比较逻辑替换为 IsOwner() 方法调用
- 在 NewSel408 中实现消除对手能力强化效果的具体逻辑
- 修复 effect_74 中衰弱状态的数值引用,使用枚举类型代替硬编码
- 优化 input/fight.go 中的技能选择逻辑,使用伤害值比较代替权重比较
- 移除 shiny.go 中未使用的 utils 导入和相关逻辑
- 修正 NewSel77 从 Turn_End 重命名为 TurnStart 的方法
- 在 input/fight.go 中添加 Damage 方法的注释说明
```
2026-01-05 22:54:41 +08:00

69 lines
1.9 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 {
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) TurnStart(_, _ *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{})
}