Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.Location


    }

    @Override
    public void loadTileFromSnapshot(Tile tile, Element tileNode) {
        if (tileNode.hasAttribute("bridge")) {
            Location loc =  Location.valueOf(tileNode.getAttribute("bridge"));
            tile.placeBridge(loc);
        }
    }
View Full Code Here


        }
        return img;
    }

    private void drawFeature(Graphics2D g2, Feature feature) {
        Location loc = feature.getRawLocation();
        //System.out.println(feature + " / " + loc);
        for (Location base : BASE_ROTATIONS) {
            Rotation rot = loc.getRotationOf(base);
            if (rot != null) {
                String path = feature.getClass().getSimpleName().toLowerCase();
                Image img = getImageResource("tiles/"+path+"/"+base.toString()+".png");
                g2.drawImage(img, rot.getAffineTransform(SIZE), null);
                break;
View Full Code Here

    @Override
    public void initTile(Tile tile, Element xml) {
        NodeList nl = xml.getElementsByTagName("flier");
        assert nl.getLength() <= 1;
        if (nl.getLength() == 1) {
            Location flier = XmlUtils.union(XmlUtils.asLocation((Element) nl.item(0)));
            tile.setFlier(flier);
        }
    }
View Full Code Here

        }
        return false;
    }

    public ImmutablePoint getMeeplePlacement(Tile tile, Class<? extends Feature> feature, Location location) {
        Location normalizedLoc = location.rotateCCW(tile.getRotation());
        FeatureDescriptor lookups[] = getLookups(tile, feature, normalizedLoc);
        ImmutablePoint point = null;
        for (FeatureDescriptor fd : lookups) {
            point = points.get(fd);
            if (point != null) break;
View Full Code Here

//    Stroke oldStroke = g2.getStroke();
//    g2.setStroke(new BasicStroke(getSquareSize() * 0.015f));
        for (Entry<Tile, Location> entry : bridges.entrySet()) {
            //devel code only - use image instead
            Tile tile = entry.getKey();
            Location loc = entry.getValue();
            Position pos = tile.getPosition();
            Area a = getClient().getResourceManager().getBridgeArea(tile, getSquareSize(), loc);
            a.transform(AffineTransform.getTranslateInstance(getOffsetX(pos), getOffsetY(pos)));
            g2.setColor(Color.BLACK);
            g2.setComposite(BRIDGE_FILL_COMPOSITE);
View Full Code Here

    @Override
    public void enter() {
        int distance = flierCap.getFlierDistance();
        Tile origin = game.getCurrentTile();
        Location direction = origin.getFlier().rotateCW(origin.getRotation());
        Position pos = game.getCurrentTile().getPosition();
        for (int i = 0; i < distance; i++) {
            pos = pos.add(direction);
        }
        Tile target = getBoard().get(pos);
View Full Code Here

        }
    }

    private List<Feature> getReachableFeatures() {
        List<Feature> result = new ArrayList<>();
        Location direction = getTile().getFlier().rotateCW(getTile().getRotation());
        Position pos = getTile().getPosition();
        for (int i = 0; i < 3; i++) {
            pos = pos.add(direction);
            Tile target = getBoard().get(pos);
            if (target != null) {
View Full Code Here

        substractBridge(subsRoadCity, tile);
        Area subsFarm = getFarmSubstractions(tile);

        for (Feature piece : tile.getFeatures()) {
            boolean aliasAbbot = false;
            Location loc = piece.getLocation();
            if (loc == Location.CLOISTER && locations.contains(Location.ABBOT)) {
                aliasAbbot = true;
            }
            if (!aliasAbbot && !locations.contains(loc)) {
                continue;
View Full Code Here

    @Override
    public void loadFromSnapshot(Document doc, Element node) {
        NodeList nl = node.getElementsByTagName("wagon");
        for (int i = 0; i < nl.getLength(); i++) {
            Element wg = (Element) nl.item(i);
            Location loc = Location.valueOf(wg.getAttribute("loc"));
            Position pos = XmlUtils.extractPosition(wg);
            int playerIndex = Integer.parseInt(wg.getAttribute("player"));
            Player player = game.getPlayer(playerIndex);
            scoredWagons.put(player, getBoard().get(pos).getFeature(loc));
        }
View Full Code Here

        nl = node.getElementsByTagName("castle");
        for (int i = 0; i < nl.getLength(); i++) {
            Element castleEl = (Element) nl.item(i);
            Position pos = XmlUtils.extractPosition(castleEl);
            Location loc = Location.valueOf(castleEl.getAttribute("location"));
            Castle castle = convertCityToCastle(pos, loc, true);
            boolean isNew = XmlUtils.attributeBoolValue(castleEl, "new");
            boolean isCompleted = XmlUtils.attributeBoolValue(castleEl, "completed");
            if (isNew) {
                newCastles.add(castle);
View Full Code Here

TOP

Related Classes of com.jcloisterzone.board.Location

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.