From 27b4508f4108d2420d846fb37266d16094827fc8 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 26 十一月 2025 00:03:44 +0800
Subject: [PATCH] 0312 自动生成战斗公式代码;结算的时候不处理装备;优化装备计算性能
---
Main/System/Main/FightPowerManager.cs | 504 ++++++++++++++++++++------------------------------------
1 files changed, 180 insertions(+), 324 deletions(-)
diff --git a/Main/System/Main/FightPowerManager.cs b/Main/System/Main/FightPowerManager.cs
index 505b512..aa20721 100644
--- a/Main/System/Main/FightPowerManager.cs
+++ b/Main/System/Main/FightPowerManager.cs
@@ -1,4 +1,4 @@
-锘縰sing System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -12,25 +12,100 @@
// 鎵�鏈夋灏嗘垬鍔涘姞璧锋潵 + 鎶�鑳芥垬鍔涙眹鎬伙紙鍏紡锛夊氨鏄暣涓彿鐨勬垬鍔�
public class FightPowerManager : Singleton<FightPowerManager>
{
- public string propertyFormula;
- public string fightPropertyFormula;
- public string fightPowerFormula;
- public string skillFightPowerFormula;
+ // 灞炴�у彉閲忓父閲�
+ private const string LV_VALUE = "lvValue";
+ private const string EQUIP_VALUE = "equipValue";
+ private const string BOOK_VALUE = "bookValue";
+ private const string BOOK_PER = "bookPer";
+ private const string REALM_VALUE = "realmValue";
+ private const string REALM_PER = "realmPer";
+ private const string GUBAO_VALUE = "gubaoValue";
+ private const string GUBAO_PER = "gubaoPer";
+ private const string HJG_VALUE = "hjgValue";
+ private const string HJG_PER = "hjgPer";
+ private const string HORSE_VALUE = "horseValue";
+ private const string HORSE_PER = "horsePer";
+ private const string BEAUTY_VALUE = "beautyValue";
+ private const string BEAUTY_PER = "beautyPer";
+ private const string LINEUP_INIT_ADD_PER = "lineupInitAddPer";
+ private const string LINEUP_LV_ADD_PER = "lineupLVAddPer";
+ private const string LINEUP_BREAK_LV_ADD_PER = "lineupBreakLVAddPer";
+ private const string LINEUP_STAR_ADD_PER = "lineupStarAddPer";
+ private const string LINEUP_HALO_VALUE = "lineupHaloValue";
+ private const string LINEUP_HALO_PER = "lineupHaloPer";
+ private const string INHERIT_PER = "inheritPer";
+ private const string HERO_SELF_VALUE = "heroSelfValue";
+ private const string HERO_SELF_PER = "heroSelfPer";
+ private const string STAR_TALENT_VALUE = "starTalentValue";
+ private const string STAR_TALENT_PER = "starTalentPer";
+ private const string BREAK_LV_VALUE = "breakLVValue";
+ private const string BREAK_LV_PER = "breakLVPer";
+ private const string AWAKE_TALENT_VALUE = "awakeTalentValue";
+ private const string AWAKE_TALENT_PER = "awakeTalentPer";
+ private const string FETTER_VALUE = "fetterValue";
+ private const string FETTER_PER = "fetterPer";
+ private const string HERO_LV_VALUE = "heroLVValue";
+ private const string HERO_LV_PER = "heroLVPer";
+
+ // 鎴樺姏鍙橀噺甯搁噺
+ private const string ATK_RATIO = "AtkRatio";
+ private const string MAX_HP_RATIO = "MaxHPRatio";
+ private const string DEF_RATIO = "DefRatio";
+ private const string STUN_RATE_RATIO = "StunRateRatio";
+ private const string SUPER_HIT_RATE_RATIO = "SuperHitRateRatio";
+ private const string COMBO_RATE_RATIO = "ComboRateRatio";
+ private const string MISS_RATE_RATIO = "MissRateRatio";
+ private const string PARRY_RATE_RATIO = "ParryRateRatio";
+ private const string SUCK_HP_PER_RATIO = "SuckHPPerRatio";
+ private const string STUN_RATE_DEF_RATIO = "StunRateDefRatio";
+ private const string SUPER_HIT_RATE_DEF_RATIO = "SuperHitRateDefRatio";
+ private const string COMBO_RATE_DEF_RATIO = "ComboRateDefRatio";
+ private const string MISS_RATE_DEF_RATIO = "MissRateDefRatio";
+ private const string PARRY_RATE_DEF_RATIO = "ParryRateDefRatio";
+ private const string SUCK_HP_PER_DEF_RATIO = "SuckHPPerDefRatio";
+ private const string NORMAL_SKILL_PER_RATIO = "NormalSkillPerRatio";
+ private const string NORMAL_SKILL_PER_DEF_RATIO = "NormalSkillPerDefRatio";
+ private const string ANGER_SKILL_PER_RATIO = "AngerSkillPerRatio";
+ private const string ANGER_SKILL_PER_DEF_RATIO = "AngerSkillPerDefRatio";
+ private const string SUPER_DAM_PER_RATIO = "SuperDamPerRatio";
+ private const string SUPER_DAM_PER_DEF_RATIO = "SuperDamPerDefRatio";
+ private const string SHIELD_PER_RATIO = "ShieldPerRatio";
+ private const string SHIELD_PER_DEF_RATIO = "ShieldPerDefRatio";
+ private const string DOT_PER_RATIO = "DOTPerRatio";
+ private const string DOT_PER_DEF_RATIO = "DOTPerDefRatio";
+ private const string WEI_FINAL_DAM_PER_RATIO = "WeiFinalDamPerRatio";
+ private const string WEI_FINAL_DAM_PER_DEF_RATIO = "WeiFinalDamPerDefRatio";
+ private const string SHU_FINAL_DAM_PER_RATIO = "ShuFinalDamPerRatio";
+ private const string SHU_FINAL_DAM_PER_DEF_RATIO = "ShuFinalDamPerDefRatio";
+ private const string WU_FINAL_DAM_PER_RATIO = "WuFinalDamPerRatio";
+ private const string WU_FINAL_DAM_PER_DEF_RATIO = "WuFinalDamPerDefRatio";
+ private const string QUN_FINAL_DAM_PER_RATIO = "QunFinalDamPerRatio";
+ private const string QUN_FINAL_DAM_PER_DEF_RATIO = "QunFinalDamPerDefRatio";
+ private const string FINAL_DAM_PER_RATIO = "FinalDamPerRatio";
+ private const string FINAL_DAM_PER_DEF_RATIO = "FinalDamPerDefRatio";
+ private const string PHY_DAM_PER_RATIO = "PhyDamPerRatio";
+ private const string PHY_DAM_PER_DEF_RATIO = "PhyDamPerDefRatio";
+ private const string MAG_DAM_PER_RATIO = "MagDamPerRatio";
+ private const string MAG_DAM_PER_DEF_RATIO = "MagDamPerDefRatio";
+ private const string CURE_PER_RATIO = "CurePerRatio";
+ private const string CURE_PER_DEF_RATIO = "CurePerDefRatio";
+ private const string PVP_DAM_PER_RATIO = "PVPDamPerRatio";
+ private const string PVP_DAM_PER_DEF_RATIO = "PVPDamPerDefRatio";
+ private const string PLAYER_LV = "PlayerLV";
+ private const string OFFICIAL_LV = "OfficialLV";
+ private const string SKILL_POWER = "SkillPower";
+
+
Dictionary<string, double> propertyVariables = new Dictionary<string, double>();
Dictionary<string, double> fightPowerVariables = new Dictionary<string, double>(); //鎬绘垬鍔涗腑鐨勫崟姝﹀皢鎴樺姏
-
- int useFormulaType = 0; //鍏紡璋冪敤鏂瑰紡0 浠g爜 1鍏紡
+ List<PlayerPropertyConfig> pConfig = new List<PlayerPropertyConfig>();
public FightPowerManager()
{
// 鏁板��1锛氬熀纭�涓夌淮灞炴�ц绠楀叕寮�
// 鏁板��2锛氭垬鏂楀睘鎬�/鎴樻枟鎶楁��/鐗规畩灞炴�ц绠楀叕寮�
// 鏁板��3锛氬睘鎬ф垬鍔涜绠楀叕寮忥紝璁$畻鍙傛暟璇﹁ S.灞炴�ф潯鐩厤缃�
- var config = FuncConfigConfig.Get("HeroAttrFormula");
- propertyFormula = config.Numerical1;
- fightPropertyFormula = config.Numerical2;
- fightPowerFormula = config.Numerical3;
- skillFightPowerFormula = config.Numerical4;
+ pConfig = PlayerPropertyConfig.GetValues();
JaceCalculator.Init();
}
@@ -221,99 +296,49 @@
#region 灞炴�у叕寮�
// 鍗曞熀纭�灞炴�ц绠�
-// 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.Clear();
+
+ propertyVariables[LV_VALUE] = lvAttrs.ContainsKey(attrType) ? lvAttrs[attrType] : 0;
+ propertyVariables[EQUIP_VALUE] = equipAttrs.ContainsKey(attrType) ? equipAttrs[attrType] : 0;
+ propertyVariables[BOOK_VALUE] = 0;
+ propertyVariables[REALM_VALUE] = officialAttrs.ContainsKey(attrType) ? officialAttrs[attrType] : 0;
+ propertyVariables[REALM_PER] = GetOfficialPer(attrType) / 10000.0f;
+ propertyVariables[BOOK_PER] = GetBookPer(attrType) / 10000.0f;
+ propertyVariables[GUBAO_VALUE] = 0;
+ propertyVariables[GUBAO_PER] = 0;
+ propertyVariables[HJG_VALUE] = PhantasmPavilionManager.Instance.GetAttrValue(attrType);
+ propertyVariables[HJG_PER] = PhantasmPavilionManager.Instance.GetAttrPer(attrType) / 10000.0f;
+ propertyVariables[HORSE_VALUE] = HorseManager.Instance.GetAttrValue(attrType);
+ propertyVariables[HORSE_PER] = HorseManager.Instance.GetAttrPer(attrType) / 10000.0f;
+ propertyVariables[BEAUTY_VALUE] = 0;
+ propertyVariables[BEAUTY_PER] = 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[LINEUP_INIT_ADD_PER] = GetLineUpPer(attrType, LINEUP_INIT_ADD_PER) / 10000.0f;
+ propertyVariables[LINEUP_LV_ADD_PER] = GetLineUpPer(attrType, LINEUP_LV_ADD_PER) / 10000.0f;
+ propertyVariables[LINEUP_BREAK_LV_ADD_PER] = GetLineUpPer(attrType, LINEUP_BREAK_LV_ADD_PER) / 10000.0f;
+ propertyVariables[LINEUP_STAR_ADD_PER] = GetLineUpPer(attrType, LINEUP_STAR_ADD_PER) / 10000.0f;
//闃靛鍏夌幆 涓夊洿鐧惧垎姣斿姞鎴�
- propertyVariables["lineupHaloValue"] = countryAttrs.ContainsKey(attrType) ? countryAttrs[attrType] : 0;
- propertyVariables["lineupHaloPer"] = GetCountryPer(attrType) / 10000.0f;
-
+ propertyVariables[LINEUP_HALO_VALUE] = countryAttrs.ContainsKey(attrType) ? countryAttrs[attrType] : 0;
+ propertyVariables[LINEUP_HALO_PER] = 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;
- propertyVariables["heroLVValue"] = hero.GetHeroLVValue(attrType);
- propertyVariables["heroLVPer"] = hero.GetHeroLVPer(attrType) / 10000.0f;
-
+ propertyVariables[INHERIT_PER] = hero.GetInheritAttrPer(attrType) / 10000.0f;
+ propertyVariables[HERO_SELF_VALUE] = hero.GetSelfAddValue(attrType);
+ propertyVariables[HERO_SELF_PER] = hero.GetSelfAddPer(attrType) / 10000.0f;
+ propertyVariables[STAR_TALENT_VALUE] = hero.GetTalentAttrValue(attrType);
+ propertyVariables[STAR_TALENT_PER] = hero.GetTalentAttrPer(attrType) / 10000.0f;
+ propertyVariables[BREAK_LV_VALUE] = hero.GetBreakAttrValue(attrType);
+ propertyVariables[BREAK_LV_PER] = hero.GetBreakAttrPer(attrType) / 10000.0f;
+ propertyVariables[AWAKE_TALENT_VALUE] = hero.GetAwakeAttrValue(attrType);
+ propertyVariables[AWAKE_TALENT_PER] = hero.GetAwakeAttrPer(attrType) / 10000.0f;
+ propertyVariables[FETTER_VALUE] = hero.GetFetterAttrValue(attrType);
+ propertyVariables[FETTER_PER] = hero.GetFetterAttrPer(attrType) / 10000.0f;
+ propertyVariables[HERO_LV_VALUE] = hero.GetHeroLVValue(attrType);
+ 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);
@@ -391,7 +416,6 @@
RefrehEquipAttrs();
RefreshTeamAttrs();
-
// --- 绠楀崟姝﹀皢鍔熻兘灞炴�ф垬鍔� 鍚庣浉鍔�---
long fightPower = 0;
var team = TeamManager.Instance.GetTeam(teamTypeCalc);
@@ -416,9 +440,9 @@
}
-#if UNITY_EDITOR
- Debug.Log("鎴樺姏锛氳绠楀畬姣� " + fightPower);
-#endif
+// #if UNITY_EDITOR
+// Debug.Log("鎴樺姏锛氳绠楀畬姣� " + fightPower);
+// #endif
return fightPower;
}
@@ -436,7 +460,7 @@
#if UNITY_EDITOR
propertyStrForDebug = "";
#endif
- foreach (var config in PlayerPropertyConfig.GetValues())
+ foreach (var config in pConfig)
{
if (config.showType < 1 || config.showType > 4)
{
@@ -444,17 +468,11 @@
}
if (config.showType == 1)
{
- 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);
+ fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, 0), 3);
}
else
{
- 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);
+ fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, 1), 3);
}
}
@@ -465,60 +483,51 @@
//灞炴�х郴鏁版牴鎹畼鑱岀瓑绾х殑鍔犳垚
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;
+ fightPowerVariables[ATK_RATIO] = fightPowerRatioConfig.AtkRatio;
+ fightPowerVariables[MAX_HP_RATIO] = fightPowerRatioConfig.MaxHPRatio;
+ fightPowerVariables[DEF_RATIO] = fightPowerRatioConfig.DefRatio;
+ fightPowerVariables[STUN_RATE_RATIO] = fightPowerRatioConfig.StunRateRatio;
+ fightPowerVariables[SUPER_HIT_RATE_RATIO] = fightPowerRatioConfig.SuperHitRateRatio;
+ fightPowerVariables[COMBO_RATE_RATIO] = fightPowerRatioConfig.ComboRateRatio;
+ fightPowerVariables[MISS_RATE_RATIO] = fightPowerRatioConfig.MissRateRatio;
+ fightPowerVariables[PARRY_RATE_RATIO] = fightPowerRatioConfig.ParryRateRatio;
+ fightPowerVariables[SUCK_HP_PER_RATIO] = fightPowerRatioConfig.SuckHPPerRatio;
+ fightPowerVariables[STUN_RATE_DEF_RATIO] = fightPowerRatioConfig.StunRateDefRatio;
+ fightPowerVariables[SUPER_HIT_RATE_DEF_RATIO] = fightPowerRatioConfig.SuperHitRateDefRatio;
+ fightPowerVariables[COMBO_RATE_DEF_RATIO] = fightPowerRatioConfig.ComboRateDefRatio;
+ fightPowerVariables[MISS_RATE_DEF_RATIO] = fightPowerRatioConfig.MissRateDefRatio;
+ fightPowerVariables[PARRY_RATE_DEF_RATIO] = fightPowerRatioConfig.ParryRateDefRatio;
+ fightPowerVariables[SUCK_HP_PER_DEF_RATIO] = fightPowerRatioConfig.SuckHPPerDefRatio;
+ fightPowerVariables[NORMAL_SKILL_PER_RATIO] = fightPowerRatioConfig.NormalSkillPerRatio;
+ fightPowerVariables[NORMAL_SKILL_PER_DEF_RATIO] = fightPowerRatioConfig.NormalSkillPerDefRatio;
+ fightPowerVariables[ANGER_SKILL_PER_RATIO] = fightPowerRatioConfig.AngerSkillPerRatio;
+ fightPowerVariables[ANGER_SKILL_PER_DEF_RATIO] = fightPowerRatioConfig.AngerSkillPerDefRatio;
+ fightPowerVariables[SUPER_DAM_PER_RATIO] = fightPowerRatioConfig.SuperDamPerRatio;
+ fightPowerVariables[SUPER_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.SuperDamPerDefRatio;
+ fightPowerVariables[SHIELD_PER_RATIO] = fightPowerRatioConfig.ShieldPerRatio;
+ fightPowerVariables[SHIELD_PER_DEF_RATIO] = fightPowerRatioConfig.ShieldPerDefRatio;
+ fightPowerVariables[DOT_PER_RATIO] = fightPowerRatioConfig.DOTPerRatio;
+ fightPowerVariables[DOT_PER_DEF_RATIO] = fightPowerRatioConfig.DOTPerDefRatio;
+ fightPowerVariables[WEI_FINAL_DAM_PER_RATIO] = fightPowerRatioConfig.WeiFinalDamPerRatio;
+ fightPowerVariables[WEI_FINAL_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.WeiFinalDamPerDefRatio;
+ fightPowerVariables[SHU_FINAL_DAM_PER_RATIO] = fightPowerRatioConfig.ShuFinalDamPerRatio;
+ fightPowerVariables[SHU_FINAL_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.ShuFinalDamPerDefRatio;
+ fightPowerVariables[WU_FINAL_DAM_PER_RATIO] = fightPowerRatioConfig.WuFinalDamPerRatio;
+ fightPowerVariables[WU_FINAL_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.WuFinalDamPerDefRatio;
+ fightPowerVariables[QUN_FINAL_DAM_PER_RATIO] = fightPowerRatioConfig.QunFinalDamPerRatio;
+ fightPowerVariables[QUN_FINAL_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.QunFinalDamPerDefRatio;
+ fightPowerVariables[FINAL_DAM_PER_RATIO] = fightPowerRatioConfig.FinalDamPerRatio;
+ fightPowerVariables[FINAL_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.FinalDamPerDefRatio;
+ fightPowerVariables[PHY_DAM_PER_RATIO] = fightPowerRatioConfig.PhyDamPerRatio;
+ fightPowerVariables[PHY_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.PhyDamPerDefRatio;
+ fightPowerVariables[MAG_DAM_PER_RATIO] = fightPowerRatioConfig.MagDamPerRatio;
+ fightPowerVariables[MAG_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.MagDamPerDefRatio;
+ fightPowerVariables[CURE_PER_RATIO] = fightPowerRatioConfig.CurePerRatio;
+ fightPowerVariables[CURE_PER_DEF_RATIO] = fightPowerRatioConfig.CurePerDefRatio;
+ fightPowerVariables[PVP_DAM_PER_RATIO] = fightPowerRatioConfig.PVPDamPerRatio;
+ fightPowerVariables[PVP_DAM_PER_DEF_RATIO] = fightPowerRatioConfig.PVPDamPerDefRatio;
- long fightPower;
- if (useFormulaType == 0)
- {
- fightPower = (long)FightPowerFormula.GetFightPower(fightPowerVariables);
- }
- else
- {
-
- fightPower = (long)JaceCalculator.Calculate(fightPowerFormula, fightPowerVariables);
- }
+ 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);
@@ -528,19 +537,11 @@
//鍔犱笂鎶�鑳芥垬鍔�
fightPowerVariables.Clear();
- fightPowerVariables["PlayerLV"] = PlayerDatas.Instance.baseData.LV;
- fightPowerVariables["OfficialLV"] = PlayerDatas.Instance.baseData.realmLevel;
- fightPowerVariables["SkillPower"] = hero.GetSkillsFightPower();
+ fightPowerVariables[PLAYER_LV] = PlayerDatas.Instance.baseData.LV;
+ fightPowerVariables[OFFICIAL_LV] = PlayerDatas.Instance.baseData.realmLevel;
+ fightPowerVariables[SKILL_POWER] = hero.GetSkillsFightPower();
- long skillPower;
- if (useFormulaType == 0)
- {
- skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables);
- }
- else
- {
- skillPower = (long)JaceCalculator.Calculate(skillFightPowerFormula, fightPowerVariables);
- }
+ long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables);
#if UNITY_EDITOR
// Debug.Log($"鎴樺姏锛氭灏咺D {hero.heroId} 鎶�鑳芥垬鍔� {skillPower} 鎶�鑳藉弬鏁� {JsonMapper.ToJson(fightPowerVariables)}");
@@ -552,6 +553,7 @@
}
+
/// <summary>
/// 鍜岃韩涓婅澶囧姣斿樊
/// </summary>
@@ -561,159 +563,13 @@
{
InitFightPowerParam();
var fightPower = CalculatePower();
-
+
InitFightPowerParam(dropindex: item.gridIndex);
var tmpFightPower = CalculatePower();
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}");
-#endif
- return tmpFightPower - fightPower;
- }
-
- 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. 涓婇樀鑻遍泟鏄剧ず锛屽湪涓荤嚎闃靛涓嬬殑鎴樺姏
@@ -771,7 +627,7 @@
propertyStrForDebug = "";
#endif
- foreach (var config in PlayerPropertyConfig.GetValues())
+ foreach (var config in pConfig)
{
if (config.showType < 1 || config.showType > 4)
{
--
Gitblit v1.8.0