refactor(fight): 优化战斗系统中的数值计算和逻辑处理 - 将GetProp方法返回类型从int改为alpacadecimal.Decimal, 避免精度丢失问题 - 修改战斗中速度比较逻辑,使用Decimal的Cmp方法进行比较 - 修正BattlePetEntity中属性计算公式,将乘法改为除法 - 调整伤害累加逻辑,修复SumDamage叠加问题 - 更新攻击力和防御力计算,直接使用Decimal数值 - 移除Effect178、Effect501等未使用的技能效果 - 重构回合处理逻辑,调整死亡判断时机和流程 - 添加TrueFirst字段用于正确跟踪实际先手方 ```
30 lines
652 B
Go
30 lines
652 B
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
)
|
||
|
||
// 501 - 若造成的伤害不足m,则对手XX等级-n
|
||
type Effect501 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect501) Skill_Use_ex() bool {
|
||
damageThreshold := int(e.Args()[0].IntPart())
|
||
damageDone := e.Ctx().Our.SumDamage
|
||
|
||
if damageDone.IntPart() < int64(damageThreshold) {
|
||
effectType := int8(e.Args()[1].IntPart()) // XX类型
|
||
effectValue := int8(e.Args()[2].IntPart()) // 等级-n
|
||
e.Ctx().Opp.SetProp(e.Ctx().Our, effectType, effectValue)
|
||
|
||
}
|
||
|
||
return true
|
||
}
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 501, &Effect501{})
|
||
|
||
}
|