refactor(fight): 重构战斗系统属性计算逻辑

- 移除 BattlePetEntity 中的冗余方法
- 优化属性计算逻辑,使用统一的 CalculateRealValue 方法
- 调整 SkillEntity 中的攻击命中计算
- 重构 AttackValue 结构,使用数组替代字典
- 优化 Input 结构,添加 GetProp 和 GetStatusEffect 方法
- 更新 PetInfo 结构,使用数组存储属性值
This commit is contained in:
2025-09-17 00:38:15 +08:00
parent a33f108f98
commit 29ac99c860
6 changed files with 130 additions and 113 deletions

View File

@@ -116,8 +116,8 @@ func GenPetInfo(id int, dv, natureId, abilityTypeEnum, shinyid, level []int) *Pe
p.Level,
p.EvHp,
)
attack := p.CalculatePetPanelSize(
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
p.Prop[0] = p.CalculatePetPanelSize(
uint32(petxml.Atk),
p.Dv,
p.Level,
@@ -125,7 +125,7 @@ func GenPetInfo(id int, dv, natureId, abilityTypeEnum, shinyid, level []int) *Pe
naxml.AttackCorrect,
)
defense := p.CalculatePetPanelSize(
p.Prop[1] = p.CalculatePetPanelSize(
uint32(petxml.Def),
p.Dv,
p.Level,
@@ -133,7 +133,7 @@ func GenPetInfo(id int, dv, natureId, abilityTypeEnum, shinyid, level []int) *Pe
naxml.DefenseCorrect,
)
specialAttack := p.CalculatePetPanelSize(
p.Prop[2] = p.CalculatePetPanelSize(
uint32(petxml.SpAtk),
p.Dv,
p.Level,
@@ -141,7 +141,7 @@ func GenPetInfo(id int, dv, natureId, abilityTypeEnum, shinyid, level []int) *Pe
naxml.SaCorrect,
)
specialDefense := p.CalculatePetPanelSize(
p.Prop[3] = p.CalculatePetPanelSize(
uint32(petxml.SpDef),
p.Dv,
p.Level,
@@ -149,7 +149,7 @@ func GenPetInfo(id int, dv, natureId, abilityTypeEnum, shinyid, level []int) *Pe
naxml.SdCorrect,
)
speed := p.CalculatePetPanelSize(
p.Prop[4] = p.CalculatePetPanelSize(
uint32(petxml.Spd),
p.Dv,
p.Level,
@@ -160,11 +160,7 @@ func GenPetInfo(id int, dv, natureId, abilityTypeEnum, shinyid, level []int) *Pe
// 设置计算结果
p.MaxHp = hp
p.Hp = hp
p.Attack = attack
p.Defence = defense
p.SpecialAttack = specialAttack
p.SpecialDefence = specialDefense
p.Speed = speed
return p
}
@@ -213,21 +209,22 @@ type PetInfo struct {
// 最大生命(@UInt long → uint32
MaxHp uint32 `fieldDesc:"最大生命" `
// * battle_lv: atk(0), def(1), sp_atk(2), sp_def(3), spd(4), accuracy(5)
Prop [5]uint32 `fieldDesc:"属性" `
// // 攻击(@UInt long → uint32
// Attack uint32 `fieldDesc:"攻击" `
// 攻击@UInt long → uint32
Attack uint32 `fieldDesc:"攻击" `
// // 防御@UInt long → uint32
// Defence uint32 `fieldDesc:"防御" `
// 防御@UInt long → uint32
Defence uint32 `fieldDesc:"防御" `
// // 特攻@UInt long → uint32
// SpecialAttack uint32 `fieldDesc:"特攻" `
// 特攻@UInt long → uint32
SpecialAttack uint32 `fieldDesc:"特" `
// // 特防@UInt long → uint32
// SpecialDefence uint32 `fieldDesc:"特" `
// 特防@UInt long → uint32
SpecialDefence uint32 `fieldDesc:"特防" `
// 速度(@UInt long → uint32
Speed uint32 `fieldDesc:"速度" `
// // 速度@UInt long → uint32
// Speed uint32 `fieldDesc:"速度" `
// 生命学习力(@UInt long → uint32
EvHp uint32 `fieldDesc:"生命学习力" `