XmdsBuff_ActiveSkill.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. 
  2. using CommonAI.Zone.Instance;
  3. using XmdsCommon.Message;
  4. using XmdsCommonServer.Plugin;
  5. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  6. namespace XmdsCommonSkill.Plugin.Buffs
  7. {
  8. public class XmdsBuff_ActiveSkill : XmdsBuffBase
  9. {
  10. //被顶替的技能ID.
  11. public int FreezeSkillID;
  12. //激活的技能ID.
  13. public int ActiveSkillID;
  14. public override int GetAbilityID()
  15. {
  16. return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.ActiveSkill;
  17. }
  18. public override void CopyTo(UnitBuff other)
  19. {
  20. var ret = other as XmdsBuff_ActiveSkill;
  21. //被顶替的技能ID.
  22. ret.FreezeSkillID = this.FreezeSkillID;
  23. //激活的技能ID.
  24. ret.ActiveSkillID = this.ActiveSkillID;
  25. base.CopyTo(other);
  26. }
  27. protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
  28. {
  29. //被顶替技能冻结.
  30. hitter.mUnit.SetSkillActive(FreezeSkillID, false, true);
  31. hitter.mUnit.SetSkillActive(ActiveSkillID, true);
  32. BuffActiveSkillEventB2C evt = new BuffActiveSkillEventB2C();
  33. evt.IsWorking = true;
  34. evt.FreezeSkillID = FreezeSkillID;
  35. evt.ActiveSkillID = ActiveSkillID;
  36. evt.BuffID = state.ID;
  37. hitter.mUnit.queueEvent(evt);
  38. //定特殊协议,通知客户端.
  39. XmdsVirtual.FormatLog("BuffBegin : 单位【{0}】,激活技能{1}", hitter.mProp.ServerData.BaseInfo.name, ActiveSkillID);
  40. }
  41. protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
  42. {
  43. //解除顶替技能冻结.
  44. hitter.mUnit.SetSkillActive(ActiveSkillID, false);
  45. hitter.mUnit.SetSkillActive(FreezeSkillID, true);
  46. BuffActiveSkillEventB2C evt = new BuffActiveSkillEventB2C();
  47. evt.IsWorking = false;
  48. evt.FreezeSkillID = FreezeSkillID;
  49. evt.ActiveSkillID = ActiveSkillID;
  50. evt.BuffID = state.ID;
  51. hitter.mUnit.queueEvent(evt);
  52. //定特殊协议,通知客户端.
  53. XmdsVirtual.FormatLog("BuffEnd : 单位【{0}】,冻结技能{1}", hitter.mProp.ServerData.BaseInfo.name, ActiveSkillID);
  54. }
  55. }
  56. }