Beispiel #1
0
        /**
         *  Add condition:
         *      Must have either a road or a settlement with matching player.
         */
        public void buildRoad(Player currentPlayer, bool takeResources)
        {
            if (owningPlayer != null)
            {
                throw new BuildError(BuildError.LocationOwnedBy(owningPlayer));
            }

            if (takeResources && !Bank.hasPayment(currentPlayer, Bank.ROAD_COST))
            {
                throw new BuildError(BuildError.NOT_ENOUGH_RESOURCES);
            }

            if (!checkForConnection(currentPlayer))
            {
                throw new BuildError(BuildError.NO_CONNECTED_ROAD);
            }


            this.owningPlayer = currentPlayer;
            //this.BackColor = currentPlayer.getPlayerColor();
            currentPlayer.addRoad(this);
            this.Refresh();
        }