fix(fight): 修复技能效果计算中的负值问题 在技能效果35的计算中,当对手属性值为负数时可能导致异常计算结果, 通过使用utils.Max函数确保属性值不小于0来修复此问题。 - 添加blazing/common/utils包导入 - 在物理攻击和特殊攻击的计算中使用utils.Max限制属性值最小为0 ```
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/common/utils"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
@@ -24,9 +25,10 @@ func (e *Effect35) SkillHit() bool {
|
||||
|
||||
switch e.Ctx().SkillEntity.Category() {
|
||||
case info.Category.PHYSICAL:
|
||||
e.Ctx().SkillEntity.XML.Power += (int(e.Ctx().Opp.Prop[0]) + int(e.Ctx().Opp.Prop[1])) * 20
|
||||
|
||||
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(e.Ctx().Opp.Prop[2]) + int(e.Ctx().Opp.Prop[3])) * 20
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user