Package com.jcloisterzone.figure

Source Code of com.jcloisterzone.figure.Builder

package com.jcloisterzone.figure;

import com.jcloisterzone.Player;
import com.jcloisterzone.feature.City;
import com.jcloisterzone.feature.Feature;
import com.jcloisterzone.feature.Road;
import com.jcloisterzone.feature.visitor.IsOccupoedAndUncompleted;
import com.jcloisterzone.game.Game;

public class Builder extends Special {

    private static final long serialVersionUID = 1189566966196473830L;

    public Builder(Game game, Player player) {
        super(game, player);
    }

    @Override
    public DeploymentCheckResult isDeploymentAllowed(Feature f) {
        if (!(f instanceof City || f instanceof Road) ) {
            return new DeploymentCheckResult("Builder must be placed in city or on road only.");
        }
        if (!f.walk(new IsOccupoedAndUncompleted().with(Follower.class))) {
            return new DeploymentCheckResult("Feature is not occupied by follower or completed.");
        }
        return super.isDeploymentAllowed(f);
    }

}
TOP

Related Classes of com.jcloisterzone.figure.Builder

TOP
Copyright © 2018 www.massapi.com. 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.