123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- 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 int modelID;
- public EncryptionLong hp = new EncryptionLong();
- public EncryptionLong defense = new EncryptionLong();
- public EncryptionLong attack = new EncryptionLong();
- /// <summary>
- /// 闪避 evasion
- /// </summary>
- public EncryptionInt shanbi = new EncryptionInt();
-
- /// <summary>
- /// 经验产出
- /// </summary>
- public EncryptionLong expGain = new EncryptionLong();
-
- public EncryptionFloat attSpeed = new EncryptionFloat();
- public EncryptionFloat crit =new EncryptionFloat();
- public EncryptionFloat critDamage =new EncryptionFloat();
- // public EncryptionFloat dodge = new EncryptionFloat();
- public EncryptionInt level;
- public EncryptionInt 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 CalBasicAttribute()
- {
- 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 * factor);
- expGain = (EncryptionLong)(modelConfig.expGain * powerUpConfig.EXPFactor * factor);
- }
-
- protected void CalAttribute()
- {
- CalBasicAttribute();
- 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;
- heroType = modelConfig.heroType;
- }
- protected void SetDataConfig(int modelID,int level, int star)
- {
- modelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(modelID);
- powerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
- promoteConfig = ConfigComponent.Instance.Get<HeroPromoteConfig>(star);
- this.level = (EncryptionInt)level;
- this.star = (EncryptionInt)star;
- }
-
- public void InitMonster(int modelID,int level, int star = 1)
- {
- SetDataConfig(modelID, 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;
- }
- }
|