refactor(fight/xmlres): 重构效果参数处理逻辑,新增JSON解析支持并优化战斗伤害计算

This commit is contained in:
1
2025-09-23 17:34:58 +00:00
parent 53d4fafe73
commit 1245471129
13 changed files with 157 additions and 124 deletions

View File

@@ -9,7 +9,6 @@ import (
"github.com/gogf/gf/v2/util/gconv"
"github.com/jinzhu/copier"
"github.com/mohae/deepcopy"
"github.com/shopspring/decimal"
)
type Input struct {
@@ -21,9 +20,9 @@ type Input struct {
*info.AttackValue
FightC common.FightI
// info.BattleActionI
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
Damage decimal.Decimal //造成伤害
First bool //是否先手
Effects []Effect //effects 实际上全局就是effect无限回合 //effects容器 技能的
//Damage decimal.Decimal //造成伤害
First bool //是否先手
}
func NewInput(c common.FightI, p common.PlayerI) *Input {
@@ -75,7 +74,7 @@ func (i *Input) GetStatusBonus() float64 {
t, ok := i.GetStatusEffect(statusIdx)
// 检查状态是否存在数组中值为1表示存在该状态
if ok && t.Stack(0) > 0 {
if ok && t.Stack() > 0 {
if bonus, exists := statusBonuses[info.EnumBattleStatus(statusIdx)]; exists && bonus > maxBonus {
maxBonus = bonus
}