S2011.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using Common.Utility.CombatEvent;
  2. using Fort23.Core;
  3. using GameLogic.Combat.Buff;
  4. using GameLogic.Combat.CombatTool;
  5. using GameLogic.Combat.Hero;
  6. namespace GameLogic.Combat.Skill
  7. {
  8. /// <summary>
  9. /// 血祭神通
  10. /// 所有流血状态照成的伤害会转换成充能值,2圈后对全体敌人造成{0}%充能值的伤害
  11. /// </summary>
  12. public class S2011 : SkillBasic
  13. {
  14. private long addHarm;
  15. private int count;
  16. protected override void ProUseSkill()
  17. {
  18. }
  19. protected override void ProActiveSkill()
  20. {
  21. CombatEventManager.Instance.AddEventListener(CombatEventType.HeroInjured, HeroInjured);
  22. CombatEventManager.Instance.AddEventListener(CombatEventType.TriggerSkillSlots, TriggerSkillSlots);
  23. count = 0;
  24. addHarm = 0;
  25. }
  26. protected override void ProDispose()
  27. {
  28. CombatEventManager.Instance.RemoveEventListener(CombatEventType.HeroInjured, HeroInjured);
  29. CombatEventManager.Instance.RemoveEventListener(CombatEventType.TriggerSkillSlots, TriggerSkillSlots);
  30. }
  31. private void TriggerSkillSlots(IEventData ieventData)
  32. {
  33. TriggerSkillSlotsEventData triggerSkillSlotsEventData = ieventData as TriggerSkillSlotsEventData;
  34. if (triggerSkillSlotsEventData.SkillBasic == this)
  35. {
  36. if (triggerSkillSlotsEventData.triggerType != 0)
  37. {
  38. return;
  39. }
  40. count++;
  41. if (count < 2)
  42. {
  43. return;
  44. }
  45. long v = CombatCalculateTool.Instance.GetVlaueRatioForLong(addHarm, effectValue[0]);
  46. if (v > 0)
  47. {
  48. CombatHeroEntity[] allHero =
  49. CombatController.currActiveCombat.CombatHeroController.GetHero(!CombatHeroEntity.IsEnemy,out int maxCount);
  50. for (int i = 0; i < maxCount; i++)
  51. {
  52. HarmReturnInfo harmReturnInfo = CombatCalculateTool.Instance.Harm(CombatHeroEntity, allHero[i],
  53. v,
  54. AttType.Skill, triggerData,
  55. wuXingType, null,
  56. HarmType.Default);
  57. }
  58. }
  59. addHarm = 0;
  60. }
  61. }
  62. private void HeroInjured(IEventData ieventData)
  63. {
  64. HeroInjuredEventData heroInjuredEventData = ieventData as HeroInjuredEventData;
  65. b_1011 b1011 = heroInjuredEventData.HarmReturnInfo.triggerData.Source as b_1011;
  66. b_1012 b1012 = heroInjuredEventData.HarmReturnInfo.triggerData.Source as b_1012;
  67. if ((b1011 == null && b1012 == null))
  68. {
  69. return;
  70. }
  71. if(b1011!= null && b1011.Source != CombatHeroEntity)
  72. {
  73. return;
  74. }
  75. if (b1012 != null && b1012.Source != CombatHeroEntity)
  76. {
  77. return;
  78. }
  79. long harm = heroInjuredEventData.HarmReturnInfo.att;
  80. addHarm += harm;
  81. }
  82. }
  83. }