public void SetBuildingTileAt(Vector2 position, string buildingType)
        {
            BuildingTile building = new BuildingTile(buildingType);

            int stoneCost = building.StoneCost;
            if (tilesManager.HasTile(BuildingTypes.StoneCarver) && stoneCost > 0)
                stoneCost--;

            int woodCost = building.WoodCost;
            if (tilesManager.HasTile(BuildingTypes.Carpenter) && woodCost > 0)
                woodCost--;

            Wood -= woodCost;
            Stone -= stoneCost;
            Veg -= building.VegCost;
            Grain -= building.GrainCost;
            Ore -= building.OreCost;
            Food -= building.FoodCost;
            if (buildingType == BuildingTypes.WeavingParlour)
            {
                Food += Sheep;
            }
            if (buildingType == BuildingTypes.MilkingParlour)
            {
                Food += Cows;
            }
            if (buildingType == BuildingTypes.Blacksmith)
            {
                Ore += 2;
            }
            if (buildingType == BuildingTypes.StoneCarver)
            {
                Stone += 2;
            }
            if (buildingType == BuildingTypes.WoodSupplier)
            {
                AddRoundBonuses(RoundBonusTypes.Wood, 7);
            }
            if (buildingType == BuildingTypes.StoneSupplier)
            {
                AddRoundBonuses(RoundBonusTypes.Stone, 5);
            }
            if (buildingType == BuildingTypes.RubySupplier)
            {
                AddRoundBonuses(RoundBonusTypes.Ruby, 4);
            }
            if (buildingType == BuildingTypes.Miner)
            {
                AddRoundBonuses(RoundBonusTypes.DonkeyOre, 11);
            }

            tilesManager.SetBuildingTileAt(_serverSocket, position, buildingType);

            CalculatePlayerScore();

            if (building.HasAction)
                _serverSocket.SetPlayerTileActive(ID, position);
        }
        public bool CanAffordAndPlaceBuilding(BuildingTile buildingTile)
        {
            int stoneCost = buildingTile.StoneCost;
            if (tilesManager.HasTile(BuildingTypes.StoneCarver) && stoneCost > 0)
                stoneCost--;

            int woodCost = buildingTile.WoodCost;
            if (tilesManager.HasTile(BuildingTypes.Carpenter) && woodCost > 0)
                woodCost--;

            return (Wood >= woodCost &&
                    Stone >= stoneCost &&
                    Veg >= buildingTile.VegCost &&
                    Grain >= buildingTile.GrainCost &&
                    Ore >= buildingTile.OreCost &&
                    Food >= buildingTile.FoodCost &&
                    tilesManager.HasCavern());
        }
 public int GetBuildingPoints()
 {
     int buildingPoints = 0;
     for (int x = 0; x < TileAreaWidth; x++)
     {
         for (int y = 0; y < TileAreaHeight; y++)
         {
             //normal building points
             if (Array.Find(typeof(BuildingTypes).GetFields(), f => f.GetValue(null).ToString() == CaveSpaces[x, y]) != null)
                 buildingPoints += new BuildingTile(CaveSpaces[x, y]).VP;
         }
     }
     return buildingPoints;
 }