XmdsBuff_HitCreateSpell.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using CommonAI.Zone.Instance;
  2. using CommonAI.Zone.Formula;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using XmdsCommon.Plugin;
  8. using XmdsCommonServer.Plugin;
  9. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  10. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  11. using CommonAI.Zone;
  12. using XmdsCommonSkill.Plugin.Interface;
  13. using static XmdsCommonSkill.Plugin.Interface.ComSpellTemplate;
  14. using CommonAI.Data;
  15. using CommonAI.Zone.Helper;
  16. namespace XmdsCommonSkill.Plugin.Buffs
  17. {
  18. /// <summary>
  19. /// 技能击中创建新法术
  20. /// </summary>
  21. public class XmdsBuff_HitCreateSpell : XmdsBuffBase
  22. {
  23. public XmdsSpellID spellID = 0; //创建的法术ID
  24. public int skillID = 0; //释放的技能ID
  25. private int mHandleUUID = 0;
  26. public override int GetAbilityID()
  27. {
  28. return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.Hit_CreateSpell;
  29. }
  30. public override void CopyTo(UnitBuff other)
  31. {
  32. var ret = other as XmdsBuff_HitCreateSpell;
  33. ret.spellID = this.spellID;
  34. ret.skillID = this.skillID;
  35. base.CopyTo(other);
  36. }
  37. protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
  38. {
  39. GameSkill gameSkill = null;
  40. if (skillID != 0)
  41. {
  42. gameSkill = new GameSkill(skillID);
  43. }
  44. //注册监听.
  45. mHandleUUID = hitter.RegistOnHitOther(OnHandleHitOther, gameSkill);
  46. }
  47. private float OnHandleHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  48. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  49. {
  50. //if(this.skillID == 0 || (this.skillID == sk.SkillID))
  51. {
  52. CommonAI.Zone.LaunchSpell ls = new CommonAI.Zone.LaunchSpell();
  53. // //播放声音特效.
  54. attacker.mUnit.Parent.unitLaunchSpell(XmdsSkillType.none, hitted.mUnit,
  55. ComSpellTemplate.Instance().GetSpellByID(this.spellID),
  56. hitted.mUnit.X, hitted.mUnit.Y, hitted.mUnit.ID);
  57. attacker.mUnit.removeBuff(this.BindBuffID);
  58. }
  59. return damage;
  60. }
  61. protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
  62. {
  63. //取消监听.
  64. hitter.UnRegistOnHitOther(mHandleUUID);
  65. }
  66. protected override void OnDispose()
  67. {
  68. base.OnDispose();
  69. }
  70. }
  71. }