Package com.fray.evo.action

Examples of com.fray.evo.action.EcAction


      int actionListSize = actions.size();
        for (int i = 0; i < actionListSize; i++) {
          Class<? extends EcAction> actionClass = actions.get(i);
          try {
            // create an instance of this action to get it's gas value
        EcAction actionObj = actionClass.newInstance();
       
        // check the action type
        if( actionObj instanceof EcActionBuild){
          if ( ((EcActionBuild)actionObj).getGas() > 0){
            // this building requires gas
View Full Code Here


  {
    int i = 0;
    ArrayList<EcAction> actions = s.getActions();
    for (int c = 0; c < actions.size(); ++c)
    {
      EcAction a = actions.get(c);
      i++;
      if (a.isInvalid(s))
      {
        s.invalidActions++;
        continue;
      }
                        EcAction.CanExecuteResult canExecute;
      while (!(canExecute= a.canExecute(s, log)).can)
      {
        if (s.seconds > s.targetSeconds || destination.waypointMissed(s))
        {
          if (s.settings.overDrone && s.getDrones() < s.getOverDrones(s))
            log.printFailure( GameLog.FailReason.OverDrone, mergedDestination, s );
          else
            log.printFailure( GameLog.FailReason.Waypoint, mergedDestination, s );
          return s;
        }
        int waypointIndex = destination.getCurrWaypointIndex(s);
        if (waypointIndex != -1 && destination.getWaypointActions(waypointIndex) > 0)
          log.printWaypoint( waypointIndex, s );
                                if(canExecute.somethingChanged){
        if (destination.getMergedWaypoints().isSatisfied(s))
        {
          log.printSatisfied(i - s.invalidActions, s, mergedDestination);
          return s;
        }}
      }
     
      if (!(a instanceof EcActionWait))
        log.printAction(s, a);

      a.execute(s, log);
    }
    log.printFailure(GameLog.FailReason.OutOfActions, s, null);
    return s;
  }
View Full Code Here

TOP

Related Classes of com.fray.evo.action.EcAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.