S9022.cs 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using CombatLibrary.CombatLibrary.CombatCore.CustomizeTimeLogic.FxLogic;
  2. using Common.Utility.CombatEvent;
  3. using Fort23.Core;
  4. using GameLogic.Combat.CombatTool;
  5. using GameLogic.Combat.Hero;
  6. using UnityEngine;
  7. using UTool.CustomizeTimeLogic.FxLogic.TimeLineEventinterface;
  8. namespace GameLogic.Combat.Skill
  9. {
  10. /// <summary>
  11. /// 玄甲护体(防御型技能)
  12. /// 从四周飞来类似龟甲的碎片,乌龟龟甲上形成一个新的龟甲,防御+{0}%,敌人对其照成伤害时会收到{1}%反伤,
  13. /// 反伤为真实伤害。持续{2}秒
  14. /// </summary>
  15. public class S9022 : SkillBasic
  16. {
  17. private long currAddV;
  18. private bool isUpdate;
  19. private float currTime;
  20. protected override void ProActiveSkill()
  21. {
  22. CombatEventManager.Instance.AddEventListener(CombatEventType.HeroInjured, HeroInjured);
  23. }
  24. private void HeroInjured(IEventData data)
  25. {
  26. if (!isUpdate)
  27. {
  28. return;
  29. }
  30. HeroInjuredEventData heroInjuredEventData = data as HeroInjuredEventData;
  31. if (heroInjuredEventData.HarmReturnInfo.target.combatHeroEntity == CombatHeroEntity)
  32. {
  33. long harm = heroInjuredEventData.HarmReturnInfo.att;
  34. long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(harm, effectValue[1]);
  35. HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity,
  36. heroInjuredEventData.HarmReturnInfo.source, v,
  37. AttType.Skill | AttType.FanJi, triggerData,
  38. wuXingType, null,
  39. HarmType.Default);
  40. }
  41. }
  42. protected override void ProUseSkill()
  43. {
  44. }
  45. protected override void ProDefaultTimeLineTrigger(string groupName, CombatHeroHitPoint targetEntity,
  46. ITimelineFxLogic timelineFxLogic,
  47. TriggerData triggerData, ISkillFeatures skillFeatures)
  48. {
  49. long def = CombatHeroEntity.MaxCombatHeroInfo.defense.Value;
  50. currAddV = CombatCalculateTool.Instance.GetVlaueRatioForLong(def, effectValue[0]);
  51. CombatHeroEntity.CurrCombatHeroInfo.defense += currAddV;
  52. isUpdate = true;
  53. currTime = 0;
  54. // HarmReturnInfo harmReturnInfo = CObjectPool.Instance.Fetch<HarmReturnInfo>();
  55. // harmReturnInfo.ArmorPiercing = effectValue[2];
  56. // float harmBl = effectValue[1];
  57. // long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(CombatHeroEntity.CurrCombatHeroInfo.attack.Value,
  58. // harmBl);
  59. //
  60. // harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity, targetEntity, v,
  61. // AttType.Skill, triggerData,
  62. // wuXingType, skillFeatures,
  63. // HarmType.Default, harmReturnInfo: harmReturnInfo);
  64. }
  65. protected override void ProCombatUpdate(float time)
  66. {
  67. if (!isUpdate)
  68. {
  69. return;
  70. }
  71. currTime += time;
  72. if (currTime > effectValue[2])
  73. {
  74. isUpdate = false;
  75. }
  76. }
  77. protected override void ProDispose()
  78. {
  79. CombatEventManager.Instance.RemoveEventListener(CombatEventType.HeroInjured, HeroInjured);
  80. }
  81. }
  82. }