Other_100006.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using CommonAI.Zone.Helper;
  2. using CommonAI.Zone.Instance;
  3. using XmdsCommonServer.Plugin;
  4. using XmdsCommonServer.XLS.Data;
  5. using XmdsCommonSkill.Plugin.Buffs;
  6. using System;
  7. using static CommonAI.Zone.Instance.InstanceUnit;
  8. using XmdsCommon.Plugin;
  9. using CommonAI.Zone;
  10. using XmdsCommonServer.Plugin.Units;
  11. using CommonAI.Zone.Formula;
  12. using XmdsCommonSkill.Plugin.Skills;
  13. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  14. using XmdsCommonSkill.Plugin.Skills.Magic;
  15. using CommonLang;
  16. using CommonAI.Data;
  17. using System.Collections.Generic;
  18. namespace XmdsCommonSkill.Plugin.PassiveSkills.Magic
  19. {
  20. /// <summary>
  21. /// 岩石怪被动
  22. /// </summary>
  23. public class Other_100006 : XmdsPassiveSkillBase
  24. {
  25. /// 技能ID.
  26. public static readonly int ID = 100006;
  27. private static XmdsSkillValue valueSet;
  28. private int mNeedHitTimes = 0;
  29. private int mUUID_1 = 0;
  30. private int mUUID_2 = 0;
  31. private int mOpID1 = 0;
  32. //私有数据
  33. private int curHitTimes = 0;
  34. public override int SkillID { get { return ID; } }
  35. protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
  36. {
  37. mNeedHitTimes = valueSet.GetValue();
  38. XmdsVirtual.PropChangeOperation pco = owner.CreatePropChangeOpertation(null);
  39. pco.Type = XmdsVirtual.UnitAttributeType.SetMaxHP;
  40. pco.Value = mNeedHitTimes;
  41. mOpID1 = owner.AddPropChangeOperation(pco);
  42. //mUUID_1 = owner.RegistOnHitDamage(OnHandleHitDmage, skillInfo, true);
  43. mUUID_1 = owner.RegistAddOtherHPEvent(OnAddOtherHPEvnet, skillInfo);
  44. mUUID_1 = owner.RegistTryAddBuffEvent(OnTryAddBuffEvent, skillInfo, true);
  45. }
  46. public bool OnAddOtherHPEvnet(int hp, InstanceUnit sender, InstanceUnit hitter, AttackSource source, out int finalHP)
  47. {
  48. //加血跳过
  49. if (hp <= 0)
  50. {
  51. finalHP = hp;
  52. return true;
  53. }
  54. finalHP = hp;
  55. if (source != null && source.FromSkillType == XmdsSkillType.normalAtk)
  56. {
  57. curHitTimes++;
  58. //if(curHitTimes >= mNeedHitTimes)
  59. //{
  60. // hitted.mUnit.AddHP(-hitted.mUnit.MaxHP);
  61. //}
  62. finalHP = 1;
  63. return false;
  64. }
  65. (sender.Virtual as XmdsVirtual).SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity, hitter.ID);
  66. finalHP = 0;
  67. return false;
  68. }
  69. // private float OnHandleHitDmage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  70. // ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  71. // {
  72. //isEndDispatch = true;
  73. // if (source.FromSkillType == XmdsSkillType.normalAtk)
  74. // {
  75. // curHitTimes++;
  76. // //if(curHitTimes >= mNeedHitTimes)
  77. // //{
  78. // // hitted.mUnit.AddHP(-hitted.mUnit.MaxHP);
  79. // //}
  80. // return 1;
  81. // }
  82. // attacker.SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity, hitted.mUnit.ID);
  83. // return 0;
  84. // }
  85. private bool OnTryAddBuffEvent(ref BuffTemplate buff, XmdsVirtual attacker, XmdsVirtual hitter, GameSkill skill)
  86. {
  87. // 不允许加buff
  88. return false;
  89. }
  90. protected override void OnInitSkillParam()
  91. {
  92. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  93. InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  94. }
  95. protected override void OnDispose(XmdsVirtual owner)
  96. {
  97. //owner.UnRegistOnHitDamage(mUUID_1);
  98. owner.UnRegistAddOtherHPEvent(mUUID_1);
  99. owner.UnRegistTryAddBuffEvent(mUUID_2);
  100. owner.RemovePropChangeOperation(mOpID1);
  101. }
  102. }
  103. }