Package com.jcloisterzone

Examples of com.jcloisterzone.Player


    private void paintFigureHighlight(Graphics2D g2) {
        //ugly copy pasted code from Meeple but uncached here
        g2.setComposite(FIGURE_HIGHLIGHT_AREA_ALPHA_COMPOSITE);
        Tile tile = getGame().getBoard().get(selectedPosition);
        ImmutablePoint point = getClient().getResourceManager().getMeeplePlacement(tile, SmallFollower.class, selectedLocation);
        Player p = getGame().getActivePlayer();
        Image unscaled = getClient().getFigureTheme().getFigureImage(SmallFollower.class, p.getColors().getMeepleColor(), null);
        int size = (int) (getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO);
        Image scaled = unscaled.getScaledInstance(size, size, Image.SCALE_SMOOTH);
        scaled = new ImageIcon(scaled).getImage();
        ImmutablePoint scaledOffset = point.scale(getSquareSize(), (int)(getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO));
        g2.drawImage(scaled, getOffsetX(selectedPosition) + scaledOffset.getX(), getOffsetY(selectedPosition) + scaledOffset.getY(), gridPanel);
View Full Code Here


        g2.drawImage(scaled, getOffsetX(selectedPosition) + scaledOffset.getX(), getOffsetY(selectedPosition) + scaledOffset.getY(), gridPanel);
    }

    /** standard highlight **/
    private void paintAreaHighlight(Graphics2D g2) {
        Player p = getGame().getActivePlayer();
        if (p.equals(player)) { //sync issue
            g2.setColor(p.getColors().getMeepleColor());
            g2.setComposite(AREA_ALPHA_COMPOSITE);
            g2.fill(transformArea(areas.get(selectedLocation), selectedPosition));
        }
    }
View Full Code Here

    @Override
    public void moveDragon(Position p) {
        if (!dragonCap.getAvailDragonMoves().contains(p)) {
            throw new IllegalArgumentException("Invalid dragon move.");
        }
        Player player = getActivePlayer();
        Position fromPosition = dragonCap.getDragonPosition();
        dragonCap.moveDragon(p);
        for (Meeple m : game.getDeployedMeeples()) {
            if (m.at(p) && m.canBeEatenByDragon()) {
                m.undeploy();
View Full Code Here

        Road road = (Road) getBoard().get(p).getFeature(loc);
        if (!road.isTunnelOpen()) {
            throw new IllegalStateException("No open tunnel here.");
        }
        placedTunnelCurrentTurn = road;
        Player player = game.getActivePlayer();
        placeTunnelPiece(road, player, p, loc, isB);
    }
View Full Code Here

            Road road = (Road) getBoard().get(pos).getFeature(loc);
            if (!road.isTunnelEnd()) {
                logger.error("Tunnel end does not exist.");
                continue;
            }
            Player player = game.getPlayer(Integer.parseInt(el.getAttribute("player")));
            boolean isB = "yes".equals(el.getAttribute("b"));
            placeTunnelPiece(road, player, pos, loc, isB);
        }
    }
View Full Code Here

    }

    @Override
    public void prepareActions(List<PlayerAction<?>> actions, Set<FeaturePointer> followerOptions) {
        FairyAction fairyAction = new FairyAction();
        Player activePlayer = game.getActivePlayer();
        for (Follower m : Iterables.filter(activePlayer.getFollowers(), MeeplePredicates.deployed())) {
            if (!m.at(fairyPosition)) {
                fairyAction.add(m.getPosition());
            }
        }
        if (!fairyAction.isEmpty()) {
View Full Code Here

    public void payRansom(Integer playerIndexToPay, Class<? extends Follower> meepleType) {
        if (ransomPaidThisTurn) {
            throw new IllegalStateException("Ransom alreasy paid this turn");
        }
        Player opponent = game.getAllPlayers()[playerIndexToPay];

        Iterator<Follower> i = prisoners.get(opponent).iterator();
        while (i.hasNext()) {
            Follower meeple = i.next();
            if (meepleType.isInstance(meeple)) {
                i.remove();
                meeple.clearDeployment();
                opponent.addPoints(RANSOM_POINTS, PointCategory.TOWER_RANSOM);
                ransomPaidThisTurn = true;
                game.getActivePlayer().addPoints(-RANSOM_POINTS, PointCategory.TOWER_RANSOM);
                game.post(new MeeplePrisonEvent(meeple, opponent, null));
                game.getPhase().notifyRansomPaid();
                return;
View Full Code Here

            }
        }
        nl = node.getElementsByTagName("player");
        for (int i = 0; i < nl.getLength(); i++) {
            Element playerEl = (Element) nl.item(i);
            Player player = game.getPlayer(Integer.parseInt(playerEl.getAttribute("index")));
            towerPieces.put(player, Integer.parseInt(playerEl.getAttribute("pieces")));
            NodeList priosonerNl = playerEl.getElementsByTagName("prisoner");
            for (int j = 0; j < priosonerNl.getLength(); j++) {
                Element prisonerEl = (Element) priosonerNl.item(j);
                int ownerIndex = XmlUtils.attributeIntValue(prisonerEl, "player");
View Full Code Here

        List<Player> players = new ArrayList<>();
        NodeList nl = getSecondLevelElelents("players", "player");
        for (int i = 0; i < nl.getLength(); i++) {
            Element el = (Element) nl.item(i);
            PlayerSlot slot = new PlayerSlot(Integer.parseInt(el.getAttribute("slot")));
            Player p = new Player(el.getAttribute("name"), i, slot);
            p.setPoints(Integer.parseInt(el.getAttribute("points")));
            if (el.hasAttribute("ai-class")) {
                String aiClassName = el.getAttribute("ai-class");
                slot.setAiClassName(aiClassName);
            } else {
                if (el.hasAttribute("local")) {
                    slot.setState(SlotState.OWN);
                }
            }
            NodeList categories = el.getElementsByTagName("point-category");
            for (int j = 0; j < categories.getLength(); j++) {
                Element catEl = (Element) categories.item(j);
                PointCategory cat = PointCategory.valueOf(catEl.getAttribute("name"));
                p.setPointsInCategory(cat, Integer.parseInt(catEl.getAttribute("points")));
            }
            players.add(p);
        }
        return players;
    }
View Full Code Here

            roseRotation = tile.getRotation();
            rosePosition = tile.getPosition();
        } else {
            rose = rose.rotateCW(roseRotation);
            if (isInProperQuadrant(rose, tile.getPosition())) {
                Player p = game.getActivePlayer();
                p.addPoints(WIND_ROSE_POINTS, PointCategory.WIND_ROSE);
                game.post(new ScoreEvent(tile.getPosition(), p, WIND_ROSE_POINTS, PointCategory.WIND_ROSE));
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.Player

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.