S9053.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. using System.Collections.Generic;
  2. using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
  3. using Common.Combat.FxAILogic;
  4. using GameLogic.Combat.Buff;
  5. using GameLogic.Combat.CombatTool;
  6. using GameLogic.Combat.Hero;
  7. using UnityEngine;
  8. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
  9. namespace GameLogic.Combat.Skill
  10. {
  11. /// <summary>
  12. /// 引雷
  13. /// 请求仰天施法,引导天雷,天雷在战场上随机落下,{0}%概率击中目标,每层感电额外+{1}%概率
  14. /// ,最多被击中{2}次,每次击中消耗一层感电额外照成{3}伤害。引雷可以击中弹道.持续{4}秒
  15. /// </summary>
  16. public class S9053 : SkillBasic
  17. {
  18. private float _currTime;
  19. private int _hitCount;
  20. private bool _isUpdate;
  21. private float _jianGe;
  22. private float _allTime;
  23. protected override void ProUseSkill()
  24. {
  25. _hitCount = 0;
  26. ballisticsCount = (int)effectValue[0];
  27. ActivationTimeLineData("9053");
  28. _isUpdate = true;
  29. _allTime = 0;
  30. }
  31. protected override void ProDefaultTimeLineTrigger(string groupName, CombatHeroHitPoint targetEntity,
  32. ITimelineFxLogic timelineFxLogic,
  33. TriggerData triggerData, ISkillFeatures skillFeatures)
  34. {
  35. }
  36. private void SetJianGe()
  37. {
  38. _jianGe = CombatCalculateTool.Instance.GetOdd(20, 100) / 100f;
  39. }
  40. protected override void ProCombatUpdate(float time)
  41. {
  42. if (!_isUpdate)
  43. {
  44. return;
  45. }
  46. _currTime += time;
  47. _allTime += time;
  48. if (_allTime > effectValue[5])
  49. {
  50. _isUpdate = false;
  51. return;
  52. }
  53. if (_currTime >= _jianGe)
  54. {
  55. _currTime = 0;
  56. SetJianGe();
  57. Vector3 targetPos = Vector3.zero;
  58. //发射一道闪电
  59. int odds = CombatCalculateTool.Instance.GetOdd(0, 100);
  60. CombatHeroEntity combatHeroEntity = CombatHeroEntity.CombatAIBasic.currFocusTarget;
  61. if (combatHeroEntity == null || combatHeroEntity.BuffControl == null)
  62. {
  63. return;
  64. }
  65. b_1018 b1018 = combatHeroEntity.BuffControl.GetBuffBasicForType<b_1018>();
  66. float addOdds = b1018 != null ? b1018.buffCount * effectValue[1] : 0;
  67. if (_hitCount<effectValue[2]&&odds <= effectValue[0]+addOdds)
  68. {
  69. _hitCount++;
  70. //击中目标
  71. targetPos = combatHeroEntity.dotPos;
  72. float harmBl = effectValue[3];
  73. // b_1018 b1018 = combatHeroEntity.BuffControl.GetBuffBasicForType<b_1018>();
  74. if (b1018 != null) //消耗一层感电,额外照成伤害
  75. {
  76. b1018.ReduceCount(1);
  77. harmBl += effectValue[4];
  78. }
  79. long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(
  80. CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
  81. harmBl);
  82. HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity,
  83. combatHeroEntity, v,
  84. AttType.Skill, triggerData,
  85. wuXingType, null,
  86. HarmType.Default);
  87. }
  88. else
  89. {
  90. List<FxAILogicBasic> allFxAi =
  91. CombatController.currActiveCombat.GameTimeLineParticleFactory.GetFxAILogicBasic(
  92. !CombatHeroEntity
  93. .IsEnemy);
  94. if (allFxAi.Count > 0)
  95. {
  96. int index = Random.Range(0, allFxAi.Count);
  97. FxAILogicBasic fxAILogicBasic = allFxAi[index];
  98. targetPos = fxAILogicBasic.gameObject.transform.position;
  99. FxParabolaBulletLogic fxParabolaBulletLogic = fxAILogicBasic as FxParabolaBulletLogic;
  100. if (fxParabolaBulletLogic != null)
  101. {
  102. fxParabolaBulletLogic.PengZhuang(GetSkillFeaturesData(), CombatHeroEntity);
  103. }
  104. }
  105. else
  106. {
  107. int x = Random.Range(-10, 10);
  108. int z = Random.Range(4, 10);
  109. targetPos = CombatHeroEntity.GameObject.transform.TransformPoint(new Vector3(x, 0, z));
  110. }
  111. }
  112. ActivationTimeLineData("9053_fashe", customizePos: new Vector3[] { targetPos });
  113. }
  114. }
  115. }
  116. }