Package org.freerealm.tile

Examples of org.freerealm.tile.Tile


            Entry entry = (Entry) workforceIterator.next();
            WorkForce workForce = (WorkForce) entry.getValue();
            Resource workForceResource = workForce.getResource();
            if (resource.equals(workForceResource)) {
                Coordinate coordinate = (Coordinate) entry.getKey();
                Tile tile = getRealm().getTile(coordinate);
                int producedQuantity = tile.getProduction(resource) * workForce.getNumberOfWorkers();
                totalProduction = totalProduction + producedQuantity;
            }
        }
        return totalProduction;
    }
View Full Code Here


        return (int) result;
    }

    public static int getCoordinateDefenceBonus(Realm realm, Coordinate coordinate) {
        int coordinateDefenceBonus = 0;
        Tile tile = realm.getTile(coordinate);
        coordinateDefenceBonus = tile.getType().getDefencePercentage();
        if (tile.getSettlement() != null) {
            coordinateDefenceBonus = coordinateDefenceBonus + tile.getSettlement().getDefenceModifier();
        }
        return coordinateDefenceBonus;
    }
View Full Code Here

            Coordinate currentCoordinate = new Coordinate(current.x, current.y);
            Enumeration<Coordinate> enumeration = Utility.getNeighborCoordinatesEnumeration(realm, currentCoordinate);
            while (enumeration.hasMoreElements()) {
                Coordinate coordinate = enumeration.nextElement();
                if (isValidLocation(unit, coordinate, ignoreOtherPlayers)) {
                    Tile tile = realm.getTile(coordinate);
                    float nextStepCost = current.cost + tile.getMovementCost();
                    Node neighbour = nodes[coordinate.getAbscissa()][coordinate.getOrdinate()];
                    if (nextStepCost < neighbour.cost) {
                        if (open.contains(neighbour)) {
                            open.remove(neighbour);
                        }
                        if (closed.contains(neighbour)) {
                            closed.remove(neighbour);
                        }
                    }
                    if (!open.contains(neighbour) && !(closed.contains(neighbour))) {
                        neighbour.cost = nextStepCost;
                        neighbour.heuristic = tile.getMovementCost();
                        maxDepth = Math.max(maxDepth, neighbour.setParent(current));
                        open.add(neighbour);
                        Collections.<Node>sort(open);
                    }
                }
View Full Code Here

            return false;
        }
        if (coordinate.getOrdinate() < 0) {
            return false;
        }
        Tile tile = realm.getTile(coordinate);
        if (tile == null) {
            return false;
        }

        if (!unit.getPlayer().isCoordinateExplored(coordinate)) {
            return false;
        }

        Move moveAbility = (Move) unit.getType().getAbility("Move");
        if (moveAbility == null) {
            return false;
        }

        if (!ignoreOtherPlayers && isTileBlockedByOtherPlayers(tile, unit)) {
            return false;
        }

        //TODO : Use set movement point instead of checking for roads
        TileImprovementType road = realm.getTileImprovementTypeManager().getImprovement("Road");
        if (tile.hasImprovement(road)) {
            return true;
        }

        if (!moveAbility.hasTileType(tile.getType())) {
            return false;
        }
        return true;
    }
View Full Code Here

TOP

Related Classes of org.freerealm.tile.Tile

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.