From b3b82915705dfee86db127d45eea6dd2442d6d92 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 21 十一月 2025 17:25:27 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/Main/FightPowerManager.cs | 182 +++++++++++++++++++++++++++++++++++++-------
1 files changed, 151 insertions(+), 31 deletions(-)
diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index ed85d77..53f3e7f 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -4,7 +4,7 @@
using System.Linq;
using UnityEngine;
using LitJson;
-using Spine;
+
//锛佸崟鑻遍泟鏌ョ湅鎴樺姏 鍙畻鑷繁鐨勪笂闃靛睘鎬� 涓嶇畻缇佺粖 鎬讳笂闃靛睘鎬� 鍏夌幆
// 鎴樺姏鐨勮绠楁柟寮�
@@ -20,7 +20,7 @@
Dictionary<string, double> propertyVariables = new Dictionary<string, double>();
Dictionary<string, double> fightPowerVariables = new Dictionary<string, double>(); //鎬绘垬鍔涗腑鐨勫崟姝﹀皢鎴樺姏
-
+ int useFormulaType = 0; //鍏紡璋冪敤鏂瑰紡0 浠g爜 1鍏紡
public FightPowerManager()
{
// 鏁板��1锛氬熀纭�涓夌淮灞炴�ц绠楀叕寮�
@@ -31,6 +31,7 @@
fightPropertyFormula = config.Numerical2;
fightPowerFormula = config.Numerical3;
skillFightPowerFormula = config.Numerical4;
+ JaceCalculator.Init();
}
#region 鍒濆鍖栨垬鍔涜绠楃殑淇℃伅
@@ -52,7 +53,7 @@
dropIndexCalc = dropindex;
#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氬垵濮嬪寲鍙傛暟 dropIndex锛�" + dropIndexCalc + " 闃靛瀷锛�" + teamTypeCalc + " ispreview:" + ispreview);
+ // Debug.Log("鎴樺姏锛氬垵濮嬪寲鍙傛暟 dropIndex锛�" + dropIndexCalc + " 闃靛瀷锛�" + teamTypeCalc + " ispreview:" + ispreview);
#endif
}
#endregion
@@ -63,6 +64,7 @@
//鍔熻兘灞炴�� 绫诲瀷锛氬��
public Dictionary<int, int> lvAttrs = new Dictionary<int, int>(); //绛夌骇灞炴��
+ public Dictionary<int, int> officialAttrs = new Dictionary<int, int>(); //瀹樿亴灞炴��
//鍒嗗紑瀛樺偍棰勮鍜� 鐪熷疄灞炴��
public Dictionary<int, int> equipAttrs = new Dictionary<int, int>(); //瑁呭灞炴��
@@ -79,7 +81,7 @@
lvAttrs[attrType] = GetPlayerLVValue(playerLVConfig, attrType);
}
#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氱瓑绾у睘鎬� " + JsonMapper.ToJson(lvAttrs));
+ // Debug.Log("鎴樺姏锛氱瓑绾у睘鎬� " + JsonMapper.ToJson(lvAttrs));
#endif
}
@@ -99,6 +101,23 @@
return config.MaxHP;
}
return 0;
+ }
+
+
+ //瀹樿亴灞炴��
+ void RefreshOfficialAttrs()
+ {
+ officialAttrs.Clear();
+ var config = RealmConfig.Get(PlayerDatas.Instance.baseData.realmLevel);
+ for (int i = 0; i < config.AddAttrType.Length; i++)
+ {
+ var id = config.AddAttrType[i];
+ officialAttrs[id] = config.AddAttrNum[i];
+ }
+#if UNITY_EDITOR
+ // Debug.Log("鎴樺姏锛氬畼鑱屽睘鎬� " + JsonMapper.ToJson(officialAttrs));
+#endif
+
}
//瑁呭灞炴��:韬笂瑁呭姹囨��
@@ -156,7 +175,7 @@
}
#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氳澶囧睘鎬� " + JsonMapper.ToJson(equipAttrs));
+ // Debug.Log("鎴樺姏锛氳澶囧睘鎬� " + JsonMapper.ToJson(equipAttrs));
#endif
}
@@ -168,12 +187,12 @@
lineUpPerDict = HeroUIManager.Instance.GetLineupPer(teamTypeCalc, isPreviewTeamPower);
#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氫笂闃靛睘鎬� " + JsonMapper.ToJson(lineUpPerDict));
+ // Debug.Log("鎴樺姏锛氫笂闃靛睘鎬� " + JsonMapper.ToJson(lineUpPerDict));
#endif
// 闃靛锛氬浗瀹讹紙鍏夌幆锛夊睘鎬�
countryAttrs = HeroUIManager.Instance.GetCountryAttrs(teamTypeCalc, isPreviewTeamPower);
#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氬浗瀹讹紙鍏夌幆锛夊睘鎬� " + JsonMapper.ToJson(countryAttrs));
+ // Debug.Log("鎴樺姏锛氬浗瀹讹紙鍏夌幆锛夊睘鎬� " + JsonMapper.ToJson(countryAttrs));
#endif
}
@@ -202,13 +221,72 @@
#region 灞炴�у叕寮�
// 鍗曞熀纭�灞炴�ц绠�
- public double GetPropertyVaule(int attrType, HeroInfo hero, string formula)
+// public double GetPropertyVaule(int attrType, HeroInfo hero, string formula)
+// {
+// propertyVariables.Clear();
+// propertyVariables["lvValue"] = lvAttrs.ContainsKey(attrType) ? lvAttrs[attrType] : 0;
+// propertyVariables["equipValue"] = equipAttrs.ContainsKey(attrType) ? equipAttrs[attrType] : 0;
+// propertyVariables["bookValue"] = 0;
+// propertyVariables["bookPer"] = GetBookPer(attrType) / 10000.0f;
+// propertyVariables["realmValue"] = officialAttrs.ContainsKey(attrType) ? officialAttrs[attrType] : 0;
+// propertyVariables["realmPer"] = GetOfficialPer(attrType) / 10000.0f;
+// propertyVariables["gubaoValue"] = 0;
+// propertyVariables["gubaoPer"] = 0;
+// propertyVariables["hjgValue"] = 0;
+// propertyVariables["hjgPer"] = 0;
+// propertyVariables["horseValue"] = 0;
+// propertyVariables["horsePer"] = 0;
+
+// //锛侊紒锛佸崟姝﹀皢鎴樺姏棰勮鐨勮瘽闇�瑕佹帓闄ら槦浼嶅奖鍝嶆垬鍔涳紝鍙畻姝﹀皢鑷韩鐨勪笂闃靛睘鎬�
+// propertyVariables["lineupInitAddPer"] = GetLineUpPer(attrType, "lineupInitAddPer") / 10000.0f;
+// propertyVariables["lineupLVAddPer"] = GetLineUpPer(attrType, "lineupLVAddPer") / 10000.0f;
+// propertyVariables["lineupBreakLVAddPer"] = GetLineUpPer(attrType, "lineupBreakLVAddPer") / 10000.0f;
+// propertyVariables["lineupStarAddPer"] = GetLineUpPer(attrType, "lineupStarAddPer") / 10000.0f;
+
+// //闃靛鍏夌幆 涓夊洿鐧惧垎姣斿姞鎴�
+// propertyVariables["lineupHaloValue"] = countryAttrs.ContainsKey(attrType) ? countryAttrs[attrType] : 0;
+// propertyVariables["lineupHaloPer"] = GetCountryPer(attrType) / 10000.0f;
+
+
+// //姝﹀皢灞炴��
+// propertyVariables["inheritPer"] = hero.GetInheritAttrPer(attrType) / 10000.0f;
+// propertyVariables["heroSelfValue"] = hero.GetSelfAddValue(attrType);
+// propertyVariables["heroSelfPer"] = hero.GetSelfAddPer(attrType) / 10000.0f;
+// propertyVariables["starTalentValue"] = hero.GetTalentAttrValue(attrType);
+// propertyVariables["starTalentPer"] = hero.GetTalentAttrPer(attrType) / 10000.0f;
+// propertyVariables["breakLVValue"] = hero.GetBreakAttrValue(attrType);
+// propertyVariables["breakLVPer"] = hero.GetBreakAttrPer(attrType) / 10000.0f;
+// propertyVariables["awakeTalentValue"] = hero.GetAwakeAttrValue(attrType);
+// propertyVariables["awakeTalentPer"] = hero.GetAwakeAttrPer(attrType) / 10000.0f;
+// propertyVariables["fetterValue"] = hero.GetFetterAttrValue(attrType);
+// propertyVariables["fetterPer"] = hero.GetFetterAttrPer(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)}";
+// #endif
+// return JaceCalculator.Calculate(formula, propertyVariables);
+// }
+
+ public double GetPropertyVaule(int attrType, HeroInfo hero, int type)
{
propertyVariables.Clear();
propertyVariables["lvValue"] = lvAttrs.ContainsKey(attrType) ? lvAttrs[attrType] : 0;
propertyVariables["equipValue"] = equipAttrs.ContainsKey(attrType) ? equipAttrs[attrType] : 0;
propertyVariables["bookValue"] = 0;
propertyVariables["bookPer"] = GetBookPer(attrType) / 10000.0f;
+ propertyVariables["realmValue"] = officialAttrs.ContainsKey(attrType) ? officialAttrs[attrType] : 0;
+ propertyVariables["realmPer"] = GetOfficialPer(attrType) / 10000.0f;
+ propertyVariables["gubaoValue"] = 0;
+ propertyVariables["gubaoPer"] = 0;
+ propertyVariables["hjgValue"] = PhantasmPavilionManager.Instance.GetAttrValue(attrType);
+ propertyVariables["hjgPer"] = PhantasmPavilionManager.Instance.GetAttrPer(attrType) / 10000.0f;
+ propertyVariables["horseValue"] = HorseManager.Instance.GetAttrValue(attrType);
+ propertyVariables["horsePer"] = HorseManager.Instance.GetAttrPer(attrType) / 10000.0f;
+ propertyVariables["beautyValue"] = 0;
+ propertyVariables["beautyPer"] = 0;
//锛侊紒锛佸崟姝﹀皢鎴樺姏棰勮鐨勮瘽闇�瑕佹帓闄ら槦浼嶅奖鍝嶆垬鍔涳紝鍙畻姝﹀皢鑷韩鐨勪笂闃靛睘鎬�
propertyVariables["lineupInitAddPer"] = GetLineUpPer(attrType, "lineupInitAddPer") / 10000.0f;
@@ -236,12 +314,17 @@
#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
- return JaceCalculator.Calculate(formula, propertyVariables);
+ if (type == 0)
+ return FightPowerFormula.GetBaseAttr(propertyVariables);
+ else
+ return FightPowerFormula.GetFightAttr(propertyVariables);
}
+
+
int GetLineUpPer(int attrType, string key)
@@ -260,7 +343,18 @@
{
return 0;
}
- return HeroUIManager.Instance.bookPer;
+ return HeroUIManager.Instance.allHeroBookPer;
+ }
+
+ int GetOfficialPer(int attrType)
+ {
+ if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType))
+ {
+ var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType];
+ return officialAttrs.ContainsKey(pertype) ? officialAttrs[pertype] : 0;
+ }
+
+ return 0;
}
int GetCountryPer(int attrType)
@@ -287,10 +381,11 @@
public long CalculatePower()
{
#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氬紑濮嬭绠�");
+ // Debug.Log("鎴樺姏锛氬紑濮嬭绠�");
#endif
// --- 鍏堣绠楁墍鏈夊姛鑳界殑姹囨�诲睘鎬� ---
RefreshLVAttrs();
+ RefreshOfficialAttrs();
RefrehEquipAttrs();
RefreshTeamAttrs();
@@ -347,16 +442,22 @@
}
if (config.showType == 1)
{
- fightPowerVariables[config.Parameter] = (ulong)GetPropertyVaule(config.ID, hero, propertyFormula);
+ if (useFormulaType == 0)
+ fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, 0), 3);
+ // else
+ // fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, propertyFormula), 3);
}
else
{
- fightPowerVariables[config.Parameter] = (ulong)GetPropertyVaule(config.ID, hero, fightPropertyFormula);
+ if (useFormulaType == 0)
+ fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, 1), 3);
+ // else
+ // fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, fightPropertyFormula), 3);
}
}
#if UNITY_EDITOR
- Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
+ // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
#endif
//灞炴�х郴鏁版牴鎹畼鑱岀瓑绾х殑鍔犳垚
@@ -403,14 +504,24 @@
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
+ {
- long fightPower = (long)JaceCalculator.Calculate(fightPowerFormula, fightPowerVariables);
+ fightPower = (long)JaceCalculator.Calculate(fightPowerFormula, 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)}");
+ //鎺掗櫎鍊间负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)}");
#endif
//鍔犱笂鎶�鑳芥垬鍔�
@@ -419,15 +530,23 @@
fightPowerVariables["OfficialLV"] = PlayerDatas.Instance.baseData.realmLevel;
fightPowerVariables["SkillPower"] = hero.GetSkillsFightPower();
- long skillPower = (long)JaceCalculator.Calculate(skillFightPowerFormula, fightPowerVariables);
+ long skillPower;
+ if (useFormulaType == 0)
+ {
+ skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables);
+ }
+ else
+ {
+ skillPower = (long)JaceCalculator.Calculate(skillFightPowerFormula, fightPowerVariables);
+ }
#if UNITY_EDITOR
- Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎶�鑳芥垬鍔� {skillPower} 鎶�鑳藉弬鏁� {JsonMapper.ToJson(fightPowerVariables)}");
+ // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎶�鑳芥垬鍔� {skillPower} 鎶�鑳藉弬鏁� {JsonMapper.ToJson(fightPowerVariables)}");
- Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎬绘垬鍔� {fightPower + skillPower}");
+ // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎬绘垬鍔� {fightPower + skillPower}");
#endif
- return fightPower + skillPower;
+ return fightPower + skillPower;
}
@@ -461,16 +580,17 @@
var index = team.GetEmptyPosition();
if (index < 0)
{
- team.AddHero(heroInfo, 5);
+ team.AddHero(heroInfo, 5, false);
}
else
{
- team.AddHero(heroInfo, index);
+ team.AddHero(heroInfo, index, false);
}
}
InitFightPowerParam(ispreview: ispreview);
RefreshLVAttrs();
+ RefreshOfficialAttrs();
RefrehEquipAttrs();
RefreshTeamAttrs();
@@ -510,15 +630,15 @@
}
if (config.showType == 1)
{
- tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, propertyFormula);
+ tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, 0);
}
else
{
- tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, fightPropertyFormula);
+ tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, 1);
}
}
#if UNITY_EDITOR
- Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
+ // Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 灞炴�т俊鎭� {propertyStrForDebug}");
#endif
return tmpAttrs;
}
--
Gitblit v1.8.0