private Dictionary <Attr, float> ComputerAttr() { plusDic.Clear(); mulDic.Clear(); //只为调整显示顺序 Dictionary <Attr, float> ret = new Dictionary <Attr, float> { { Attr.Power, 0 }, { Attr.Strategy, 0 }, { Attr.LeadPower, 0 }, { Attr.MaxHp, 0 }, { Attr.Asp, 0 }, { Attr.Atk, 0 }, { Attr.DefBreak, 0 }, { Attr.Matk, 0 }, { Attr.MdefBreak, 0 }, { Attr.Def, 0 }, { Attr.DefRate, 0 }, { Attr.MDef, 0 }, { Attr.MdefRate, 0 }, { Attr.DodgeRate, 0 }, { Attr.HitRate, 0 }, { Attr.BlockRate, 0 }, { Attr.RoutRate, 0 }, { Attr.CritRate, 0 }, { Attr.CritInc, 0 }, { Attr.FirmRate, 0 }, { Attr.HealRate, 0 }, { Attr.HpRec, 0 }, { Attr.VigourRec, 0 }, { Attr.HpSuck, 0 }, { Attr.VigourSuck, 0 } }; List <Pro> ep = EquipAttr(); Dictionary <Attr, float> oa = OfficerAttr(); Dictionary <Attr, float> ha = HeroAttr(); Dictionary <Attr, float> ra = RareAttr(false); int power = 0; int strategy = 0; int leadPower = 0; //计算武力 if (ha.ContainsKey(Attr.Power)) { power += (int)ha[Attr.Power]; } if (ra.ContainsKey(Attr.Power)) { power += (int)ra[Attr.Power]; } if (oa.ContainsKey(Attr.Power)) { power += (int)oa[Attr.Power]; } //计算策略 if (ha.ContainsKey(Attr.Strategy)) { strategy += (int)ha[Attr.Strategy]; } if (ra.ContainsKey(Attr.Strategy)) { strategy += (int)ra[Attr.Strategy]; } if (oa.ContainsKey(Attr.Strategy)) { strategy += (int)oa[Attr.Strategy]; } //计算统率 if (ha.ContainsKey(Attr.LeadPower)) { leadPower += (int)ha[Attr.LeadPower]; } if (ra.ContainsKey(Attr.Strategy)) { leadPower += (int)ra[Attr.LeadPower]; } if (oa.ContainsKey(Attr.LeadPower)) { leadPower += (int)oa[Attr.LeadPower]; } for (int i = 0; i < ep.Count; ++i) { if (ep[i].attr == Attr.Power) { power += (int)ep[i].num; power = Mathf.RoundToInt(power * (1f + ep[i].per)); } else if (ep[i].attr == Attr.Strategy) { strategy += (int)ep[i].num; strategy = Mathf.RoundToInt(strategy * (1f + ep[i].per)); } else if (ep[i].attr == Attr.LeadPower) { leadPower += (int)ep[i].num; leadPower = Mathf.RoundToInt(leadPower * (1f + ep[i].per)); } else { if (plusDic.ContainsKey(ep[i].attr)) { plusDic[ep[i].attr] += ep[i].num; } else { plusDic.Add(ep[i].attr, ep[i].num); } if (mulDic.ContainsKey(ep[i].attr)) { mulDic[ep[i].attr] += ep[i].per; } else { mulDic.Add(ep[i].attr, ep[i].per); } } } List <Pro> tp = TotemAttr(); for (int i = 0; i < tp.Count; ++i) { if (plusDic.ContainsKey(tp[i].attr)) { plusDic[tp[i].attr] += tp[i].num; } else { plusDic.Add(tp[i].attr, tp[i].num); } if (mulDic.ContainsKey(tp[i].attr)) { mulDic[tp[i].attr] += tp[i].per; } else { mulDic.Add(tp[i].attr, tp[i].per); } } float Def = AttrUtil.CalDef((int)power, Level, StarGrow.stardef[Star - 1]); float MdefRate = AttrUtil.CalMdef((int)strategy, Level, StarGrow.starmdef[Star - 1]); int maxHp = AttrUtil.CalMaxHp((int)leadPower, Level, StarGrow.starhp[Star - 1]); //最大生命值 float atk = AttrUtil.CalAtk((int)power, Level, StarGrow.staratk[Star - 1]); //物理攻击力 float matk = AttrUtil.CalMatk((int)strategy, Level, StarGrow.starmatk[Star - 1]); //策略攻击力 float mdefRatr = AttrUtil.CalMdefRate(MdefRate, Level); float defRate = AttrUtil.CalDefRate(Def, Level); //物理抗性 float dodgeRate = AttrUtil.CalDodgeRate((int)leadPower, Level), //闪避率 blockRate = AttrUtil.CalBlockRate((int)leadPower, Level), //格挡率 firmRate = AttrUtil.CalFirmRate((int)leadPower, Level), //韧性率 hitRate = AttrUtil.CalHitRate((int)leadPower, Level), //命中率 routRate = AttrUtil.CalRoutRate((int)leadPower, Level), //破击率 critRate = AttrUtil.CalCritRate((int)leadPower, Level); //暴击率 foreach (var item in ha) { if (ret.ContainsKey(item.Key)) { ret[item.Key] += item.Value; } else { ret.Add(item.Key, item.Value); } } foreach (var item in ra) { if (ret.ContainsKey(item.Key)) { ret[item.Key] += item.Value; } else { ret.Add(item.Key, item.Value); } } foreach (var item in oa) { if (ret.ContainsKey(item.Key)) { ret[item.Key] += item.Value; } else { ret.Add(item.Key, item.Value); } } foreach (var item in plusDic) { if (ret.ContainsKey(item.Key)) { ret[item.Key] += item.Value; } else { ret.Add(item.Key, item.Value); } } foreach (var item in mulDic) { if (ret.ContainsKey(item.Key)) { ret[item.Key] = ret[item.Key] * (1 + item.Value); } } //增加最大生命值 if (ret.ContainsKey(Attr.MaxHp)) { ret[Attr.MaxHp] += maxHp; } //物理攻击计算 if (ret.ContainsKey(Attr.Atk)) { ret[Attr.Atk] += atk; } //策略攻击 if (ret.ContainsKey(Attr.Matk)) { ret[Attr.Matk] += matk; } //物理抗性 if (ret.ContainsKey(Attr.DefRate)) { ret[Attr.DefRate] += defRate; } //策略抗性 if (ret.ContainsKey(Attr.MdefRate)) { ret[Attr.MdefRate] += mdefRatr; } //闪避率 if (ret.ContainsKey(Attr.DodgeRate)) { ret[Attr.DodgeRate] += dodgeRate; } //格挡率 if (ret.ContainsKey(Attr.BlockRate)) { ret[Attr.BlockRate] += blockRate; } //韧性率 if (ret.ContainsKey(Attr.FirmRate)) { ret[Attr.FirmRate] += firmRate; } //命中率 if (ret.ContainsKey(Attr.HitRate)) { ret[Attr.HitRate] += hitRate; } //破击率 if (ret.ContainsKey(Attr.RoutRate)) { ret[Attr.RoutRate] += routRate; } //暴击率 if (ret.ContainsKey(Attr.CritRate)) { ret[Attr.CritRate] += critRate; } if (ret.ContainsKey(Attr.AspRate)) { ret[Attr.Asp] *= (1 + ret[Attr.AspRate]); } return(ret); }