Assassin_200050.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. 
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Formula;
  4. using XmdsCommon.Plugin;
  5. using XmdsCommonServer.Plugin;
  6. using XmdsCommonSkill.Plugin.Buffs;
  7. using XmdsCommonServer.XLS.Data;
  8. using CommonAI.Zone.Instance;
  9. using CommonAI.Data;
  10. namespace XmdsCommonSkill.Plugin.Skills.Assassin
  11. {
  12. /// <summary>
  13. /// 隐身: 清除所有来自怪物的仇恨,隐身持续x秒,刺客移动速度下降x%,期间任何攻击或者受到伤害都会现形.
  14. /// </summary>
  15. public class Assassin_200050 : XmdsSkillBase
  16. {
  17. public static int ID = 200050;
  18. public static int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.YIN_SHEN;
  19. /// 下降速度
  20. public static XmdsSkillValue Buff_Value;
  21. public override int SkillID { get { return ID; } }
  22. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  23. {
  24. //施放技能监听.
  25. unit.RegistTryLaunchSkillEvent(OnTryLaunchSkillEventHandle, info, true);
  26. //被攻击监听.
  27. unit.RegistOnHitDamage(OnUnitHitEvent, info);
  28. //技能技能初始化,常用作为修改BUFF能力等等.
  29. XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
  30. XmdsBuff_Stealth buff = (XmdsBuff_Stealth)pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.Stealth);
  31. buff.ChangePercent = -GetTargetFormulaValue(info.SkillLevel, Buff_Value);
  32. BuffTemplate bt = pack.mBuffTemplate;
  33. bt.IsHarmful = false;
  34. pack.BindTemplateAndDispose();
  35. unit.RegistSendBuff(bt);
  36. }
  37. //被打监听.
  38. protected virtual float OnUnitHitEvent(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  39. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  40. {
  41. //大于0位伤害.
  42. if (damage > 0)
  43. {
  44. hitted.mUnit.removeBuff(Buff_ID);
  45. }
  46. return damage;
  47. }
  48. protected virtual bool OnTryLaunchSkillEventHandle(GameSkill skillInfo, ref InstanceUnit.SkillState skill, XmdsVirtual launcher, ref InstanceUnit.LaunchSkillParam param)
  49. {
  50. //只要施放的不是隐身和疾跑技能,其余全部消除.
  51. if (skill.Data.ID != SkillID
  52. && (skill.Data.ID != Assassin_200060.ID && skill.Data.ID != Assassin_201060.ID && skill.Data.ID != Assassin_202060.ID))
  53. {
  54. launcher.mUnit.removeBuff(Buff_ID);
  55. }
  56. return true;
  57. }
  58. //攻击监听.
  59. //protected virtual int OnLaunchSkillOver(int costEnergy, XmdsCommonServer.Plugin.XmdsVirtual attacker, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
  60. //{
  61. // //只要施放的不是隐身和疾跑技能,其余全部消除.
  62. // if (state.Data.ID != SkillID
  63. // && (state.Data.ID != Assassin_200060.ID && state.Data.ID != Assassin_201060.ID && state.Data.ID != Assassin_202060.ID))
  64. // {
  65. // attacker.mUnit.removeBuff(Buff_ID);
  66. // }
  67. // else
  68. // {
  69. // if (state.Data.ID == SkillID)
  70. // {
  71. // tmpAddBuff(costEnergy, attacker, state);
  72. // }
  73. // }
  74. // return costEnergy;
  75. //}
  76. //protected virtual void tmpAddBuff(int costEnergy, XmdsCommonServer.Plugin.XmdsVirtual attacker, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
  77. //{
  78. // BuffTemplate bt = attacker.GetRegistBuff(Buff_ID);
  79. // bt.LifeTimeMS = this.GetTargetFormulaValue(attacker.SkillHelper.GetGameSkill(SkillID).SkillLevel, BuffLifeTime);
  80. // attacker.mUnit.AddBuff(Buff_ID, attacker.mUnit);
  81. //}
  82. protected override void OnSkillLogicEvent(BattleParams param)
  83. {
  84. BuffTemplate bt = param.Attacker.GetRegistBuff(Buff_ID);
  85. bt.LifeTimeMS = 5000;
  86. param.Attacker.mUnit.AddBuff(Buff_ID, param.Attacker.mUnit);
  87. }
  88. protected override void OnInitSkillParam()
  89. {
  90. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  91. InitData(data, out Buff_Value, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  92. }
  93. }
  94. }