PetEquipSkillBase.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Instance;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using XmdsCommon.Plugin;
  9. using XmdsCommonServer.Plugin;
  10. using XmdsCommonServer.XLS.Data;
  11. using XmdsCommonSkill.Plugin.Skills;
  12. namespace XmdsCommonSkill.Plugin.PassiveSkills.Pet20200515
  13. {
  14. public abstract class PetEquipSkillBase : XmdsPassiveSkillBase
  15. {
  16. //内置CD
  17. protected XmdsSkillValue mTriggerInterval;
  18. //触发概率
  19. protected XmdsSkillValue mTriggerRate;
  20. //内部维护变量
  21. private long mNextTriggerTime = 0;
  22. public void initEquipSkillBase(XmdsSkillValue triggerInterval, XmdsSkillValue triggerRate, int skillLv)
  23. {
  24. this.mTriggerInterval = triggerInterval;
  25. this.mTriggerRate = triggerRate;
  26. this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + mTriggerInterval.GetValue(skillLv);
  27. }
  28. protected bool IsTrigger(XmdsVirtual player, int skillLv)
  29. {
  30. bool isTrigger = CommonLang.CUtils.localTimeMS > mNextTriggerTime && player.RandomPercent(mTriggerRate.GetValue(skillLv));
  31. if (isTrigger)
  32. {
  33. this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + mTriggerInterval.GetValue(skillLv);
  34. }
  35. return isTrigger;
  36. }
  37. //protected void NotifyTriggerAblity(InstanceUnit unit, int id)
  38. //{
  39. // unit.queueEvent(new UnitTriggerAblity(unit.ID, id));
  40. //}
  41. }
  42. }