| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 | 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    {        public AccountFileInfo.HeroData heroData;        private string _iconZhiYe;        private Map<HeroAttributeType, int> attributeBlValue = new Map<HeroAttributeType, int>();        public HeroInfo()        {        }        public void InitHero(AccountFileInfo.HeroData heroData)        {            this.heroData = heroData;            InitHero(heroData.heroModelId, heroData.heroPowerId);        }        public void InitHero(int modelID, int powerID)        {            this.modelID = modelID;            SetDataConfig(modelID,                powerID);            ComputeHeroInfo();            CalBasicAttribute();        }        public HeroInfo Upgrade()        {            int currentMiao = (int)((TimeHelper.ClientNow() - PlayerManager.Instance.myHero.heroData.upTime)/1000);            int allexp = currentMiao * PlayerManager.Instance.myHero.powerUpConfig.AutoXiuwei;            heroData.exp += allexp;            heroData.exp -= powerUpConfig.levelUpExp;            heroData.upTime = TimeHelper.ClientNow();            heroData.isCombat = false;            heroData.heroPowerId++;            InitHero(heroData);            PlayerManager.Instance.SaveHeroData(this);            return this;        }        public void ComputeHeroInfo()        {            attributeBlValue.Clear();            CalAttribute();            List<FaBaoInfo> 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<SkillInfo> 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;            }        }    }}
 |