123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- using System.Collections;
- using System.Collections.Generic;
- using Core.Utility;
- using Excel2Json;
- using Fort23.UTool;
- using UnityEngine;
- using UnityEngine.Serialization;
- [System.Serializable]
- public class CombatHeroInfo
- {
-
- public EncryptionLong hp = new EncryptionLong();
- public EncryptionLong defense = new EncryptionLong();
- public EncryptionLong attack = new EncryptionLong();
- /// <summary>
- /// 闪避 evasion
- /// </summary>
- public EncryptionInt shanbi = new EncryptionInt();
-
- public EncryptionFloat attSpeed = new EncryptionFloat();
- public EncryptionFloat crit =new EncryptionFloat();
- public EncryptionFloat critDamage =new EncryptionFloat();
- public EncryptionFloat dodge = new EncryptionFloat();
- public int level;
- public int star;
-
- public HeroModelConfig modelConfig;
- public HeroPowerUpConfig powerUpConfig;
- public HeroPromoteConfig promoteConfig;
- public HeroBasicEquipConfig basicEquipConfig;
-
- /// <summary>
- /// 1=英雄 2=小怪 3=精英怪 4=boss
- /// </summary>
- public int heroType;
- public string modelName;
- public float maxDis=2;
- public float maxDisTo=2*2;
- public int[] skillId;
- public bool isGpu;
- public CombatHeroInfo()
- {
-
- }
- // public CombatHeroInfo(AccountFileInfo.HeroData heroData)
- // {
- // modelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(heroData.heroModelId);
- // promoteConfig = ConfigComponent.Instance.Get<HeroPromoteConfig>(heroData.heroPromoteId);
- // powerConfig = ConfigComponent.Instance.Get<HeroPowerConfig>(heroData.heroPowerId);
- // star = promoteConfig.starGrade;
- // lv = powerConfig.heroLevel;
- // }
- private float rarityFactor;
- private float starFactor;
- private float factor;
-
- /// <summary>
- /// 计算影响基础属性的参数
- /// (稀有度、星级)
- /// </summary>
- protected void CalFactor()
- {
- rarityFactor = PlayerManager.Instance.gameConstantConfig.monsterRarityAttributeFactor[modelConfig.rarity-1]
- / 100f;
- starFactor = promoteConfig.star_Power / 100f;
- factor = rarityFactor * starFactor;
- }
- protected void CalAttribute()
- {
- hp = (EncryptionLong)(modelConfig.hp * powerUpConfig.HPFactor * factor);
- defense = (EncryptionLong)(modelConfig.def * powerUpConfig.DEFFactor * factor);
- attack = (EncryptionLong)(modelConfig.attack * powerUpConfig.ATKFactor * factor);
-
- shanbi = (EncryptionInt)(modelConfig.shanbi * powerUpConfig.SHANBIFactor);
- attSpeed = (EncryptionFloat)modelConfig.speed_atk;
- crit = (EncryptionFloat)modelConfig.crit;
- skillId = modelConfig.skillID;
- modelName = modelConfig.model;
- isGpu = modelConfig.isUseGpu;
- maxDis = modelConfig.range_atk;
- maxDisTo = maxDis * maxDis;
- }
- protected void SetDataConfig(int id,int level, int star)
- {
- modelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(id);
- powerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
- promoteConfig = ConfigComponent.Instance.Get<HeroPromoteConfig>(star);
- }
-
- public void InitMonster(int id,int level, int star)
- {
- SetDataConfig(id, level, star);
- CalFactor();
- CalAttribute();
- }
- public void InitMonster(int id,int level)
- {
- HeroModelConfig heroModelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(id);
- HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
- hp = (EncryptionLong)(heroModelConfig.hp*heroPowerUpConfig.HPFactor);
- defense=(EncryptionLong)(heroModelConfig.def*heroPowerUpConfig.DEFFactor);
- attack=(EncryptionLong)(heroModelConfig.attack*heroPowerUpConfig.ATKFactor);
- attSpeed=(EncryptionFloat)heroModelConfig.speed_atk;
- crit=(EncryptionFloat)heroModelConfig.crit;
- skillId = heroModelConfig.skillID;
- modelName = heroModelConfig.model;
- isGpu = heroModelConfig.isUseGpu;
- maxDis=heroModelConfig.range_atk;
- maxDisTo = maxDis * maxDis;
- }
- public CombatHeroInfo Copy()
- {
- CombatHeroInfo combatHeroInfo = (CombatHeroInfo)MemberwiseClone();
- return combatHeroInfo;
- }
- }
|