예제 #1
0
        public Target(PlayerModel p, TileCtrl t)
        {
            Player = p;
            Tile   = t;
            foreach (var building in Tile.OwnedBuilding)
            {
                if (building.BuildingState == BuildingState.Settlement)
                {
                    ResourcePotential++;
                }
                else if (building.BuildingState == BuildingState.City)
                {
                    ResourcePotential += 2;
                }
                else
                {
                    throw new Exception("This building shouldn't be owned");
                }
            }

            ResourcePotential *= Tile.Pips;

            if (ResourcePotential > 0)
            {
                //
                //  check to see if this player has 2:1 in a resource from this tile

                foreach (var harbor in Player.GameData.OwnedHarbors)
                {
                    if (StaticHelpers.HarborTypeToResourceType(harbor.HarborType) == Tile.ResourceType)
                    {
                        ResourcePotential *= 2;
                    }
                }
            }
        }