| | |
| | | fightPropertyFormula = config.Numerical2; |
| | | fightPowerFormula = config.Numerical3; |
| | | skillFightPowerFormula = config.Numerical4; |
| | | JaceCalculator.Init(); |
| | | } |
| | | |
| | | #region 初始化战力计算的信息 |
| | |
| | | |
| | | //功能属性 类型:值 |
| | | 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>(); //装备属性 |
| | |
| | | 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 |
| | | |
| | | } |
| | | |
| | | //装备属性:身上装备汇总 |
| | |
| | | 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["lineupInitAddPer"] = GetLineUpPer(attrType, "lineupInitAddPer") / 10000.0f; |
| | |
| | | { |
| | | 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) |
| | |
| | | #endif |
| | | // --- 先计算所有功能的汇总属性 --- |
| | | RefreshLVAttrs(); |
| | | RefreshOfficialAttrs(); |
| | | RefrehEquipAttrs(); |
| | | RefreshTeamAttrs(); |
| | | |
| | |
| | | } |
| | | if (config.showType == 1) |
| | | { |
| | | fightPowerVariables[config.Parameter] = (ulong)GetPropertyVaule(config.ID, hero, propertyFormula); |
| | | fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, propertyFormula), 3); |
| | | } |
| | | else |
| | | { |
| | | fightPowerVariables[config.Parameter] = (ulong)GetPropertyVaule(config.ID, hero, fightPropertyFormula); |
| | | fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, fightPropertyFormula), 3); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | InitFightPowerParam(ispreview: ispreview); |
| | | RefreshLVAttrs(); |
| | | RefreshOfficialAttrs(); |
| | | RefrehEquipAttrs(); |
| | | RefreshTeamAttrs(); |
| | | |
| | |
| | | #endregion |
| | | |
| | | |
| | | public Dictionary<int, long> GetHeroTotalAttr(HeroInfo hero) |
| | | { |
| | | |
| | | Dictionary<int, long> tmpAttrs = new Dictionary<int, long>(); |
| | | hero.RefreshFetterAttrsWhenCalcPower(TeamType.Story); //羁绊属性要实时算 |
| | | |
| | | #if UNITY_EDITOR |
| | | propertyStrForDebug = ""; |
| | | #endif |
| | | |
| | | foreach (var config in PlayerPropertyConfig.GetValues()) |
| | | { |
| | | if (config.showType < 1 || config.showType > 4) |
| | | { |
| | | continue; |
| | | } |
| | | if (config.showType == 1) |
| | | { |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, propertyFormula); |
| | | } |
| | | else |
| | | { |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, fightPropertyFormula); |
| | | } |
| | | } |
| | | #if UNITY_EDITOR |
| | | Debug.Log($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}"); |
| | | #endif |
| | | return tmpAttrs; |
| | | } |
| | | } |
| | | |
| | | |