Files
bl/logic/service/fight/effect/178.go
昔念 d360a85963 ```
refactor(fight): 优化战斗系统中的数值计算和逻辑处理

- 将GetProp方法返回类型从int改为alpacadecimal.Decimal,
避免精度丢失问题
- 修改战斗中速度比较逻辑,使用Decimal的Cmp方法进行比较
- 修正BattlePetEntity中属性计算公式,将乘法改为除法
- 调整伤害累加逻辑,修复SumDamage叠加问题
- 更新攻击力和防御力计算,直接使用Decimal数值
- 移除Effect178、Effect501等未使用的技能效果
- 重构回合处理逻辑,调整死亡判断时机和流程
- 添加TrueFirst字段用于正确跟踪实际先手方
```
2026-03-09 20:55:04 +08:00

36 lines
821 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// 178 - 造成伤害的1/n回复自身体力若属性相同则造成伤害的1/m回复自身体力
type Effect178 struct {
node.EffectNode
}
func (e *Effect178) Skill_Use_ex() bool {
damageDone := e.Ctx().Our.SumDamage
var healAmount alpacadecimal.Decimal
if e.Ctx().Our.CurrentPet.Type == e.Ctx().Opp.CurrentPet.Type {
// 属性相同1/m
healAmount = damageDone.Div(e.Args()[1])
} else {
// 属性不同1/n
healAmount = damageDone.Div(e.Args()[0])
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 178, &Effect178{})
}