- 删除了多个未使用的技能效果文件(effect_10-16_94_99_14.go、effect_61_70_118.go、 effect_66.go、effect_67.go、effect_78_86_106.go、effect_84_92.go、prop.go) - 修正了部分技能效果中的错误逻辑判断和数值计算方式 - 调整了伤害计算与治疗效果的参数使用顺序,使其符合预期行为 - 注释掉调试打印语句及测试调用,减少冗余输出 - 修复了部分效果中对技能分类的错误比较条件 此次修改提升了战斗系统代码的整洁性和准确性。
71 lines
1.8 KiB
Go
71 lines
1.8 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
)
|
||
|
||
// Effect3:能力操作类效果(重置/反转/偷取等)
|
||
type Effect3 struct {
|
||
node.EffectNode
|
||
Reverse bool
|
||
Level int8
|
||
OpType info.EnumAbilityOpType
|
||
}
|
||
|
||
// ----------------------
|
||
// 执行时逻辑
|
||
// ----------------------
|
||
func (e *Effect3) OnSkill() bool {
|
||
if !e.Hit() {
|
||
return true
|
||
}
|
||
|
||
// 遍历六项能力值(攻击、防御、速度等)
|
||
for i := 0; i < 6; i++ {
|
||
if e.Reverse {
|
||
// 对对手生效
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType)
|
||
} else {
|
||
// 对自己生效
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), e.Level, e.OpType)
|
||
}
|
||
}
|
||
|
||
return true
|
||
}
|
||
|
||
// ----------------------
|
||
// 工厂函数
|
||
// ----------------------
|
||
func newEffect3(reverse bool, level int8, opType info.EnumAbilityOpType) *Effect3 {
|
||
return &Effect3{
|
||
Reverse: reverse,
|
||
Level: level,
|
||
OpType: opType,
|
||
}
|
||
}
|
||
|
||
// ----------------------
|
||
// 注册所有效果
|
||
// ----------------------
|
||
func init() {
|
||
effects := []struct {
|
||
id int
|
||
reverse bool
|
||
level int8
|
||
opType info.EnumAbilityOpType
|
||
}{
|
||
{3, false, -1, info.AbilityOpType.RESET}, // 解除自身能力下降状态
|
||
{33, true, 1, info.AbilityOpType.RESET}, // 消除对手能力提升状态
|
||
{63, false, 0, info.AbilityOpType.AbilityOpBounceWeaken}, // 将能力下降反馈给对手
|
||
{85, false, -1, info.AbilityOpType.AbilityOpStealStrengthen}, // 将对手提升效果转移到自己
|
||
{143, true, 1, info.AbilityOpType.AbilityOpReverse}, // 反转对手能力提升为下降
|
||
}
|
||
|
||
for _, e := range effects {
|
||
input.InitEffect(input.EffectType.Skill, e.id, newEffect3(e.reverse, e.level, e.opType))
|
||
}
|
||
}
|