| | |
| | | /// <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 |
| | |
| | | lvAttrs[attrType] = GetPlayerLVValue(playerLVConfig, attrType); |
| | | } |
| | | #if UNITY_EDITOR |
| | | // Debug.Log("战力:等级属性 " + JsonMapper.ToJson(lvAttrs)); |
| | | FightPowerDebug("战力:等级属性 " + JsonMapper.ToJson(lvAttrs)); |
| | | #endif |
| | | |
| | | } |
| | |
| | | officialAttrs[id] = config.AddAttrNum[i]; |
| | | } |
| | | #if UNITY_EDITOR |
| | | // Debug.Log("战力:官职属性 " + JsonMapper.ToJson(officialAttrs)); |
| | | FightPowerDebug("战力:官职属性 " + JsonMapper.ToJson(officialAttrs)); |
| | | #endif |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | // Debug.Log("战力:装备属性 " + JsonMapper.ToJson(equipAttrs)); |
| | | FightPowerDebug("战力:装备属性 " + JsonMapper.ToJson(equipAttrs)); |
| | | #endif |
| | | } |
| | | |
| | |
| | | // 阵容:国家(光环)属性 |
| | | countryAttrs = HeroUIManager.Instance.GetCountryAttrs(teamTypeCalc, isPreviewTeamPower); |
| | | #if UNITY_EDITOR |
| | | // Debug.Log("战力:国家(光环)属性 " + JsonMapper.ToJson(countryAttrs)); |
| | | FightPowerDebug("战力:国家(光环)属性 " + JsonMapper.ToJson(countryAttrs)); |
| | | #endif |
| | | } |
| | | |
| | |
| | | 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 += $"属性ID {attrType} - {JsonMapper.ToJson(tmpPropertyVariables)}"; |
| | | var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value); |
| | | if (!tmpPropertyVariables.IsNullOrEmpty()) |
| | | propertyStrForDebug += $"属性ID {attrType} - {JsonMapper.ToJson(tmpPropertyVariables)}"; |
| | | #endif |
| | | if (type == 0) |
| | | return FightPowerFormula.GetBaseAttr(propertyVariables); |
| | |
| | | public long CalculatePower() |
| | | { |
| | | #if UNITY_EDITOR |
| | | // Debug.Log("战力:开始计算"); |
| | | FightPowerDebug("战力:开始计算"); |
| | | #endif |
| | | // --- 先计算所有功能的汇总属性 --- |
| | | RefreshLVAttrs(); |
| | |
| | | } |
| | | |
| | | // #if UNITY_EDITOR |
| | | // Debug.Log("战力:计算完毕 " + fightPower); |
| | | FightPowerDebug("战力:计算完毕 " + fightPower); |
| | | // #endif |
| | | return fightPower; |
| | | } |
| | |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | // Debug.Log($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}"); |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}"); |
| | | #endif |
| | | |
| | | //属性系数根据官职等级的加成 |
| | |
| | | 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($"战力:武将ID {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($"战力:武将ID {hero.heroId} 属性战力 {fightPower} 属性战力参数 {JsonMapper.ToJson(tmpFightPowerVariables)}"); |
| | | #endif |
| | | |
| | | //加上技能战力 |
| | |
| | | long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables); |
| | | |
| | | #if UNITY_EDITOR |
| | | // Debug.Log($"战力:武将ID {hero.heroId} 技能战力 {skillPower} 技能参数 {JsonMapper.ToJson(fightPowerVariables)}"); |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 技能战力 {skillPower} 技能参数 {JsonMapper.ToJson(fightPowerVariables)}"); |
| | | |
| | | // Debug.Log($"战力:武将ID {hero.heroId} 总战力 {fightPower + skillPower}"); |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 总战力 {fightPower + skillPower}"); |
| | | #endif |
| | | |
| | | return fightPower + skillPower; |
| | |
| | | } |
| | | } |
| | | #if UNITY_EDITOR |
| | | // Debug.Log($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}"); |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 属性信息 {propertyStrForDebug}"); |
| | | #endif |
| | | return tmpAttrs; |
| | | } |
| | | |
| | | |
| | | bool openLog = true; |
| | | void FightPowerDebug(string msg) |
| | | { |
| | | #if UNITY_EDITOR |
| | | if (!openLog) return; |
| | | Debug.Log(msg); |
| | | #endif |
| | | } |
| | | } |
| | | |
| | | |