refactor(fight): 优化战斗系统中的数值计算和逻辑处理 - 将GetProp方法返回类型从int改为alpacadecimal.Decimal, 避免精度丢失问题 - 修改战斗中速度比较逻辑,使用Decimal的Cmp方法进行比较 - 修正BattlePetEntity中属性计算公式,将乘法改为除法 - 调整伤害累加逻辑,修复SumDamage叠加问题 - 更新攻击力和防御力计算,直接使用Decimal数值 - 移除Effect178、Effect501等未使用的技能效果 - 重构回合处理逻辑,调整死亡判断时机和流程 - 添加TrueFirst字段用于正确跟踪实际先手方 ```
36 lines
821 B
Go
36 lines
821 B
Go
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{})
|
||
|
||
}
|