From 08556fb0c73d7f78823df359fc903bf5a8015aab Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 24 十一月 2025 19:03:06 +0800
Subject: [PATCH] 0312 增加自动战斗时装备战力的简易对比避免卡顿;优化同个部位掉落两件好装备在穿上第一件后,第二件战力降低依然会弹界面框问题

---
 Main/System/Main/FightPowerManager.cs |  147 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index 53f3e7f..3ad1fb0 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -565,6 +565,153 @@
         return tmpFightPower - fightPower;
     }
 
+    //瑁呭鎺夎惤鐨勭畝鏄撳姣旓紝鍙仛涓よ澶囦箣闂寸殑濂藉潖瀵规瘮涓嶇敤鍏ㄩ儴璁$畻锛岄伩鍏岹C闂
+    public long GetFightPowerChangeSimple(ItemModel item)
+    {
+        RefrehOneEquipAttr(PackType.Equip, item.config.EquipPlace - 1);
+        var fightPower = CalculateSimpleEquipPower();
+        if (equipAttrs.IsNullOrEmpty())
+        {
+            //瑁呭涓虹┖锛岀洿鎺ヨ繑鍥�1锛屾垬鍔涘叕寮忓彲鑳戒細绠楀嚭璐熸暟鐨勬儏鍐碉紝鏁呭崟涓�瑁呭涓嶅姣�
+            return 1;
+        }
+
+        RefrehOneEquipAttr(PackType.DropItem, item.gridIndex);
+        var tmpFightPower = CalculateSimpleEquipPower();
+
+#if UNITY_EDITOR
+        var equip = PackManager.Instance.GetItemByIndex(PackType.Equip, item.config.EquipPlace - 1);
+        var dropEquip = PackManager.Instance.GetItemByIndex(PackType.DropItem, item.gridIndex);
+        var name = equip != null ? equip.config.ItemName : "绌�";
+        Debug.Log($"绠�鏄撳姣旇澶� {name} 鍜� {dropEquip.config.ItemName} 宸�� {tmpFightPower - fightPower}");
+        return tmpFightPower - fightPower;
+#endif
+    }
+
+    void RefrehOneEquipAttr(PackType type, int index)
+    {
+        equipAttrs.Clear();  //韬笂瑁呭灞炴�ч噸缃�
+        var equip = PackManager.Instance.GetItemByIndex(type, index);
+        if (equip == null)
+        {
+            return;
+        }
+        var baseIDAttrs = EquipModel.Instance.GetEquipBaseAttrs(equip);
+        var baseVauleAttrs = EquipModel.Instance.GetEquipBaseValues(equip);
+        if (baseIDAttrs != null)
+        {
+            for (int j = 0; j < baseIDAttrs.Count; j++)
+            {
+                if (!equipAttrs.ContainsKey(baseIDAttrs[j]))
+                {
+                    equipAttrs[baseIDAttrs[j]] = baseVauleAttrs[j];
+                }
+                else
+                {
+                    equipAttrs[baseIDAttrs[j]] += baseVauleAttrs[j];
+                }
+            }
+        }
+
+        var fightIDAttrs = EquipModel.Instance.GetEquipFightAttrs(equip);
+        var fightValueAttrs = EquipModel.Instance.GetEquipFightValues(equip);
+        if (fightIDAttrs != null)
+        {
+            for (int j = 0; j < fightIDAttrs.Count; j++)
+            {
+                if (!equipAttrs.ContainsKey(fightIDAttrs[j]))
+                {
+                    equipAttrs[fightIDAttrs[j]] = fightValueAttrs[j];
+                }
+                else
+                {
+                    equipAttrs[fightIDAttrs[j]] += fightValueAttrs[j];
+                }
+            }
+        }
+
+    }
+
+    public long CalculateSimpleEquipPower()
+    {
+        if (equipAttrs.IsNullOrEmpty())
+            return 0;
+        fightPowerVariables.Clear();
+
+        foreach (var config in PlayerPropertyConfig.GetValues())
+        {
+            if (config.showType < 1 || config.showType > 4)
+            {
+                continue;
+            }
+            var value = equipAttrs.TryGetValue(config.ID, out var v) ? v : 0;
+
+            fightPowerVariables[config.Parameter] = value;
+        }
+
+
+        //灞炴�х郴鏁版牴鎹畼鑱岀瓑绾х殑鍔犳垚
+        var fightPowerRatioConfig = FightPowerRatioConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
+
+        fightPowerVariables["AtkRatio"] = fightPowerRatioConfig.AtkRatio;
+        fightPowerVariables["MaxHPRatio"] = fightPowerRatioConfig.MaxHPRatio;
+        fightPowerVariables["DefRatio"] = fightPowerRatioConfig.DefRatio;
+        fightPowerVariables["StunRateRatio"] = fightPowerRatioConfig.StunRateRatio;
+        fightPowerVariables["SuperHitRateRatio"] = fightPowerRatioConfig.SuperHitRateRatio;
+        fightPowerVariables["ComboRateRatio"] = fightPowerRatioConfig.ComboRateRatio;
+        fightPowerVariables["MissRateRatio"] = fightPowerRatioConfig.MissRateRatio;
+        fightPowerVariables["ParryRateRatio"] = fightPowerRatioConfig.ParryRateRatio;
+        fightPowerVariables["SuckHPPerRatio"] = fightPowerRatioConfig.SuckHPPerRatio;
+        fightPowerVariables["StunRateDefRatio"] = fightPowerRatioConfig.StunRateDefRatio;
+        fightPowerVariables["SuperHitRateDefRatio"] = fightPowerRatioConfig.SuperHitRateDefRatio;
+        fightPowerVariables["ComboRateDefRatio"] = fightPowerRatioConfig.ComboRateDefRatio;
+        fightPowerVariables["MissRateDefRatio"] = fightPowerRatioConfig.MissRateDefRatio;
+        fightPowerVariables["ParryRateDefRatio"] = fightPowerRatioConfig.ParryRateDefRatio;
+        fightPowerVariables["SuckHPPerDefRatio"] = fightPowerRatioConfig.SuckHPPerDefRatio;
+        fightPowerVariables["NormalSkillPerRatio"] = fightPowerRatioConfig.NormalSkillPerRatio;
+        fightPowerVariables["NormalSkillPerDefRatio"] = fightPowerRatioConfig.NormalSkillPerDefRatio;
+        fightPowerVariables["AngerSkillPerRatio"] = fightPowerRatioConfig.AngerSkillPerRatio;
+        fightPowerVariables["AngerSkillPerDefRatio"] = fightPowerRatioConfig.AngerSkillPerDefRatio;
+        fightPowerVariables["SuperDamPerRatio"] = fightPowerRatioConfig.SuperDamPerRatio;
+        fightPowerVariables["SuperDamPerDefRatio"] = fightPowerRatioConfig.SuperDamPerDefRatio;
+        fightPowerVariables["ShieldPerRatio"] = fightPowerRatioConfig.ShieldPerRatio;
+        fightPowerVariables["ShieldPerDefRatio"] = fightPowerRatioConfig.ShieldPerDefRatio;
+        fightPowerVariables["DOTPerRatio"] = fightPowerRatioConfig.DOTPerRatio;
+        fightPowerVariables["DOTPerDefRatio"] = fightPowerRatioConfig.DOTPerDefRatio;
+        fightPowerVariables["WeiFinalDamPerRatio"] = fightPowerRatioConfig.WeiFinalDamPerRatio;
+        fightPowerVariables["WeiFinalDamPerDefRatio"] = fightPowerRatioConfig.WeiFinalDamPerDefRatio;
+        fightPowerVariables["ShuFinalDamPerRatio"] = fightPowerRatioConfig.ShuFinalDamPerRatio;
+        fightPowerVariables["ShuFinalDamPerDefRatio"] = fightPowerRatioConfig.ShuFinalDamPerDefRatio;
+        fightPowerVariables["WuFinalDamPerRatio"] = fightPowerRatioConfig.WuFinalDamPerRatio;
+        fightPowerVariables["WuFinalDamPerDefRatio"] = fightPowerRatioConfig.WuFinalDamPerDefRatio;
+        fightPowerVariables["QunFinalDamPerRatio"] = fightPowerRatioConfig.QunFinalDamPerRatio;
+        fightPowerVariables["QunFinalDamPerDefRatio"] = fightPowerRatioConfig.QunFinalDamPerDefRatio;
+        fightPowerVariables["FinalDamPerRatio"] = fightPowerRatioConfig.FinalDamPerRatio;
+        fightPowerVariables["FinalDamPerDefRatio"] = fightPowerRatioConfig.FinalDamPerDefRatio;
+        fightPowerVariables["PhyDamPerRatio"] = fightPowerRatioConfig.PhyDamPerRatio;
+        fightPowerVariables["PhyDamPerDefRatio"] = fightPowerRatioConfig.PhyDamPerDefRatio;
+        fightPowerVariables["MagDamPerRatio"] = fightPowerRatioConfig.MagDamPerRatio;
+        fightPowerVariables["MagDamPerDefRatio"] = fightPowerRatioConfig.MagDamPerDefRatio;
+        fightPowerVariables["CurePerRatio"] = fightPowerRatioConfig.CurePerRatio;
+        fightPowerVariables["CurePerDefRatio"] = fightPowerRatioConfig.CurePerDefRatio;
+        fightPowerVariables["PVPDamPerRatio"] = fightPowerRatioConfig.PVPDamPerRatio;
+        fightPowerVariables["PVPDamPerDefRatio"] = fightPowerRatioConfig.PVPDamPerDefRatio;
+
+        long fightPower;
+        if (useFormulaType == 0)
+        {
+            fightPower = (long)FightPowerFormula.GetFightPower(fightPowerVariables);
+        }
+        else
+        {
+
+            fightPower = (long)JaceCalculator.Calculate(fightPowerFormula, fightPowerVariables);
+        }
+
+        return fightPower;
+    }
+
+
 
     // 鍗曡嫳闆勬煡鐪嬫垬鍔� 
     // 1. 涓婇樀鑻遍泟鏄剧ず锛屽湪涓荤嚎闃靛涓嬬殑鎴樺姏

--
Gitblit v1.8.0