Exemplo n.º 1
0
 public override ISkillTrigger.TriggerStatus Triggered(ISkillArgs args)
 {
     if (!or)
     {
         for (int i = 0; i < triggers.Count; i++)
         {
             ISkillTrigger t = triggers[i];
             ISkillTrigger.TriggerStatus ts = t.Triggered(args);
             if (ts == ISkillTrigger.TriggerStatus.Failed || ts == ISkillTrigger.TriggerStatus.Interrupted)
             {
                 return(ts);
             }
         }
         return(ISkillTrigger.TriggerStatus.Success);
     }
     else
     {
         for (int i = 0; i < triggers.Count; i++)
         {
             ISkillTrigger t = triggers[i];
             ISkillTrigger.TriggerStatus ts = t.Triggered(args);
             if (ts == ISkillTrigger.TriggerStatus.Success)
             {
                 return(ts);
             }
         }
         return(ISkillTrigger.TriggerStatus.Failed);
     }
 }
Exemplo n.º 2
0
 public override ISkillTrigger.TriggerStatus Triggered(ISkillArgs args)
 {
     if (interrupter != null && interrupter.IsInterrupted(args))
     {
         if (startTime > 0)
         {
             startTime = 0;
             if (interAction != null)
             {
                 interAction.Act(args);
             }
             return(ISkillTrigger.TriggerStatus.Interrupted);
         }
         startTime = 0;
     }
     if (startTrigger == null || startTrigger.Triggered(args) == ISkillTrigger.TriggerStatus.Success)
     {
         if (startTime == 0)
         {
             startTime = Runtime.CurrentTimeMillis();
             if (castAction != null)
             {
                 castAction.Act(args);
             }
         }
     }
     if (startTime > 0 && Runtime.CurrentTimeMillis() - startTime >= time)
     {
         startTime = 0;
         return(ISkillTrigger.TriggerStatus.Success);
     }
     return(ISkillTrigger.TriggerStatus.Failed);
 }
 // 技能持续中已冷却,是否可以再次使用技能
 // 技能被打断的情况下是否会进入冷却
 public override void Frame(ISkillArgs args)
 {
     InitialTimer();
     Initial(args);
     if (timer.IsActive() && inter != null && inter.IsInterrupted(args))
     {
         if (interAction != null)
         {
             interAction.Act(args);
         }
         timer.Terminate();
     }
     if (disable)
     {
         Warning(args, disableAction);
     }
     else
     {
         if (timer.IsCooldownOver())
         {
             if (notCooldown)
             {
                 notCooldown = false;
                 if (cooldownAction != null)
                 {
                     cooldownAction.Act(args);
                 }
             }
             if (always || !timer.IsActive())
             {
                 ISkillTrigger.TriggerStatus s = ISkillTrigger.TriggerStatus.Success;
                 if (trigger != null)
                 {
                     s = trigger.Triggered(args);
                 }
                 if (disable)
                 {
                     s = ISkillTrigger.TriggerStatus.Failed;
                 }
                 if (s == ISkillTrigger.TriggerStatus.Success || s == ISkillTrigger.TriggerStatus.Interrupted)
                 {
                     if (s == ISkillTrigger.TriggerStatus.Success)
                     {
                         timer.Start();
                         Effet(args);
                     }
                     else
                     {
                         if (interCoolDown)
                         {
                             timer.Start();
                         }
                         timer.SetInterrupt(true);
                     }
                 }
             }
             else
             {
                 Warning(args, alreadyAction);
             }
         }
         else
         {
             notCooldown = true;
             Warning(args, notReadyAction);
         }
     }
     if (timer.IsActive())
     {
         if (timer.IsLastOver())
         {
             timer.Stop();
             if (!timer.IsInterrupt() && !timer.IsActiveInter())
             {
                 Resume(args);
             }
             timer.SetInterrupt(false);
         }
         else
         {
             if (lastAction != null)
             {
                 lastAction.Act(args);
             }
         }
     }
 }