CombatHeroInfo.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using Core.Utility;
  4. using Excel2Json;
  5. using Fort23.UTool;
  6. using UnityEngine;
  7. using UnityEngine.Serialization;
  8. [System.Serializable]
  9. public class CombatHeroInfo
  10. {
  11. public EncryptionLong hp = new EncryptionLong();
  12. public EncryptionLong defense = new EncryptionLong();
  13. public EncryptionLong attack = new EncryptionLong();
  14. /// <summary>
  15. /// 闪避 evasion
  16. /// </summary>
  17. public EncryptionInt shanbi = new EncryptionInt();
  18. public EncryptionFloat attSpeed = new EncryptionFloat();
  19. public EncryptionFloat crit =new EncryptionFloat();
  20. public EncryptionFloat critDamage =new EncryptionFloat();
  21. public EncryptionFloat dodge = new EncryptionFloat();
  22. public int level;
  23. public int star;
  24. public HeroModelConfig modelConfig;
  25. public HeroPowerUpConfig powerUpConfig;
  26. public HeroPromoteConfig promoteConfig;
  27. public HeroBasicEquipConfig basicEquipConfig;
  28. /// <summary>
  29. /// 1=英雄 2=小怪 3=精英怪 4=boss
  30. /// </summary>
  31. public int heroType;
  32. public string modelName;
  33. public float maxDis=2;
  34. public float maxDisTo=2*2;
  35. public int[] skillId;
  36. public bool isGpu;
  37. public CombatHeroInfo()
  38. {
  39. }
  40. // public CombatHeroInfo(AccountFileInfo.HeroData heroData)
  41. // {
  42. // modelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(heroData.heroModelId);
  43. // promoteConfig = ConfigComponent.Instance.Get<HeroPromoteConfig>(heroData.heroPromoteId);
  44. // powerConfig = ConfigComponent.Instance.Get<HeroPowerConfig>(heroData.heroPowerId);
  45. // star = promoteConfig.starGrade;
  46. // lv = powerConfig.heroLevel;
  47. // }
  48. private float rarityFactor;
  49. private float starFactor;
  50. private float factor;
  51. /// <summary>
  52. /// 计算影响基础属性的参数
  53. /// (稀有度、星级)
  54. /// </summary>
  55. protected void CalFactor()
  56. {
  57. rarityFactor = PlayerManager.Instance.gameConstantConfig.monsterRarityAttributeFactor[modelConfig.rarity-1]
  58. / 100f;
  59. starFactor = promoteConfig.star_Power / 100f;
  60. factor = rarityFactor * starFactor;
  61. }
  62. protected void CalAttribute()
  63. {
  64. hp = (EncryptionLong)(modelConfig.hp * powerUpConfig.HPFactor * factor);
  65. defense = (EncryptionLong)(modelConfig.def * powerUpConfig.DEFFactor * factor);
  66. attack = (EncryptionLong)(modelConfig.attack * powerUpConfig.ATKFactor * factor);
  67. shanbi = (EncryptionInt)(modelConfig.shanbi * powerUpConfig.SHANBIFactor);
  68. attSpeed = (EncryptionFloat)modelConfig.speed_atk;
  69. crit = (EncryptionFloat)modelConfig.crit;
  70. skillId = modelConfig.skillID;
  71. modelName = modelConfig.model;
  72. isGpu = modelConfig.isUseGpu;
  73. maxDis = modelConfig.range_atk;
  74. maxDisTo = maxDis * maxDis;
  75. }
  76. protected void SetDataConfig(int id,int level, int star)
  77. {
  78. modelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(id);
  79. powerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
  80. promoteConfig = ConfigComponent.Instance.Get<HeroPromoteConfig>(star);
  81. }
  82. public void InitMonster(int id,int level, int star)
  83. {
  84. SetDataConfig(id, level, star);
  85. CalFactor();
  86. CalAttribute();
  87. }
  88. public void InitMonster(int id,int level)
  89. {
  90. HeroModelConfig heroModelConfig = ConfigComponent.Instance.Get<HeroModelConfig>(id);
  91. HeroPowerUpConfig heroPowerUpConfig = ConfigComponent.Instance.Get<HeroPowerUpConfig>(level);
  92. hp = (EncryptionLong)(heroModelConfig.hp*heroPowerUpConfig.HPFactor);
  93. defense=(EncryptionLong)(heroModelConfig.def*heroPowerUpConfig.DEFFactor);
  94. attack=(EncryptionLong)(heroModelConfig.attack*heroPowerUpConfig.ATKFactor);
  95. attSpeed=(EncryptionFloat)heroModelConfig.speed_atk;
  96. crit=(EncryptionFloat)heroModelConfig.crit;
  97. skillId = heroModelConfig.skillID;
  98. modelName = heroModelConfig.model;
  99. isGpu = heroModelConfig.isUseGpu;
  100. maxDis=heroModelConfig.range_atk;
  101. maxDisTo = maxDis * maxDis;
  102. }
  103. public CombatHeroInfo Copy()
  104. {
  105. CombatHeroInfo combatHeroInfo = (CombatHeroInfo)MemberwiseClone();
  106. return combatHeroInfo;
  107. }
  108. }