From 45ecc7fb322b2555d5660b7b0c516cb0bbf29e24 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 23 十二月 2025 15:20:16 +0800
Subject: [PATCH] 0312 修复武将最后一个潜能没有计算的问题

---
 Main/System/Main/FightPowerManager.cs |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index 7fe4011..9f6f3d8 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -122,12 +122,15 @@
     /// <param name="ispreview">棰勮闃靛鎴樺姏</param>
     public void InitFightPowerParam(TeamType teamType = TeamType.Story, int dropindex = -1, bool ispreview = false)
     {
+#if !UNITY_EDITOR
+        openLog = false;
+#endif
         teamTypeCalc = teamType;
         isPreviewTeamPower = ispreview;
 
         dropIndexCalc = dropindex;
 #if UNITY_EDITOR
-        // Debug.Log("鎴樺姏锛氬垵濮嬪寲鍙傛暟 dropIndex锛�" + dropIndexCalc + " 闃靛瀷锛�" + teamTypeCalc + " ispreview:" + ispreview);
+        FightPowerDebug("鎴樺姏锛氬垵濮嬪寲鍙傛暟 dropIndex锛�" + dropIndexCalc + " 闃靛瀷锛�" + teamTypeCalc + " ispreview:" + ispreview);
 #endif
     }
     #endregion
@@ -157,7 +160,7 @@
             lvAttrs[attrType] = GetPlayerLVValue(playerLVConfig, attrType);
         }
 #if UNITY_EDITOR
-        // Debug.Log("鎴樺姏锛氱瓑绾у睘鎬� " + JsonMapper.ToJson(lvAttrs));
+        FightPowerDebug("鎴樺姏锛氱瓑绾у睘鎬� " + JsonMapper.ToJson(lvAttrs));
 #endif
 
     }
@@ -191,7 +194,7 @@
             officialAttrs[id] = config.AddAttrNum[i];
         }
 #if UNITY_EDITOR
-        // Debug.Log("鎴樺姏锛氬畼鑱屽睘鎬� " + JsonMapper.ToJson(officialAttrs));
+        FightPowerDebug("鎴樺姏锛氬畼鑱屽睘鎬� " + JsonMapper.ToJson(officialAttrs));
 #endif
 
     }
@@ -251,7 +254,7 @@
         }
 
 #if UNITY_EDITOR
-        // Debug.Log("鎴樺姏锛氳澶囧睘鎬� " + JsonMapper.ToJson(equipAttrs));
+        FightPowerDebug("鎴樺姏锛氳澶囧睘鎬� " + JsonMapper.ToJson(equipAttrs));
 #endif
     }
 
@@ -268,7 +271,7 @@
         // 闃靛锛氬浗瀹讹紙鍏夌幆锛夊睘鎬�
         countryAttrs = HeroUIManager.Instance.GetCountryAttrs(teamTypeCalc, isPreviewTeamPower);
 #if UNITY_EDITOR
-        // Debug.Log("鎴樺姏锛氬浗瀹讹紙鍏夌幆锛夊睘鎬� " + JsonMapper.ToJson(countryAttrs));
+        FightPowerDebug("鎴樺姏锛氬浗瀹讹紙鍏夌幆锛夊睘鎬� " + JsonMapper.ToJson(countryAttrs));
 #endif
     }
 
@@ -346,9 +349,9 @@
         propertyVariables[HERO_LV_PER] = hero.GetHeroLVPer(attrType) / 10000.0f;
 #if UNITY_EDITOR
         //鎺掗櫎鍊间负0鐨勫睘鎬ц緭鍑�
-        // var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
-        // if (!tmpPropertyVariables.IsNullOrEmpty())
-        //     propertyStrForDebug += $"灞炴�D {attrType} - {JsonMapper.ToJson(tmpPropertyVariables)}";
+        var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
+        if (!tmpPropertyVariables.IsNullOrEmpty())
+            propertyStrForDebug += $"灞炴�D {attrType} - {JsonMapper.ToJson(tmpPropertyVariables)}";
 #endif
         if (type == 0)
             return FightPowerFormula.GetBaseAttr(propertyVariables);
@@ -413,7 +416,7 @@
     public long CalculatePower()
     {
 #if UNITY_EDITOR
-        // Debug.Log("鎴樺姏锛氬紑濮嬭绠�");
+        FightPowerDebug("鎴樺姏锛氬紑濮嬭绠�");
 #endif
         // --- 鍏堣绠楁墍鏈夊姛鑳界殑姹囨�诲睘鎬� ---
         RefreshLVAttrs();
@@ -446,7 +449,7 @@
         }
 
 // #if UNITY_EDITOR
-//         Debug.Log("鎴樺姏锛氳绠楀畬姣� " + fightPower);
+         FightPowerDebug("鎴樺姏锛氳绠楀畬姣� " + fightPower);
 // #endif
         return fightPower;
     }
@@ -482,7 +485,7 @@
         }
 
 #if UNITY_EDITOR
-        // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
+        FightPowerDebug($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
 #endif
 
         //灞炴�х郴鏁版牴鎹畼鑱岀瓑绾х殑鍔犳垚
@@ -535,9 +538,9 @@
         long fightPower = (long)FightPowerFormula.GetFightPower(fightPowerVariables);
 #if UNITY_EDITOR
             //鎺掗櫎鍊间负0鐨勫睘鎬ц緭鍑�
-            // var tmpFightPowerVariables = fightPowerVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
-            // if (!tmpFightPowerVariables.IsNullOrEmpty())
-            //     Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�ф垬鍔� {fightPower} 灞炴�ф垬鍔涘弬鏁� {JsonMapper.ToJson(tmpFightPowerVariables)}");
+            var tmpFightPowerVariables = fightPowerVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value);
+            if (!tmpFightPowerVariables.IsNullOrEmpty())
+                FightPowerDebug($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�ф垬鍔� {fightPower} 灞炴�ф垬鍔涘弬鏁� {JsonMapper.ToJson(tmpFightPowerVariables)}");
 #endif
 
         //鍔犱笂鎶�鑳芥垬鍔�
@@ -549,9 +552,9 @@
         long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables);
 
 #if UNITY_EDITOR
-            // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎶�鑳芥垬鍔� {skillPower} 鎶�鑳藉弬鏁� {JsonMapper.ToJson(fightPowerVariables)}");
+            FightPowerDebug($"鎴樺姏锛氭灏咺D {hero.heroId} 鎶�鑳芥垬鍔� {skillPower} 鎶�鑳藉弬鏁� {JsonMapper.ToJson(fightPowerVariables)}");
 
-            // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎬绘垬鍔� {fightPower + skillPower}");
+            FightPowerDebug($"鎴樺姏锛氭灏咺D {hero.heroId} 鎬绘垬鍔� {fightPower + skillPower}");
 #endif
 
             return fightPower + skillPower;
@@ -648,10 +651,20 @@
             }
         }
 #if UNITY_EDITOR
-        // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
+        FightPowerDebug($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
 #endif
         return tmpAttrs;
     }
+
+
+    bool openLog = true;
+    void FightPowerDebug(string msg)
+    {
+#if UNITY_EDITOR
+        if (!openLog) return;
+        Debug.Log(msg);
+        #endif
+    }
 }
 
 

--
Gitblit v1.8.0