123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Instance;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Skills;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Pet20200515
- {
- public abstract class PetEquipSkillBase : XmdsPassiveSkillBase
- {
- //内置CD
- protected XmdsSkillValue mTriggerInterval;
- //触发概率
- protected XmdsSkillValue mTriggerRate;
- //内部维护变量
- private long mNextTriggerTime = 0;
- public void initEquipSkillBase(XmdsSkillValue triggerInterval, XmdsSkillValue triggerRate, int skillLv)
- {
- this.mTriggerInterval = triggerInterval;
- this.mTriggerRate = triggerRate;
- this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + mTriggerInterval.GetValue(skillLv);
- }
- protected bool IsTrigger(XmdsVirtual player, int skillLv)
- {
- bool isTrigger = CommonLang.CUtils.localTimeMS > mNextTriggerTime && player.RandomPercent(mTriggerRate.GetValue(skillLv));
- if (isTrigger)
- {
- this.mNextTriggerTime = CommonLang.CUtils.localTimeMS + mTriggerInterval.GetValue(skillLv);
- }
- return isTrigger;
- }
- //protected void NotifyTriggerAblity(InstanceUnit unit, int id)
- //{
- // unit.queueEvent(new UnitTriggerAblity(unit.ID, id));
- //}
- }
- }
|