Example #1
0
        private IQuinoaUI ui; //UI currently connected

        #endregion Fields

        #region Constructors

        public Quinoa()
        {
            ticks = 0;
            map = new RegionMap();
            messages = new MessageManager();
            actions = new QuinoaActions(this);
            lightMap = new LightMap(this);
            pathFinder = new PathFinder(this, new ClosestSquaredHeuristic());

            ui = new formQuinoaWindow();
            ui.register(this);
            ui.setInterfaceMode(InterfaceMode.MENU);
            ui.refresh();
        }
        public static bool growable(Terrain terrain, int x, int y, LightMap lightMap, TerrainParameter thingToGrow)
        {
            //check for doors, trees, signs, graves
            if(TerrainManager.hasParameter(terrain, TerrainParameter.HAS_TREE)
            || TerrainManager.hasParameter(terrain, TerrainParameter.HAS_SIGN)
            || TerrainManager.hasParameter(terrain, TerrainParameter.HAS_GRAVE)
            || TerrainManager.hasParameter(terrain, TerrainParameter.HAS_DOOR))
            {
                return false;
            }

            switch(thingToGrow)
            {
                //crops
                case TerrainParameter.HAS_SEED:
                if(terrain.getCode() == TerrainCode.FERTILE_LAND
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_SEED)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_MOSS))
                {
                    return true;
                }
                return false;

                //mushrooms
                case TerrainParameter.HAS_MUSHROOM_SPORES:
                if(lightMap.getCalc(x, y) <= TerrainManager.SPORE_LIGHT_LEVEL_MAX
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_MUSHROOM_SPORES)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_CLOVER)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_SEED)
                && terrain.getCode() != TerrainCode.STONE_WALL
                && terrain.getCode() != TerrainCode.ROCK)
                {
                    return true;
                }
                return false;

                //clover
                case TerrainParameter.HAS_CLOVER:
                if(!TerrainManager.hasParameter(terrain, TerrainParameter.HAS_MUSHROOM_SPORES)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_CLOVER)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_SEED)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_MOSS)
                && terrain.getCode() != TerrainCode.STONE_WALL
                && terrain.getCode() != TerrainCode.ROCK
                && terrain.getCode() != TerrainCode.STREAM_BED
                && terrain.getCode() != TerrainCode.PATH)
                {
                    return true;
                }
                return false;

                //moss
                case TerrainParameter.HAS_MOSS:
                if(terrain.getWater() <= 0
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_MUSHROOM_SPORES)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_CLOVER)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_SEED)
                && !TerrainManager.hasParameter(terrain, TerrainParameter.HAS_MOSS)
                && (terrain.getCode() == TerrainCode.STONE_FLOOR
                || terrain.getCode() == TerrainCode.STONE_WALL
                || terrain.getCode() == TerrainCode.ROCK))
                {
                    return true;
                }
                return false;

                default:
                return true;
            }
        }
Example #3
0
 public void reset()
 {
     ticks = 0;
     map = new RegionMap();
     messages = new MessageManager();
     actions = new QuinoaActions(this);
     lightMap = new LightMap(this);
     pathFinder = new PathFinder(this, new ClosestSquaredHeuristic());
 }