Exemplo n.º 1
0
 public bool Evaluate(ActionHandler2 firer, bool transact)
 {
     if (condition.Evaluate(firer, transact))
     {
         return statement.Evaluate(firer, transact);
     }
     return false;
 }
Exemplo n.º 2
0
 public bool Evaluate(ActionHandler2 firer, bool transact)
 {
     if (transact)
     {
         firer.CreateProjectile(objectCode, action, Vector2.zero);
     }
     return true;
 }
Exemplo n.º 3
0
 public bool Fire(ActionHandler2 firer)
 {
     if (action.Evaluate(firer, true))
     {
         remainCooltime = commandEntity.coolTime;
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 public bool Evaluate(ActionHandler2 firer, bool transact)
 {
     bool ret = false;
     foreach (var entity in statements)
     {
         ret |= entity.Evaluate(firer, transact);
     }
     return ret;
 }
Exemplo n.º 5
0
 public bool Evaluate(ActionHandler2 firer, bool transact)
 {
     if (condition.Evaluate(firer, transact))
     {
         return statement1.Evaluate(firer, transact);
     }
     else
     {
         return statement2.Evaluate(firer, transact);
     }
 }
Exemplo n.º 6
0
 public bool IsFirable(ActionHandler2 firer)
 {
     if (commandEntity.queuePriority > 0 && firer.IsInMotion())
     {
         return false;
     }
     if (remainCooltime > 0)
     {
         return false;
     }
     return action.Evaluate(firer, false);
 }
Exemplo n.º 7
0
 protected override bool Fire(ActionHandler2 firer, Command2 command)
 {
     if (base.Fire(firer, command))
     {
         if (consumable)
         {
             Remove(command);
         }
         return true;
     }
     return false;
 }
Exemplo n.º 8
0
    protected override bool Fire(ActionHandler2 firer, Command2 command)
    {
        if (base.Fire(firer, command))
        {
            if (onChargedAttack != null)
            {
                /*
                if (command is BlockCommand)
                {
                    BlockCommand blockCommand = command as BlockCommand;
                    if (blockCommand.isChargedAttack)
                    {
                        onChargedAttack(blockCommand.matchGeneration);
                    }
                }
                 * */
            }

            return true;
        }
        return false;
    }
Exemplo n.º 9
0
        public bool Evaluate(ActionHandler2 firer, bool transact)
        {
            var targets = firer.FindTarget(targetRange, targetType);
            if (targets.IsNullOrEmpty())
            {
                return false;
            }

            var targetStatuses = targets.Select(x => x.Status).Where(x => x.ContainsKey(statusKey));
            if (targetStatuses.IsNullOrEmpty())
            {
                return false;
            }

            var expr = ReplaceRandomValue(valueExpr);
            float result = StatCalc.Calc(expr, firer.Stat);
            targetStatuses.ForEach(x => x.Change(statusKey, result));

            // handle options

            return true;
        }
Exemplo n.º 10
0
 Command2 PickAction(ActionHandler2 firer)
 {
     foreach (var entity in queue)
     {
         if (pipe != null || entity.IsFirable(firer))
         {
             Command2 ret = entity;
             return ret;
         }
     }
     return null;
 }
Exemplo n.º 11
0
    /*
    public void Fire(int index)
    {
        if (0 <= index && index < queue.Count)
        {
            Fire(queue[index]);
        }
    }
    */

    protected virtual bool Fire(ActionHandler2 firer, Command2 command)
    {
        if (command != null)
        {
            if (command.IsFirable(firer))
            {
                if (pipe != null)
                {
                    pipe.TryAdd(command);
                    return true;
                }

                /*
                if (command is OnDemandCommand && !(command as OnDemandCommand).HasFirableTarget(owner))
                {
                    return true;
                }
                */

                return command.Fire(firer);
            }
        }
        return false;
    }
Exemplo n.º 12
0
 public void Fire(ActionHandler2 firer)
 {
     Command2 command = PickAction(firer);
     if (command != null)
     {
         Fire(firer, command);
     }
 }
Exemplo n.º 13
0
 protected override bool Fire(ActionHandler2 firer, Command2 command)
 {
     if (base.Fire(firer, command))
     {
         /*
         if (command is ItemCommand)
         {
             (command as ItemCommand).PlaySound(owner);
         }
          * */
         return true;
     }
     return false;
 }
Exemplo n.º 14
0
 public bool Evaluate(ActionHandler2 firer, bool transact)
 {
     return action.Evaluate(firer, transact);
 }