Files
bl/logic/service/fight/effect/effect_4_5.go
昔念 0f524aab85 ```
fix(fight): 修复战斗命中判断逻辑并移除冗余命中检查

- 修复 NewSel32 中的命中判断,将 Side 字段改为 Hit 字段
- 移除 EffectAttackMiss 中的冗余命中判断逻辑
- 移除 EffectDefeatTrigger 中的重复命中检查
- 移除 EffectPhysicalAttackAddStatus 中的冗余命中判断
- 移除多个效果文件中的重复命中检查逻辑
- 修正 Effect136 中的命中处理逻辑,确保在技能命中时正确触发
- 移除其他多个效果中的重复命中检查代码
```
2026-01-04 21:41:10 +08:00

81 lines
1.9 KiB
Go

package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
)
// -----------------------------------------------------------
// 注册
// -----------------------------------------------------------
func init() {
initskill(4, newEffectStat(false))
initskill(5, newEffectStat(true))
}
// -----------------------------------------------------------
// 构造
// -----------------------------------------------------------
func newEffectStat(targetOpponent bool) input.Effect {
e := &EffectStat{
Etype: targetOpponent,
}
//e.CanStack(-1) // 无限叠加
return e
}
// -----------------------------------------------------------
// 主体结构
// -----------------------------------------------------------
type EffectStat struct {
node.EffectNode
Etype bool // false: 作用自身, true: 作用对方
}
// -----------------------------------------------------------
// 技能触发时调用
// -----------------------------------------------------------
func (e *EffectStat) OnSkill() bool {
// 参数解构 (防止 SideEffectArgs 长度不足)
var (
statIndex int // 哪个属性
chance int // 触发概率
level int // 增减值
)
if len(e.SideEffectArgs) > 0 {
statIndex = e.SideEffectArgs[0]
}
if len(e.SideEffectArgs) > 1 {
chance = e.SideEffectArgs[1]
}
if len(e.SideEffectArgs) > 2 {
level = e.SideEffectArgs[2]
}
// 概率判定
ok, _, _ := e.Input.Player.Roll(chance, 100)
if !ok {
return true
}
// 判断加减类型
opType := info.AbilityOpType.ADD
if level < 0 {
opType = info.AbilityOpType.SUB
}
// 执行属性变化
if e.Etype {
// 对方属性变化
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
} else {
// 自身属性变化
e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
}
return true
}