refactor(fight): 移除能力操作类型枚举并简化属性设置方法 移除了 info.EnumAbilityOpType 枚举类型及其相关常量定义, 重构了 SetProp 方法调用,不再传递操作类型参数, 通过检查等级正负值来判断是增加还是减少属性, 减少了代码复杂度并统一了属性变更的处理逻辑。 ```
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
)
|
||||
@@ -61,19 +60,13 @@ func (e *EffectStat) OnSkill() bool {
|
||||
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)
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(statIndex), int8(level))
|
||||
} else {
|
||||
// 自身属性变化
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level), opType)
|
||||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(statIndex), int8(level))
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user