refactor(fight): 优化战斗系统中的数值计算和逻辑处理

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

View File

@@ -92,7 +92,7 @@ func (our *Input) InitEffect(etype EnumEffectType, id int, a ...int) Effect {
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
// 是否需要真实提升
func (our *Input) GetProp(id int) int {
func (our *Input) GetProp(id int) alpacadecimal.Decimal {
// 计算实际值(这里可以插入后续优化的函数调用)
realValue := info.CalculateRealValue(alpacadecimal.NewFromInt(int64(our.CurrentPet.Info.Prop[id])), our.AttackValue.Prop[id])
@@ -100,7 +100,7 @@ func (our *Input) GetProp(id int) int {
// todo: 插入获取后处理函数,例如:
// realValue = postProcessValue(realValue, id, c)
return int(realValue.IntPart())
return realValue
}