| | |
| | | return tmpFightPower - fightPower; |
| | | } |
| | | |
| | | //装备掉落的简易对比,只做两装备之间的好坏对比不用全部计算,避免GC问题 |
| | | 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. 上阵英雄显示,在主线阵容下的战力 |