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();
///
/// 闪避 evasion
///
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;
///
/// 1=英雄 2=小怪 3=精英怪 4=boss
///
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(heroData.heroModelId);
// promoteConfig = ConfigComponent.Instance.Get(heroData.heroPromoteId);
// powerConfig = ConfigComponent.Instance.Get(heroData.heroPowerId);
// star = promoteConfig.starGrade;
// lv = powerConfig.heroLevel;
// }
private float rarityFactor;
private float starFactor;
private float factor;
///
/// 计算影响基础属性的参数
/// (稀有度、星级)
///
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(id);
powerUpConfig = ConfigComponent.Instance.Get(level);
promoteConfig = ConfigComponent.Instance.Get(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(id);
HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get(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;
}
}