123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- using System.Collections;
- using System.Collections.Generic;
- using Core.Language;
- using Core.Utility;
- using Excel2Json;
- using Fort23.UTool;
- using GameLogic.Combat.CombatTool;
- using GameLogic.Hero;
- using GameLogic.Player;
- using UnityEngine;
- using UnityEngine.Serialization;
- using Utility;
- [System.Serializable]
- public class CombatHeroInfo
- {
- public enum AttributeType
- {
- Hp,
- Att,
- Def,
- }
- public int modelID;
- public EncryptionLong hp = new EncryptionLong();
- public EncryptionLong defense = new EncryptionLong();
- public EncryptionLong attack = new EncryptionLong();
- public EncryptionFloat attSpeed = (EncryptionFloat)2;
- public EncryptionInt level;
- public EncryptionFloat exp = new EncryptionFloat();
- public HeroModelConfig modelConfig;
- public HeroPowerUpConfig powerUpConfig;
- public MonsterPowerUpConfig MonsterPowerUpConfig;
- /// <summary>
- /// 功法强度的加成 %
- /// </summary>
- public float gongFaStrength;
- /// <summary>
- /// 护盾
- /// </summary>
- public EncryptionLong Shield;
- /// <summary>
- /// 神识
- /// </summary>
- public EncryptionLong shenshi;
- /// <summary>
- /// 添加的攻击速度比例%
- /// </summary>
- public float addAttSpeed_bl;
- /// <summary>
- /// 金
- /// </summary>
- public float Metal=100;
- /// <summary>
- /// 木
- /// </summary>
- public float Wood = 100;
- /// <summary>
- /// 水
- /// </summary>
- public float Water = 100;
- /// <summary>
- /// 火
- /// </summary>
- public float Fire = 100;
- /// <summary>
- /// 土
- /// </summary>
- public float Earth = 100;
- /// <summary>
- /// 金
- /// </summary>
- public float Metal_Injury;
- /// <summary>
- /// 木
- /// </summary>
- public float Wood_Injury;
- /// <summary>
- /// 水
- /// </summary>
- public float Water_Injury;
- /// <summary>
- /// 火
- /// </summary>
- public float Fire_Injury;
- /// <summary>
- /// 土
- /// </summary>
- public float Earth_Injury;
- /// <summary>
- /// 1=英雄 2=小怪 3=精英怪 4=boss
- /// </summary>
- public int heroType;
- public string modelName;
- public bool isMonster;
- public int k;
- // public int[] skillId;
- // public List<SkillConfig> skillConfigs;
- /// <summary>
- /// 所有已解锁技能的ID
- /// </summary>
- public List<SkillInfo> unLockSkills = new List<SkillInfo>();
- public bool isGpu;
- public string heroName;
- public List<FaBaoInfo> MagicWeaponID = new List<FaBaoInfo>();
- /// <summary>
- /// 大道修炼ID
- /// </summary>
- public int TaoismSkillId;
- public float GetAttSpeed
- {
- get
- {
- float speed = CombatCalculateTool.Instance.GetVlaueRatioForFloat(attSpeed.Value,
- addAttSpeed_bl + 100);
- if (speed < 0)
- {
- speed = 0;
- }
- return speed;
- }
- }
- public CombatHeroInfo()
- {
- }
- protected Map<AttributeType, int> _AttributeCacheValue = new Map<AttributeType, int>();
- public void AddAttributeValueToCache(AttributeType attributeType, int value)
- {
- if (_AttributeCacheValue.TryGetValue(attributeType, out int v))
- {
- value += v;
- }
- _AttributeCacheValue[attributeType] = value;
- }
- /// <summary>
- /// 获取五行灵根属性
- /// </summary>
- /// <param name="wuXingType"></param>
- /// <returns></returns>
- public float GetWuXingShuXing(WuXingType wuXingType)
- {
- switch (wuXingType)
- {
- case WuXingType.Gold:
- return Metal;
- break;
- case WuXingType.Wood:
- return Wood;
- break;
- case WuXingType.Water:
- return Water;
- break;
- case WuXingType.Fire:
- return Fire;
- break;
- case WuXingType.Earth:
- return Earth;
- break;
- default:
- return 0;
- }
- }
- protected void CalBasicAttribute()
- {
- _AttributeCacheValue.Clear();
- if (isMonster)
- {
- hp = (EncryptionLong)(modelConfig.hp * MonsterPowerUpConfig.HPFactor);
- defense = (EncryptionLong)(modelConfig.def * MonsterPowerUpConfig.DEFFactor);
- attack = (EncryptionLong)(modelConfig.attack * MonsterPowerUpConfig.ATKFactor);
- }
- else
- {
- hp = (EncryptionLong)(modelConfig.hp * powerUpConfig.HPFactor);
- defense = (EncryptionLong)(modelConfig.def * powerUpConfig.DEFFactor);
- attack = (EncryptionLong)(modelConfig.attack * powerUpConfig.ATKFactor);
- Shield = (EncryptionLong)(modelConfig.shield * powerUpConfig.HudunFactor);
- shenshi = (EncryptionLong)(modelConfig.shenshi * powerUpConfig.ShenshiFactor);
- k = powerUpConfig.defK;
- }
- for (_AttributeCacheValue.Begin(); _AttributeCacheValue.Next();)
- {
- switch (_AttributeCacheValue.Key)
- {
- case AttributeType.Hp:
- hp += CombatCalculateTool.Instance.GetVlaueRatioForLong(hp.Value, _AttributeCacheValue.Value);
- break;
- case AttributeType.Att:
- attack += CombatCalculateTool.Instance.GetVlaueRatioForLong(attack.Value,
- _AttributeCacheValue.Value);
- break;
- case AttributeType.Def:
- defense += CombatCalculateTool.Instance.GetVlaueRatioForLong(defense.Value,
- _AttributeCacheValue.Value);
- break;
- }
- }
- }
- public SkillConfig GetGroupSkillConfig(int idGroup)
- {
- if (unLockSkills == null)
- {
- return default;
- }
- for (int i = 0; i < unLockSkills.Count; i++)
- {
- // SkillConfig skillConfig = ConfigComponent.Instance.Get<SkillConfig>(unLockSkills[i]);
- if (unLockSkills[i].skillConfig.IDGroup == idGroup)
- {
- return unLockSkills[i].skillConfig;
- }
- }
- return default;
- }
- protected void CalAttribute()
- {
- CalBasicAttribute();
- attSpeed = (EncryptionFloat)modelConfig.speed_atk;
- // skillId = modelConfig.skillID;
- modelName = modelConfig.model;
- isGpu = modelConfig.isUseGpu;
- heroType = modelConfig.heroType;
- }
- protected void AddSkillAttribute(SkillConfig skillConfig)
- {
- if (skillConfig.addPropertyType == null)
- {
- return;
- }
- for (int i = 0; i < skillConfig.addPropertyType.Length; i++)
- {
- int propertyType = skillConfig.addPropertyType[i];
- int value = skillConfig.addPropertyValue[i];
- switch (propertyType)
- {
- case 1:
- AddAttributeValueToCache(AttributeType.Hp, value);
- break;
- case 2:
- AddAttributeValueToCache(AttributeType.Att, value);
- break;
- case 3:
- AddAttributeValueToCache(AttributeType.Def, value);
- break;
- }
- }
- }
- protected void SetDataConfig(int modelID, int level)
- {
- modelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(modelID);
- if (isMonster)
- {
- MonsterPowerUpConfig = ConfigComponent.Instance.Get<MonsterPowerUpConfig>(level);
- }
- else
- {
- powerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
- }
- this.level = (EncryptionInt)level;
- heroName = LanguageManager.Instance.Text(modelConfig.name);
- }
- public void InitMonster(int modelID, int level)
- {
- isMonster = true;
- SetDataConfig(modelID, level);
- CalAttribute();
- }
- public CombatHeroInfo Copy()
- {
- CombatHeroInfo combatHeroInfo = (CombatHeroInfo)MemberwiseClone();
- return combatHeroInfo;
- }
- }
|