Other_100006.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.RegistTryAddBuffEvent(OnTryAddBuffEvent, skillInfo, true);
  44. }
  45. private float OnHandleHitDmage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  46. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  47. {
  48. isEndDispatch = true;
  49. if (source.FromSkillType == XmdsSkillType.normalAtk)
  50. {
  51. curHitTimes++;
  52. //if(curHitTimes >= mNeedHitTimes)
  53. //{
  54. // hitted.mUnit.AddHP(-hitted.mUnit.MaxHP);
  55. //}
  56. return 1;
  57. }
  58. attacker.SendBattleHintNumberB2C(0, XmdsVirtual.UnitHitEventState.Immunity, hitted.mUnit.ID);
  59. return 0;
  60. }
  61. private bool OnTryAddBuffEvent(ref BuffTemplate buff, XmdsVirtual attacker, XmdsVirtual hitter, GameSkill skill)
  62. {
  63. // 不允许加buff
  64. return false;
  65. }
  66. protected override void OnInitSkillParam()
  67. {
  68. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  69. InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  70. }
  71. protected override void OnDispose(XmdsVirtual owner)
  72. {
  73. owner.UnRegistOnHitDamage(mUUID_1);
  74. owner.UnRegistTryAddBuffEvent(mUUID_2);
  75. owner.RemovePropChangeOperation(mOpID1);
  76. }
  77. }
  78. }