All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
fix(fight): 修复技能效果计算中的负值问题 在技能效果35的计算中,当对手属性值为负数时可能导致异常计算结果, 通过使用utils.Max函数确保属性值不小于0来修复此问题。 - 添加blazing/common/utils包导入 - 在物理攻击和特殊攻击的计算中使用utils.Max限制属性值最小为0 ```
41 lines
915 B
Go
41 lines
915 B
Go
package effect
|
|
|
|
import (
|
|
"blazing/common/utils"
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
)
|
|
|
|
// 惩罚,对方能力等级越高,此技能威力越大
|
|
type Effect35 struct {
|
|
node.EffectNode
|
|
can bool
|
|
}
|
|
|
|
func (e *Effect35) SkillHit() bool {
|
|
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
switch e.Ctx().SkillEntity.Category() {
|
|
case info.Category.PHYSICAL:
|
|
|
|
e.Ctx().SkillEntity.XML.Power += (int(utils.Max(e.Ctx().Opp.Prop[0], 0)) + int(utils.Max(e.Ctx().Opp.Prop[1], 0))) * 20
|
|
case info.Category.SPECIAL:
|
|
e.Ctx().SkillEntity.XML.Power += (int(utils.Max(e.Ctx().Opp.Prop[2], 0)) + int(utils.Max(e.Ctx().Opp.Prop[3], 0))) * 20
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
// ---- 注册所有效果 ----
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 35, &Effect35{})
|
|
}
|