if GameStart
{
if goody hut -> zero value
if any plots off the edge of the map -> zero value
}
if count the number of plots which we cannot use (off map or another team) > 7 -> zero value
iBadTile = 0;
count bad plots:
if plot is off map, or a peak, count as 1
if plot is not hills and not directly connected to fresh water (river/lake)
if zero food or one food and nothing else, count as 1
else if ocean and not coastal city and food less 2, count as 1/2
else if plot owned by a city in our team, count as 1/2
if not GameStart
{
if bad plots > 10
{
check all the unowned plots that are either water or on the same land mass as the city
is there a bonus resource which we do not already have, or which scores higher than 10?
if not -> zero value, quit
}
}
iGreed = 100;
if not GameStart
{
if hasTrait UpkeepModifier (Organized)
iGreed -= 25 [actually +UpkeepModifier/2]
if hasTrait CultureChange (Creative)
iGreed += 40 [actually CommerceChange * 20]
}
iTakenTiles = 0;
iTeammateTakenTiles = 0;
iHealth = 0;
iSpecialFoodPlus = 0;
iResourceValue = 0;
iSpecialFood = 0;
iSpecialFoodPlus = 0;
iSpecialFoodMinus = 0;
iSpecialProduction = 0;
iSpecialCommerce = 0;
value = 1000;
for each plot
{
if off map, iTakenTiles++
if within another city radius, iTakenTiles++
if within our team's city radius, iTeammateTakenTiles++;
else
{
determine food/production/commerce yield of the plot
(adjusting the city home plot negative the value of the improvement of a bonus resource, if trying to found on one)
tempValue = 0
if city home plot
tempValue = 60*food + 60*production +40*commerce
else if food >= 2
tempValue = 40*food + 40*production +30*commerce
if GameStart tempValue *= 2
else if food == 1
tempValue = 25*food + 25*production +20*commerce
else
tempValue = 15*food + 15*production +10*commerce
if coastal city and this plot water and this plot commerce > 1
tempValue += 40
if this plot borders river
tempValue += 10
if home plot
tempValue *= 2
else if this plot already in our culture, or within 1 distance of home
tempValue *= 3/2
else
tempValue *= iGreed/100
value += tempValue
if this plot has forest or jungle (and not home plot)
iHealth += health of feature
iSpecialFoodPlus += any food over 2 on this plot
if this plot has a bonus resource
{
if not GameStart and this the first bonus of this type for this city
tempValue = bonusValue() * 80
else
tempValue = bonusValue() * 20
tempValue *= iGreed/100
if plot distance 2 from home and our culture not already on it
tempValue *= 2/3 * iGreed/100
value += tempValue
if not home plot
{
if an improvement exists for this bonus resource
{
iSpecialFood += food after bonus improved
iSpecialFoodPlus += any food over 2 after improved (zero if less than 3)
iSpecialFoodPlus -= any food under 2 after improved (zero if more than 1)
iSpecialProduction += production after improved
iSpecialCommerce += commerce after improved
}
if jungle, iResourceValue -= 30
if water bonus resource
if coastal, value += 150
else value -= 150
}
}
}
}
iResourceValue += iSpecialFood * 50
iResourceValue += iSpecialProduction * 50
iResourceValue += iSpecialCommerce * 50
if (iResourceValue > 0)
value += iResourceValue
if (iTakenTiles > 7) and (iResourceValue < 250), zero value, quit
if iTeammateTakenTiles > 1, zero value, quit
value += (iHealth / 5)
if coastal city
{
value += 300
if not GameStart
{
if we have no other cities on this land mass
value += 400
value += 200
}
}
if city home plot is hills
value += 200
if city home plot has river
value += 40
if city home plot has fresh water
value += 100 [really uses the define for health change from fresh water]
if GameStart
for every plot within 5 distance
value += 10*food + 10*production + 5* commerce
if first starting city assigned
value += max distance on map * 100
else
value += distance to closest other start city * 100
if (distance to our nearest city) < 5
value -= (5 - (distance to our nearest city)) * 500
else
value -= ((distance to our nearest city) - 5) * 500
if number of cities on land mass is zero
value *= 2
else if every city on land mass is our team
value *= 3/2
else if every city on land mass is our team or barbarians
value *= 4/3
else if our team has zero cities on land mass
value *= 5/4
if iSpecialFoodPlus > 8
iSpecialFoodPlus = 8
value *= (100 + (20*iSpecialFoodPlus))
value /= (100 + (10*iSpecialFoodMinus))
value /= (num bad plots over 5) + 3
if Gamestart
value /= (num plots on different land mass over 14) + 2