|   | 
|   | 
| //武将突破:武将升级后需要突破才能继续升级,突破可获得潜能 | 
| using System.Collections.Generic; | 
|   | 
| public partial class HeroInfo | 
| { | 
|     //  突破配置 | 
|     public HeroBreakConfig breakConfig { get; private set;} | 
|   | 
|     //  品质突破配置 | 
|     public HeroQualityBreakConfig qualityBreakConfig { get; private set;} | 
|   | 
|     //  武将突破等级 | 
|     public int breakLevel | 
|     { | 
|         get | 
|         { | 
|             if (itemHero == null) | 
|                 return 0; | 
|             return itemHero.GetUseDataFirstValue(74); | 
|         } | 
|     } | 
|   | 
|     Dictionary<int, int> breakAttrs = new Dictionary<int, int>();   //潜能属性id:潜能值 | 
|     //计算潜能属性 | 
|     public void RefreshBreakAttr() | 
|     { | 
|         breakAttrs.Clear(); | 
|         for (int i = 0; i < breakLevel; i++) | 
|         { | 
|             var tmpBreakConfig = HeroBreakConfig.GetHeroBreakConfig(heroId, i); | 
|             if (tmpBreakConfig == null) | 
|                 continue; | 
|             for(int j = 0; j < tmpBreakConfig.AttrIDList.Length; j++) | 
|             { | 
|                 int id = tmpBreakConfig.AttrIDList[j]; | 
|                 if (!breakAttrs.ContainsKey(id)) | 
|                 { | 
|                     breakAttrs.Add(id, tmpBreakConfig.AttrValueList[j]); | 
|                 } | 
|                 else | 
|                 { | 
|                     breakAttrs[id] += tmpBreakConfig.AttrValueList[j]; | 
|                 } | 
|             } | 
|   | 
|             if (tmpBreakConfig.SkillID != 0) | 
|             { | 
|                 var skillConfig = SkillConfig.Get(tmpBreakConfig.SkillID); | 
|                 if (skillConfig == null) continue; | 
|                 if (allSkillTypeIDToID.ContainsKey(skillConfig.SkillTypeID)) | 
|                 { | 
|                     var tmpSkillConfig = SkillConfig.Get(allSkillTypeIDToID[skillConfig.SkillTypeID]); | 
|                     if (skillConfig.SkillID > tmpSkillConfig.SkillID) | 
|                     { | 
|                         //取最大技能 | 
|                         allSkillTypeIDToID[skillConfig.SkillTypeID] = tmpBreakConfig.SkillID; | 
|                     } | 
|                 } | 
|                 else | 
|                 { | 
|                     allSkillTypeIDToID[skillConfig.SkillTypeID] = tmpBreakConfig.SkillID; | 
|                 } | 
|             } | 
|         } | 
|     } | 
|   | 
|     public int GetBreakAttrValue(int attrType) | 
|     { | 
|         int value = 0; | 
|         breakAttrs.TryGetValue(attrType, out value); | 
|         return value; | 
|     } | 
|   | 
|     public int GetBreakAttrPer(int attrType) | 
|     {  | 
|         if (PlayerPropertyConfig.baseAttr2perDict.ContainsKey(attrType)) | 
|         { | 
|             var pertype = PlayerPropertyConfig.baseAttr2perDict[attrType]; | 
|             return breakAttrs.ContainsKey(pertype) ? breakAttrs[pertype] : 0; | 
|         } | 
|         return 0; | 
|     } | 
| } |