| | |
| | | // 所有武将战力加起来 + 技能战力汇总(公式)就是整个号的战力 |
| | | public class FightPowerManager : Singleton<FightPowerManager> |
| | | { |
| | | // 属性变量常量 |
| | | 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 FATES_VALUE = "fatesValue"; |
| | | private const string FATES_PER = "fatesPer"; |
| | | 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 HERO_CARDPER = "cardPer"; |
| | | private const string DINGJUNGE_VALUE = "dingjungeValue"; |
| | | private const string DINGJUNGE_PER = "dingjungePer"; |
| | | private const string MINGGE_VALUE = "minggeValue"; |
| | | private const string MINGGE_PER = "minggePer"; |
| | | |
| | | // 战力变量常量 |
| | | 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 GUANCHUAN_RATIO = "GuanchuanRatio"; |
| | | private const string GUANCHUAN_DEF_RATIO = "GuanchuanDefRatio"; |
| | | private const string ZHAOJIA_RATIO = "ZhaojiaRatio"; |
| | | private const string ZHAOJIA_DEF_RATIO = "ZhaojiaDefRatio"; |
| | | private const string ATKSPEEDRATIO_VALUE = "AtkSpeedRatio"; |
| | | |
| | | |
| | | 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>(); //总战力中的单武将战力 |
| | | List<PlayerPropertyConfig> pConfig = new List<PlayerPropertyConfig>(); |
| | | public FightPowerManager() |
| | | { |
| | | // 数值1:基础三维属性计算公式 |
| | | // 数值2:战斗属性/战斗抗性/特殊属性计算公式 |
| | | // 数值3:属性战力计算公式,计算参数详见 S.属性条目配置 |
| | | pConfig = PlayerPropertyConfig.GetValues(); |
| | | JaceCalculator.Init(); |
| | | } |
| | | |
| | | public long lastFightPower = 0; //上一次的服务端战力,用于重置是否重新计算武将百分比 羁绊等,没有变化则减少计算 |
| | | public long lastMinggeSkillPower = 0; |
| | | |
| | | #region 初始化战力计算的信息 |
| | | int teamTypeCalc = 1; //不同阵容战力不同 |
| | |
| | | dropIndexCalc = dropindex; |
| | | minggeDropIndex = _minggeDropIndex; |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:初始化参数 dropIndex:" + dropIndexCalc + " 阵型:" + teamTypeCalc + " ispreview:" + ispreview |
| | | + " minggePresetID:" + _minggePresetID + " minggeDropIndex:" + _minggeDropIndex); |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:初始化参数 dropIndex:" + dropIndexCalc + " 阵型:" + teamTypeCalc + " ispreview:" + ispreview |
| | | + " minggePresetID:" + _minggePresetID + " minggeDropIndex:" + _minggeDropIndex); |
| | | } |
| | | #endif |
| | | } |
| | | #endregion |
| | |
| | | lvAttrs[attrType] = GetPlayerLVValue(playerLVConfig, attrType); |
| | | } |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:等级属性 " + JsonMapper.ToJson(lvAttrs)); |
| | | FightPowerDebug("战力:红颜属性 " + JsonMapper.ToJson(BeautyMMManager.Instance.allMMTalentAttr)); |
| | | FightPowerDebug("战力:古宝属性 " + JsonMapper.ToJson(GubaoManager.Instance.gubaoAllAttrDict)); |
| | | |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:等级属性 " + JsonMapper.ToJson(lvAttrs)); |
| | | FightPowerDebug("战力:红颜属性 " + JsonMapper.ToJson(BeautyMMManager.Instance.allMMTalentAttr)); |
| | | FightPowerDebug("战力:古宝属性 " + JsonMapper.ToJson(GubaoManager.Instance.gubaoAllAttrDict)); |
| | | } |
| | | #endif |
| | | |
| | | } |
| | |
| | | officialAttrs[id] = config.AddAttrNum[i]; |
| | | } |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:官职属性 " + JsonMapper.ToJson(officialAttrs)); |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:官职属性 " + JsonMapper.ToJson(officialAttrs)); |
| | | } |
| | | #endif |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:装备属性 " + JsonMapper.ToJson(equipAttrs)); |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:装备属性 " + JsonMapper.ToJson(equipAttrs)); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | |
| | | // 阵容:所有武将上阵属性 |
| | | // lineUpPerDict = HeroUIManager.Instance.GetLineupPer(teamTypeCalc, isPreviewTeamPower); |
| | | allHeroAddPer = HeroUIManager.Instance.GetAllHeroPer() / 10000.0; |
| | | #if UNITY_EDITOR |
| | | // Debug.Log("战力:上阵属性 " + JsonMapper.ToJson(lineUpPerDict)); |
| | | #endif |
| | | |
| | | // 阵容:国家(光环)属性 |
| | | countryAttrs = HeroUIManager.Instance.GetCountryAttrs(teamTypeCalc, isPreviewTeamPower); |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:国家(光环)属性 " + JsonMapper.ToJson(countryAttrs)); |
| | | FightPowerDebug("战力:武将所有加成 " + allHeroAddPer); |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:国家(光环)属性 " + JsonMapper.ToJson(countryAttrs)); |
| | | FightPowerDebug("战力:武将所有加成 " + allHeroAddPer); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:命格属性 " + JsonMapper.ToJson(minggeAttrs)); |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:命格属性 " + JsonMapper.ToJson(minggeAttrs)); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | |
| | | public int GetAttrPer(int attrID, Dictionary<int, long> attrDic) |
| | | { |
| | | if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrID)) |
| | | if (attrID == 6 || attrID == 7 || attrID == 8) |
| | | { |
| | | var pertype = PlayerPropertyConfig.baseAttr2perDict[attrID]; |
| | | var pertype = attrID + 10; |
| | | attrDic.TryGetValue(pertype, out long value); |
| | | return (int)(value); |
| | | } |
| | | return 0; |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | #region 属性公式 |
| | | // 单基础属性计算 |
| | | public double GetPropertyVaule(int attrType, HeroInfo hero, int type) |
| | | public double GetPropertyVaule(int attrType, HeroInfo hero) |
| | | { |
| | | // 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] = GetAttrPer(attrType, officialAttrs) / 10000.0; |
| | | // propertyVariables[BOOK_PER] = GetBookPer(attrType) / 10000.0; |
| | | propertyVariables[GUBAO_VALUE] = GubaoManager.Instance.GetAttrValue(attrType); |
| | | propertyVariables[GUBAO_PER] = GubaoManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | propertyVariables[HJG_VALUE] = PhantasmPavilionManager.Instance.GetAttrValue(attrType); |
| | | propertyVariables[HJG_PER] = PhantasmPavilionManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | propertyVariables[HORSE_VALUE] = HorseManager.Instance.GetAttrValue(attrType); |
| | | propertyVariables[HORSE_PER] = HorseManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | propertyVariables[BEAUTY_VALUE] = BeautyMMManager.Instance.GetAttrValue(attrType); |
| | | propertyVariables[BEAUTY_PER] = BeautyMMManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | propertyVariables[FATES_VALUE] = HeroFatesManager.Instance.GetAttrValue(attrType); |
| | | propertyVariables[FATES_PER] = HeroFatesManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | propertyVariables[DINGJUNGE_VALUE] = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | propertyVariables[DINGJUNGE_PER] = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | propertyVariables[MINGGE_VALUE] = minggeAttrs.ContainsKey(attrType) ? minggeAttrs[attrType] : 0; |
| | | propertyVariables[MINGGE_PER] = GetAttrPer(attrType, minggeAttrs) / 10000.0; |
| | | |
| | | lvAttrs.TryGetValue(attrType, out var lvValue); |
| | | equipAttrs.TryGetValue(attrType, out var equipValue); |
| | | officialAttrs.TryGetValue(attrType, out var realmValue); |
| | | var realmPer = GetAttrPer(attrType, officialAttrs) / 10000.0; |
| | | var gubaoValue = GubaoManager.Instance.GetAttrValue(attrType); |
| | | var gubaoPer = GubaoManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | var hjgValue = PhantasmPavilionManager.Instance.GetAttrValue(attrType); |
| | | var hjgPer = PhantasmPavilionManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | var horseValue = HorseManager.Instance.GetAttrValue(attrType); |
| | | var horsePer = HorseManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | var beautyValue = BeautyMMManager.Instance.GetAttrValue(attrType); |
| | | var beautyPer = BeautyMMManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | var fatesValue = HeroFatesManager.Instance.GetAttrValue(attrType); |
| | | var fatesPer = HeroFatesManager.Instance.GetAttrPer(attrType) / 10000.0; |
| | | var dingjungeValue = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | var dingjungePer = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | minggeAttrs.TryGetValue(attrType, out var minggeValue); |
| | | var minggePer = GetAttrPer(attrType, minggeAttrs) / 10000.0; |
| | | |
| | | //全体卡牌加成 |
| | | double cardPer = 0; |
| | | if (attrType == 6 || attrType == 7 || attrType == 8) |
| | | { |
| | | propertyVariables[HERO_CARDPER] = allHeroAddPer; |
| | | cardPer = allHeroAddPer; |
| | | } |
| | | else |
| | | { |
| | | propertyVariables[HERO_CARDPER] = 0; |
| | | } |
| | | //!!!单武将战力预览的话需要排除队伍影响战力,只算武将自身的上阵属性 |
| | | // propertyVariables[LINEUP_INIT_ADD_PER] = GetLineUpPer(attrType, LINEUP_INIT_ADD_PER) / 10000.0; |
| | | // propertyVariables[LINEUP_LV_ADD_PER] = GetLineUpPer(attrType, LINEUP_LV_ADD_PER) / 10000.0; |
| | | // propertyVariables[LINEUP_BREAK_LV_ADD_PER] = GetLineUpPer(attrType, LINEUP_BREAK_LV_ADD_PER) / 10000.0; |
| | | // propertyVariables[LINEUP_STAR_ADD_PER] = GetLineUpPer(attrType, LINEUP_STAR_ADD_PER) / 10000.0; |
| | | |
| | | //阵容光环 三围百分比加成 |
| | | propertyVariables[LINEUP_HALO_VALUE] = countryAttrs.ContainsKey(attrType) ? countryAttrs[attrType] : 0; |
| | | propertyVariables[LINEUP_HALO_PER] = GetCountryPer(attrType) / 10000.0; |
| | | var lineupHaloPer = GetCountryPer(attrType) / 10000.0; |
| | | |
| | | //武将属性 |
| | | propertyVariables[INHERIT_PER] = hero.GetInheritAttrPer(attrType) / 10000.0; |
| | | propertyVariables[HERO_SELF_VALUE] = hero.GetSelfAddValue(attrType); |
| | | propertyVariables[HERO_SELF_PER] = hero.GetSelfAddPer(attrType) / 10000.0; |
| | | propertyVariables[STAR_TALENT_VALUE] = hero.GetTalentAttrValue(attrType); |
| | | propertyVariables[STAR_TALENT_PER] = hero.GetTalentAttrPer(attrType) / 10000.0; |
| | | propertyVariables[BREAK_LV_VALUE] = hero.GetBreakAttrValue(attrType); |
| | | propertyVariables[BREAK_LV_PER] = hero.GetBreakAttrPer(attrType) / 10000.0; |
| | | propertyVariables[AWAKE_TALENT_VALUE] = hero.GetAwakeAttrValue(attrType); |
| | | propertyVariables[AWAKE_TALENT_PER] = hero.GetAwakeAttrPer(attrType) / 10000.0; |
| | | propertyVariables[FETTER_VALUE] = hero.GetFetterAttrValue(attrType); |
| | | propertyVariables[FETTER_PER] = hero.GetFetterAttrPer(attrType) / 10000.0; |
| | | propertyVariables[HERO_LV_VALUE] = hero.GetHeroLVValue(attrType); |
| | | propertyVariables[HERO_LV_PER] = hero.GetHeroLVPer(attrType) / 10000.0; |
| | | |
| | | double value; |
| | | if (type == 0) |
| | | { |
| | | value = FightPowerFormula.GetBaseAttr(propertyVariables); |
| | | } |
| | | else |
| | | { |
| | | value = FightPowerFormula.GetFightAttr(propertyVariables); |
| | | } |
| | | var inheritPer = hero.GetInheritAttrPer(attrType) / 10000.0; |
| | | var heroSelfValue = hero.GetSelfAddValue(attrType); |
| | | var starTalentPer = hero.GetTalentAttrPer(attrType) / 10000.0; |
| | | var breakLVPer = hero.GetBreakAttrPer(attrType) / 10000.0; |
| | | var awakeTalentPer = hero.GetAwakeAttrPer(attrType) / 10000.0; |
| | | var fetterPer = hero.GetFetterAttrPer(attrType) / 10000.0; |
| | | var heroLVValue = hero.GetHeroLVValue(attrType); |
| | | |
| | | double value = (lvValue+equipValue+realmValue+gubaoValue+hjgValue+horseValue+beautyValue+fatesValue+dingjungeValue+minggeValue)*(1+lineupHaloPer+realmPer+gubaoPer+hjgPer+horsePer+beautyPer+fatesPer+cardPer+minggePer)*(inheritPer+fetterPer+starTalentPer+breakLVPer+awakeTalentPer)*(1+dingjungePer)+heroSelfValue+heroLVValue; |
| | | |
| | | //保留2位小数 |
| | | value = Math.Round(value, 2); |
| | | |
| | | #if UNITY_EDITOR |
| | | //排除值为0的属性输出 |
| | | var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value); |
| | | if (!tmpPropertyVariables.IsNullOrEmpty()) |
| | | { |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 属性ID {attrType} 值 {value} - {JsonMapper.ToJson(tmpPropertyVariables)}"); |
| | | } |
| | | // var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value); |
| | | // if (!tmpPropertyVariables.IsNullOrEmpty()) |
| | | // { |
| | | // FightPowerDebug($"战力:武将ID {hero.heroId} 属性ID {attrType} 值 {value} - {JsonMapper.ToJson(tmpPropertyVariables)}"); |
| | | // } |
| | | #endif |
| | | return value; |
| | | } |
| | | |
| | | |
| | | public double GetFighttPropertyVaule(int attrType, HeroInfo hero) |
| | | { |
| | | lvAttrs.TryGetValue(attrType, out var lvValue); |
| | | equipAttrs.TryGetValue(attrType, out var equipValue); |
| | | officialAttrs.TryGetValue(attrType, out var realmValue); |
| | | var gubaoValue = GubaoManager.Instance.GetAttrValue(attrType); |
| | | var hjgValue = PhantasmPavilionManager.Instance.GetAttrValue(attrType); |
| | | var horseValue = HorseManager.Instance.GetAttrValue(attrType); |
| | | var beautyValue = BeautyMMManager.Instance.GetAttrValue(attrType); |
| | | var fatesValue = HeroFatesManager.Instance.GetAttrValue(attrType); |
| | | var dingjungeValue = 0; //默认不需要加,爬塔特殊用,配合公式 |
| | | minggeAttrs.TryGetValue(attrType, out var minggeValue); |
| | | |
| | | //阵容光环 三围百分比加成 |
| | | countryAttrs.TryGetValue(attrType, out var lineupHaloValue); |
| | | |
| | | //武将属性 |
| | | var heroSelfValue = hero.GetSelfAddValue(attrType); |
| | | var starTalentValue = hero.GetTalentAttrValue(attrType); |
| | | var breakLVValue = hero.GetBreakAttrValue(attrType); |
| | | var awakeTalentValue = hero.GetAwakeAttrValue(attrType); |
| | | var fetterValue = hero.GetFetterAttrValue(attrType); |
| | | |
| | | double value = (lvValue + equipValue + realmValue + gubaoValue + hjgValue + horseValue + beautyValue + fatesValue + dingjungeValue + minggeValue) + (heroSelfValue + lineupHaloValue + starTalentValue + breakLVValue + awakeTalentValue) + fetterValue; |
| | | |
| | | //保留2位小数 |
| | | value = Math.Round(value, 2); |
| | | |
| | | #if UNITY_EDITOR |
| | | //排除值为0的属性输出 |
| | | // var tmpPropertyVariables = propertyVariables.Where(x => x.Value > 0).ToDictionary(x => x.Key, x => x.Value); |
| | | // if (!tmpPropertyVariables.IsNullOrEmpty()) |
| | | // { |
| | | // FightPowerDebug($"战力:武将ID {hero.heroId} 属性ID {attrType} 值 {value} - {JsonMapper.ToJson(tmpPropertyVariables)}"); |
| | | // } |
| | | #endif |
| | | return value; |
| | | } |
| | | |
| | | // int GetLineUpPer(int attrType, string key) |
| | | // { |
| | |
| | | // } |
| | | |
| | | |
| | | //PlayerPropertyConfig.baseAttr2perDict 频繁调用字典效率差 |
| | | int GetCountryPer(int attrType) |
| | | { |
| | | if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType)) |
| | | if (attrType == 6 || attrType == 7 || attrType == 8) |
| | | { |
| | | var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType]; |
| | | return countryAttrs.ContainsKey(pertype) ? countryAttrs[pertype] : 0; |
| | | var pertype = attrType + 10; |
| | | countryAttrs.TryGetValue(pertype, out var value); |
| | | return value; |
| | | } |
| | | |
| | | return 0; |
| | |
| | | //装备战力为最终总战力的结果比(提升整个角色总战力) |
| | | |
| | | //计算总战力中的武将战力,几个武将加起来就是总战力,其他功能属性计算应该涵盖在英雄里 |
| | | public long CalculatePower() |
| | | // calcType 计算战力缘由 0 武将 1 装备 2命格,用于节省部分开销 |
| | | public long CalculatePower(int calcType) |
| | | { |
| | | |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug("战力:开始计算"); |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("战力:开始计算"); |
| | | } |
| | | #endif |
| | | // --- 先计算所有功能的汇总属性 --- |
| | | RefreshLVAttrs(); |
| | | RefreshOfficialAttrs(); |
| | | RefrehEquipAttrs(); |
| | | RefrehMinggeAttrs(); |
| | | RefreshTeamAttrs(); |
| | | |
| | | bool diffFP = lastFightPower != PlayerDatas.Instance.baseData.FightPower; //战力是否有变化 |
| | | if (diffFP || calcType == 0) |
| | | { |
| | | lastFightPower = PlayerDatas.Instance.baseData.FightPower; |
| | | RefreshTeamAttrs(); |
| | | } |
| | | |
| | | // --- 算单武将功能属性战力 后相加--- |
| | | long fightPower = 0; |
| | |
| | | |
| | | } |
| | | |
| | | fightPower += GetMinggeSkillPower(); |
| | | // #if UNITY_EDITOR |
| | | FightPowerDebug("战力:计算完毕 " + fightPower); |
| | | // #endif |
| | | if (diffFP || calcType == 2) |
| | | { |
| | | lastMinggeSkillPower = GetMinggeSkillPower(); |
| | | } |
| | | |
| | | fightPower += lastMinggeSkillPower; |
| | | #if UNITY_EDITOR |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug("命格技能战力 " + lastMinggeSkillPower); |
| | | FightPowerDebug("战力:计算完毕 " + fightPower); |
| | | } |
| | | #endif |
| | | return fightPower; |
| | | } |
| | | |
| | |
| | | //计算阵容中武将战力 |
| | | public long CalculateTeamHeroPower(HeroInfo hero) |
| | | { |
| | | |
| | | fightPowerVariables.Clear(); |
| | | hero.RefreshFetterAttrsWhenCalcPower(teamTypeCalc); //羁绊属性要实时算 |
| | | |
| | | var Atk = GetPropertyVaule(6, hero); |
| | | var Def = GetPropertyVaule(7, hero); |
| | | var MaxHP = GetPropertyVaule(8, hero); |
| | | var AtkSpeed = GetFighttPropertyVaule(11, hero); |
| | | var StunRate = GetFighttPropertyVaule(21, hero); |
| | | var StunRateDef = GetFighttPropertyVaule(22, hero); |
| | | var SuperHitRate = GetFighttPropertyVaule(23, hero); |
| | | var SuperHitRateDef = GetFighttPropertyVaule(24, hero); |
| | | var ComboRate = GetFighttPropertyVaule(25, hero); |
| | | var ComboRateDef = GetFighttPropertyVaule(26, hero); |
| | | var MissRate = GetFighttPropertyVaule(27, hero); |
| | | var MissRateDef = GetFighttPropertyVaule(28, hero); |
| | | var ParryRate = GetFighttPropertyVaule(29, hero); |
| | | var ParryRateDef = GetFighttPropertyVaule(30, hero); |
| | | var SuckHPPer = GetFighttPropertyVaule(31, hero); |
| | | var SuckHPPerDef = GetFighttPropertyVaule(32, hero); |
| | | |
| | | foreach (var config in pConfig) |
| | | { |
| | | if (config.showType < 1 || config.showType > 4) |
| | | { |
| | | continue; |
| | | } |
| | | var FinalDamPer = GetFighttPropertyVaule(35, hero); |
| | | var FinalDamPerDef = GetFighttPropertyVaule(36, hero); |
| | | var PhyDamPer = GetFighttPropertyVaule(37, hero); |
| | | var PhyDamPerDef = GetFighttPropertyVaule(38, hero); |
| | | var MagDamPer = GetFighttPropertyVaule(39, hero); |
| | | var MagDamPerDef = GetFighttPropertyVaule(40, hero); |
| | | var NormalSkillPer = GetFighttPropertyVaule(41, hero); |
| | | var NormalSkillPerDef = GetFighttPropertyVaule(42, hero); |
| | | var AngerSkillPer = GetFighttPropertyVaule(43, hero); |
| | | var AngerSkillPerDef = GetFighttPropertyVaule(44, hero); |
| | | var SuperDamPer = GetFighttPropertyVaule(45, hero); |
| | | var SuperDamPerDef = GetFighttPropertyVaule(46, hero); |
| | | |
| | | //约定死 只有3维才是基础属性 |
| | | if (config.showType == 1 && config.ID != 11) |
| | | { |
| | | fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, 0), 3); |
| | | } |
| | | else |
| | | { |
| | | fightPowerVariables[config.Parameter] = Math.Round(GetPropertyVaule(config.ID, hero, 1), 3); |
| | | } |
| | | } |
| | | |
| | | var CurePer = GetFighttPropertyVaule(51, hero); |
| | | var CurePerDef = GetFighttPropertyVaule(52, hero); |
| | | var ShieldPer = GetFighttPropertyVaule(53, hero); |
| | | var ShieldPerDef = GetFighttPropertyVaule(54, hero); |
| | | var DOTPer = GetFighttPropertyVaule(55, hero); |
| | | var DOTPerDef = GetFighttPropertyVaule(56, hero); |
| | | var WeiFinalDamPer = GetFighttPropertyVaule(57, hero); |
| | | var WeiFinalDamPerDef = GetFighttPropertyVaule(58, hero); |
| | | var ShuFinalDamPer = GetFighttPropertyVaule(59, hero); |
| | | var ShuFinalDamPerDef = GetFighttPropertyVaule(60, hero); |
| | | var WuFinalDamPer = GetFighttPropertyVaule(61, hero); |
| | | var WuFinalDamPerDef = GetFighttPropertyVaule(62, hero); |
| | | var QunFinalDamPer = GetFighttPropertyVaule(63, hero); |
| | | var QunFinalDamPerDef = GetFighttPropertyVaule(64, hero); |
| | | |
| | | var PVPDamPer = GetFighttPropertyVaule(71, hero); |
| | | var PVPDamPerDef = GetFighttPropertyVaule(72, hero); |
| | | var Guanchuan = GetFighttPropertyVaule(77, hero); |
| | | var GuanchuanDef = GetFighttPropertyVaule(78, hero); |
| | | var Zhaojia = GetFighttPropertyVaule(79, hero); |
| | | var ZhaojiaDef = GetFighttPropertyVaule(80, hero); |
| | | |
| | | |
| | | //属性系数根据官职等级的加成 |
| | | var fightPowerRatioConfig = FightPowerRatioConfig.Get(PlayerDatas.Instance.baseData.realmLevel); |
| | | var AtkSpeedRatio = fightPowerRatioConfig.AtkSpeedRatio; |
| | | var AtkRatio = fightPowerRatioConfig.AtkRatio; |
| | | var DefRatio = fightPowerRatioConfig.DefRatio; |
| | | var MaxHPRatio = fightPowerRatioConfig.MaxHPRatio; |
| | | var StunRateRatio = fightPowerRatioConfig.StunRateRatio; |
| | | var SuperHitRateRatio = fightPowerRatioConfig.SuperHitRateRatio; |
| | | var ComboRateRatio = fightPowerRatioConfig.ComboRateRatio; |
| | | var MissRateRatio = fightPowerRatioConfig.MissRateRatio; |
| | | var ParryRateRatio = fightPowerRatioConfig.ParryRateRatio; |
| | | var SuckHPPerRatio = fightPowerRatioConfig.SuckHPPerRatio; |
| | | var StunRateDefRatio = fightPowerRatioConfig.StunRateDefRatio; |
| | | var SuperHitRateDefRatio = fightPowerRatioConfig.SuperHitRateDefRatio; |
| | | var ComboRateDefRatio = fightPowerRatioConfig.ComboRateDefRatio; |
| | | var MissRateDefRatio = fightPowerRatioConfig.MissRateDefRatio; |
| | | var ParryRateDefRatio = fightPowerRatioConfig.ParryRateDefRatio; |
| | | var SuckHPPerDefRatio = fightPowerRatioConfig.SuckHPPerDefRatio; |
| | | var NormalSkillPerRatio = fightPowerRatioConfig.NormalSkillPerRatio; |
| | | var NormalSkillPerDefRatio = fightPowerRatioConfig.NormalSkillPerDefRatio; |
| | | var AngerSkillPerRatio = fightPowerRatioConfig.AngerSkillPerRatio; |
| | | var AngerSkillPerDefRatio = fightPowerRatioConfig.AngerSkillPerDefRatio; |
| | | var SuperDamPerRatio = fightPowerRatioConfig.SuperDamPerRatio; |
| | | var SuperDamPerDefRatio = fightPowerRatioConfig.SuperDamPerDefRatio; |
| | | var ShieldPerRatio = fightPowerRatioConfig.ShieldPerRatio; |
| | | var ShieldPerDefRatio = fightPowerRatioConfig.ShieldPerDefRatio; |
| | | var DOTPerRatio = fightPowerRatioConfig.DOTPerRatio; |
| | | var DOTPerDefRatio = fightPowerRatioConfig.DOTPerDefRatio; |
| | | var WeiFinalDamPerRatio = fightPowerRatioConfig.WeiFinalDamPerRatio; |
| | | var WeiFinalDamPerDefRatio = fightPowerRatioConfig.WeiFinalDamPerDefRatio; |
| | | var ShuFinalDamPerRatio = fightPowerRatioConfig.ShuFinalDamPerRatio; |
| | | var ShuFinalDamPerDefRatio = fightPowerRatioConfig.ShuFinalDamPerDefRatio; |
| | | var WuFinalDamPerRatio = fightPowerRatioConfig.WuFinalDamPerRatio; |
| | | var WuFinalDamPerDefRatio = fightPowerRatioConfig.WuFinalDamPerDefRatio; |
| | | var QunFinalDamPerRatio = fightPowerRatioConfig.QunFinalDamPerRatio; |
| | | var QunFinalDamPerDefRatio = fightPowerRatioConfig.QunFinalDamPerDefRatio; |
| | | var FinalDamPerRatio = fightPowerRatioConfig.FinalDamPerRatio; |
| | | var FinalDamPerDefRatio = fightPowerRatioConfig.FinalDamPerDefRatio; |
| | | var PhyDamPerRatio = fightPowerRatioConfig.PhyDamPerRatio; |
| | | var PhyDamPerDefRatio = fightPowerRatioConfig.PhyDamPerDefRatio; |
| | | var MagDamPerRatio = fightPowerRatioConfig.MagDamPerRatio; |
| | | var MagDamPerDefRatio = fightPowerRatioConfig.MagDamPerDefRatio; |
| | | var CurePerRatio = fightPowerRatioConfig.CurePerRatio; |
| | | var CurePerDefRatio = fightPowerRatioConfig.CurePerDefRatio; |
| | | var PVPDamPerRatio = fightPowerRatioConfig.PVPDamPerRatio; |
| | | var PVPDamPerDefRatio = fightPowerRatioConfig.PVPDamPerDefRatio; |
| | | var GuanchuanRatio = fightPowerRatioConfig.GuanchuanRatio; |
| | | var GuanchuanDefRatio = fightPowerRatioConfig.GuanchuanDefRatio; |
| | | var ZhaojiaRatio = fightPowerRatioConfig.ZhaojiaRatio; |
| | | var ZhaojiaDefRatio = fightPowerRatioConfig.ZhaojiaDefRatio; |
| | | |
| | | 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; |
| | | fightPowerVariables[GUANCHUAN_RATIO] = fightPowerRatioConfig.GuanchuanRatio; |
| | | fightPowerVariables[GUANCHUAN_DEF_RATIO] = fightPowerRatioConfig.GuanchuanDefRatio; |
| | | fightPowerVariables[ZHAOJIA_RATIO] = fightPowerRatioConfig.ZhaojiaRatio; |
| | | fightPowerVariables[ZHAOJIA_DEF_RATIO] = fightPowerRatioConfig.ZhaojiaDefRatio; |
| | | fightPowerVariables[ATKSPEEDRATIO_VALUE] = fightPowerRatioConfig.AtkSpeedRatio; |
| | | |
| | | |
| | | 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()) |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 属性战力 {fightPower} 属性战力参数 {JsonMapper.ToJson(tmpFightPowerVariables)}"); |
| | | #endif |
| | | long fightPower = (long)(Atk*AtkRatio+MaxHP*MaxHPRatio+Def*DefRatio+AtkSpeed*AtkSpeedRatio+(StunRate*StunRateRatio+SuperHitRate*SuperHitRateRatio+ComboRate*ComboRateRatio+MissRate*MissRateRatio+ParryRate*ParryRateRatio+SuckHPPer*SuckHPPerRatio+StunRateDef*StunRateDefRatio+SuperHitRateDef*SuperHitRateDefRatio+ComboRateDef*ComboRateDefRatio+MissRateDef*MissRateDefRatio+ParryRateDef*ParryRateDefRatio+SuckHPPerDef*SuckHPPerDefRatio+FinalDamPer*FinalDamPerRatio+FinalDamPerDef*FinalDamPerDefRatio+PhyDamPer*PhyDamPerRatio+PhyDamPerDef*PhyDamPerDefRatio+MagDamPer*MagDamPerRatio+MagDamPerDef*MagDamPerDefRatio+NormalSkillPer*NormalSkillPerRatio+NormalSkillPerDef*NormalSkillPerDefRatio+AngerSkillPer*AngerSkillPerRatio+AngerSkillPerDef*AngerSkillPerDefRatio+SuperDamPer*SuperDamPerRatio+SuperDamPerDef*SuperDamPerDefRatio+CurePer*CurePerRatio+CurePerDef*CurePerDefRatio+ShieldPer*ShieldPerRatio+ShieldPerDef*ShieldPerDefRatio+DOTPer*DOTPerRatio+DOTPerDef*DOTPerDefRatio+WeiFinalDamPer*WeiFinalDamPerRatio+WeiFinalDamPerDef*WeiFinalDamPerDefRatio+ShuFinalDamPer*ShuFinalDamPerRatio+ShuFinalDamPerDef*ShuFinalDamPerDefRatio+WuFinalDamPer*WuFinalDamPerRatio+WuFinalDamPerDef*WuFinalDamPerDefRatio+QunFinalDamPer*QunFinalDamPerRatio+QunFinalDamPerDef*QunFinalDamPerDefRatio+PVPDamPer*PVPDamPerRatio+PVPDamPerDef*PVPDamPerDefRatio+Guanchuan*GuanchuanRatio+GuanchuanDef*GuanchuanDefRatio+Zhaojia*ZhaojiaRatio+ZhaojiaDef*ZhaojiaDefRatio)/100.0-55000); |
| | | |
| | | // #if UNITY_EDITOR |
| | | // //排除值为0的属性输出 |
| | | // 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 |
| | | |
| | | //加上技能战力 |
| | | fightPowerVariables.Clear(); |
| | | fightPowerVariables[PLAYER_LV] = PlayerDatas.Instance.baseData.LV; |
| | | fightPowerVariables[OFFICIAL_LV] = PlayerDatas.Instance.baseData.realmLevel; |
| | | fightPowerVariables[SKILL_POWER] = hero.GetSkillsFightPower(); |
| | | |
| | | long skillPower = (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables); |
| | | var SkillPower = hero.GetSkillsFightPower(); |
| | | var OfficialLV = PlayerDatas.Instance.baseData.realmLevel; |
| | | |
| | | long skillPower = SkillPower*OfficialLV;; |
| | | |
| | | #if UNITY_EDITOR |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 技能战力 {skillPower} 技能参数 {JsonMapper.ToJson(fightPowerVariables)}"); |
| | | |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug($"战力:武将ID {hero.heroId} 总战力 {fightPower + skillPower}"); |
| | | } |
| | | |
| | | #endif |
| | | |
| | | return fightPower + skillPower; |
| | | return fightPower + skillPower; |
| | | } |
| | | |
| | | //命格技能战力:按个数获取对应等级的技能战力 |
| | |
| | | |
| | | foreach (var item in dict) |
| | | { |
| | | // //加上技能战力 |
| | | fightPowerVariables.Clear(); |
| | | fightPowerVariables[PLAYER_LV] = PlayerDatas.Instance.baseData.LV; |
| | | fightPowerVariables[OFFICIAL_LV] = PlayerDatas.Instance.baseData.realmLevel; |
| | | if (item.Value == 0) |
| | | { |
| | | continue; |
| | |
| | | Debug.LogError("skill is null" + (item.Key + item.Value - 1)); |
| | | continue; |
| | | } |
| | | fightPowerVariables[SKILL_POWER] = skill.FightPower; |
| | | skillPower += (long)FightPowerFormula.GetSkillsFightPower(fightPowerVariables); |
| | | var SkillPower = skill.FightPower; |
| | | var OfficialLV = PlayerDatas.Instance.baseData.realmLevel; |
| | | skillPower += SkillPower*OfficialLV;; |
| | | } |
| | | |
| | | |
| | | #if UNITY_EDITOR |
| | | if (openLog) |
| | | { |
| | | FightPowerDebug($"命格技能战力 {skillPower}"); |
| | | } |
| | | #endif |
| | | return skillPower; |
| | | } |
| | |
| | | public long GetFightPowerChange(ItemModel item) |
| | | { |
| | | InitFightPowerParam(); |
| | | var fightPower = CalculatePower(); |
| | | var fightPower = CalculatePower(1); |
| | | |
| | | InitFightPowerParam(dropindex: item.gridIndex); |
| | | var tmpFightPower = CalculatePower(); |
| | | return tmpFightPower - fightPower; |
| | | var tmpFightPower = CalculatePower(1); |
| | | EquipRecordManager.Instance.showFightPower = tmpFightPower - fightPower; |
| | | // 同时记录装备日志战力 |
| | | return EquipRecordManager.Instance.showFightPower; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public long GetFightPowerMinggeChange(ItemModel item, int minggePresetID) |
| | | { |
| | | InitFightPowerParam(_minggePresetID: minggePresetID); |
| | | var fightPower = CalculatePower(); |
| | | var fightPower = CalculatePower(2); |
| | | |
| | | InitFightPowerParam(_minggePresetID: minggePresetID, _minggeDropIndex: item.gridIndex); |
| | | var tmpFightPower = CalculatePower(); |
| | | var tmpFightPower = CalculatePower(2); |
| | | return tmpFightPower - fightPower; |
| | | } |
| | | |
| | |
| | | public long GetTeamFightPower(int team, bool isPreview) |
| | | { |
| | | InitFightPowerParam(team, ispreview:isPreview); |
| | | return CalculatePower(); |
| | | return CalculatePower(0); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | Dictionary<int, long> tmpAttrs = new Dictionary<int, long>(); |
| | | hero.RefreshFetterAttrsWhenCalcPower(TeamManager.Instance.GetMainTeamID()); //羁绊属性要实时算 |
| | | |
| | | var pConfig = PlayerPropertyConfig.GetValues(); |
| | | foreach (var config in pConfig) |
| | | { |
| | | if (config.showType < 1 || config.showType > 4) |
| | |
| | | //约定死 只有3维才是基础属性 |
| | | if (config.showType == 1 && config.ID != 11) |
| | | { |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, 0); |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero); |
| | | } |
| | | else |
| | | { |
| | | tmpAttrs[config.ID] = (long)GetPropertyVaule(config.ID, hero, 1); |
| | | tmpAttrs[config.ID] = (long)GetFighttPropertyVaule(config.ID, hero); |
| | | } |
| | | } |
| | | |