T-hawk
Transcend
I recently did a code dive to figure this out, so enjoy. Here is the formula for cash earned when you capture a city. (It's variously called pillage gold or conquer gold; the code calls it capture gold.)
(20 + 10 × pop + rand(1..50) + rand(1..50)) × TurnsOwned/50
The first part of the formula is the full value. Then multiply it by X/50 where X is the number of turns the current owner has controlled the city, max 50. So you get full value after 50 turns, or proportionally less before that, which comes to -2% for each turn less than 50.
It does not appear to scale for game speed.
In the code, all those numbers are actually values from GlobalDefines.xml:
Here's the code, from Beyond the Sword\Assets\Python\CvGameUtils.py :
(20 + 10 × pop + rand(1..50) + rand(1..50)) × TurnsOwned/50
The first part of the formula is the full value. Then multiply it by X/50 where X is the number of turns the current owner has controlled the city, max 50. So you get full value after 50 turns, or proportionally less before that, which comes to -2% for each turn less than 50.
It does not appear to scale for game speed.
In the code, all those numbers are actually values from GlobalDefines.xml:
Code:
<DefineName>BASE_CAPTURE_GOLD</DefineName>
<iDefineIntVal>20</iDefineIntVal>
<DefineName>CAPTURE_GOLD_PER_POPULATION</DefineName>
<iDefineIntVal>10</iDefineIntVal>
<DefineName>CAPTURE_GOLD_RAND1</DefineName>
<iDefineIntVal>50</iDefineIntVal>
<DefineName>CAPTURE_GOLD_RAND2</DefineName>
<iDefineIntVal>50</iDefineIntVal>
<DefineName>CAPTURE_GOLD_MAX_TURNS</DefineName>
<iDefineIntVal>50</iDefineIntVal>
Here's the code, from Beyond the Sword\Assets\Python\CvGameUtils.py :
Code:
def doCityCaptureGold(self, argsList):
iCaptureGold = 0
iCaptureGold += gc.getDefineINT("BASE_CAPTURE_GOLD")
iCaptureGold += (pOldCity.getPopulation() * gc.getDefineINT("CAPTURE_GOLD_PER_POPULATION"))
iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND1"), "Capture Gold 1")
iCaptureGold += CyGame().getSorenRandNum(gc.getDefineINT("CAPTURE_GOLD_RAND2"), "Capture Gold 2")
if (gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS") > 0):
iCaptureGold *= cyIntRange((CyGame().getGameTurn() - pOldCity.getGameTurnAcquired()), 0, gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS"))
iCaptureGold /= gc.getDefineINT("CAPTURE_GOLD_MAX_TURNS")
return iCaptureGold