{"size": 771, "ext": "js", "max_stars_repo_path": "creeps.Upgrader.js", "max_stars_repo_name": "ZanneZankyo/ZankyoScreeps", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "creeps.Upgrader.js", "max_issues_repo_name": "ZanneZankyo/ZankyoScreeps", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "creeps.Upgrader.js", "max_forks_repo_name": "ZanneZankyo/ZankyoScreeps", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.5357142857, "max_line_length": 61, "alphanum_fraction": 0.5680933852}
var utilsRooms = require('utils.Rooms');
var creepsUniversal = require('creeps.Universal');

var creepsUpgrader = {
    run: function (creep) {
        if (creep.memory.target == undefined) {
            this.findTarget(creep);
            return;
        }
        else {
            creepsUniversal.doWork(creep);
        }
    },
    findTarget: function (creep) {
        creepsUniversal.decideGathering(creep);
        if (creep.memory.isGathering) {
            creepsUniversal.findNearestStoreHasEnergy(creep);
            if(creep.memory.target == undefined) {
                creepsUniversal.findSource(creep);
            }
        }
        else {    
            creep.memory.target = creep.room.controller;
        }
    }
}

module.exports = creepsUpgrader;