S9053.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. b_1018 b1018 = combatHeroEntity.BuffControl.GetBuffBasicForType<b_1018>();
  62. float addOdds = b1018 != null ? b1018.buffCount * effectValue[1] : 0;
  63. if (_hitCount<effectValue[2]&&odds <= effectValue[0]+addOdds)
  64. {
  65. _hitCount++;
  66. //击中目标
  67. targetPos = combatHeroEntity.dotPos;
  68. float harmBl = effectValue[3];
  69. // b_1018 b1018 = combatHeroEntity.BuffControl.GetBuffBasicForType<b_1018>();
  70. if (b1018 != null) //消耗一层感电,额外照成伤害
  71. {
  72. b1018.ReduceCount(1);
  73. harmBl += effectValue[4];
  74. }
  75. long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(
  76. CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
  77. harmBl);
  78. HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity,
  79. combatHeroEntity, v,
  80. AttType.Skill, triggerData,
  81. wuXingType, null,
  82. HarmType.Default);
  83. }
  84. else
  85. {
  86. List<FxAILogicBasic> allFxAi =
  87. CombatController.currActiveCombat.GameTimeLineParticleFactory.GetFxAILogicBasic(
  88. !CombatHeroEntity
  89. .IsEnemy);
  90. if (allFxAi.Count > 0)
  91. {
  92. int index = Random.Range(0, allFxAi.Count);
  93. FxAILogicBasic fxAILogicBasic = allFxAi[index];
  94. targetPos = fxAILogicBasic.gameObject.transform.position;
  95. FxParabolaBulletLogic fxParabolaBulletLogic = fxAILogicBasic as FxParabolaBulletLogic;
  96. if (fxParabolaBulletLogic != null)
  97. {
  98. fxParabolaBulletLogic.PengZhuang(GetSkillFeaturesData(), CombatHeroEntity);
  99. }
  100. }
  101. else
  102. {
  103. int x = Random.Range(-10, 10);
  104. int z = Random.Range(4, 10);
  105. targetPos = CombatHeroEntity.GameObject.transform.TransformPoint(new Vector3(x, 0, z));
  106. }
  107. }
  108. ActivationTimeLineData("9053_fashe", customizePos: new Vector3[] { targetPos });
  109. }
  110. }
  111. }
  112. }