using System.Collections.Generic; using Common.Utility.CombatEvent; using Excel2Json; using Fort23.Core; using Fort23.UTool; using Utility; namespace GameLogic.Hero { public class HeroInfo : CombatHeroInfo { private string _iconZhiYe; private Map attributeBlValue = new Map(); public HeroInfo() { } public void InitHero(AccountFileInfo.HeroData heroData) { InitHero(heroData.heroModelId, heroData.heroPowerId); } public void InitHero(int modelID, int powerID) { this.modelID = modelID; SetDataConfig(modelID, powerID); ComputeHeroInfo(); } // public HeroInfo Upgrade() // { // level.Value++; // powerUpConfig = ConfigComponent.Instance.Get(level.Value); // // CalBasicAttribute(); // return this; // } public void ComputeHeroInfo() { attributeBlValue.Clear(); CalAttribute(); List myAllFaBao = PlayerManager.Instance.FaBaoControl.myAllFaBao; foreach (var faBaoInfo in myAllFaBao) { int star = faBaoInfo.star; for (int i = 0; i < star; i++) { if (faBaoInfo.FabaoConfig.StarupShuxingIDs.Length <= i) { break; } int shuxingID = faBaoInfo.FabaoConfig.StarupShuxingIDs[i]; int shuxingValue = faBaoInfo.FabaoConfig.StarupShuxingValues[i]; ComputeHeroAttributeType(shuxingID, shuxingValue); } } ///功法加被动属性 List allSkill = PlayerManager.Instance.GongFaControl.allSkill; foreach (var VARIABLE in attributeBlValue) { switch (VARIABLE.Key) { case HeroAttributeType.HP_BL: hp.Value += (long)(hp.Value * (VARIABLE.Value / 100f)); break; case HeroAttributeType.ATT_BL: attack.Value += (long)(attack.Value * (VARIABLE.Value / 100f)); break; case HeroAttributeType.DEF_BL: defense.Value += (long)(defense.Value * (VARIABLE.Value / 100f)); break; case HeroAttributeType.ShengShi_BL: shenshi.Value += (long)(shenshi.Value * (VARIABLE.Value / 100f)); break; } } } private void ComputeHeroAttributeType(int shuxingID, int value) { switch ((HeroAttributeType)shuxingID) { case HeroAttributeType.HP: hp.Value += value; break; case HeroAttributeType.ATT: attack.Value += value; break; case HeroAttributeType.DEF: defense.Value += value; break; case HeroAttributeType.Gold: Metal += value; break; case HeroAttributeType.Wood: Wood += value; break; case HeroAttributeType.Fire: Fire += value; break; case HeroAttributeType.Water: Water += value; break; case HeroAttributeType.Earth: Earth += value; break; case HeroAttributeType.Shields: Shield.Value += value; break; default: if (attributeBlValue.TryGetValue((HeroAttributeType)shuxingID, out var value1) ) { attributeBlValue[(HeroAttributeType)shuxingID] = value1 + value; } else { attributeBlValue.Add((HeroAttributeType)shuxingID, value); } break; } } } }