2. REF growth
The growth of REF is depending on the amount of accumulated Liberty Bells.
At the beginning of each colonial player's turn, the King will add some units to REF, if the following conditions are satisfied.
a. not in Revolution
b. the amount of accumulated Liberty Bells >= revolutionEuropeUnitThreshold
c. one of cities of this player yields at least 1 Liberty Bell
When the King is alarmed at the Rebel Sentiment in the colony, he will add some units to REF, i.e. the following actions will be executed one by one.
a. deduct revolutionEuropeUnitThreshold Liberty Bells from accumulated Liberty Bells
b. update RevolutionEuropeUnitThresholdMultiplier
c. determine the unitclass of the units added by the King
d. use the updated RevolutionEuropeUnitThresholdMultiplier to determine the number of the units added by the King
e. add units to REF
Spoiler for SDK CvPlayer::doBells():
void CvPlayer::doBells()
{
if (getParent() == NO_PLAYER)
{
return;
}
int iBellsRate = getYieldRate(YIELD_BELLS);
if (iBellsRate == 0)
{
return;
}
//add bells to political points
for (int i = 0; i < GC.getNumFatherPointInfos(); ++i)
{
FatherPointTypes ePointType = (FatherPointTypes) i;
changeFatherPoints(ePointType, iBellsRate * GC.getFatherPointInfo(ePointType).getYieldPoints(Y IELD_BELLS));
}
//update revolution unit bells
if (!isInRevolution())
{
changeBellsStored(iBellsRate);
if (getBellsStored() >= revolutionEuropeUnitThreshold() && iBellsRate > GC.getCivilizationInfo(getCivilizationType()).getF reeYields(YIELD_BELLS))
{
changeBellsStored(-revolutionEuropeUnitThreshold());
setRevolutionEuropeUnitThresholdMultiplier((getRev olutionEuropeUnitThresholdMultiplier() * (100 + GC.getDefineINT("REVOLUTION_EUROPE_UNIT_THRESHOLD_ INCREASE"))) / 100);
if (NO_PLAYER != getParent())
{
CvPlayer& kParent = GET_PLAYER(getParent());
FAssert(kParent.isEurope());
CvCivilizationInfo& kCivilizationInfo = GC.getCivilizationInfo(kParent.getCivilizationType ());
int iNumFreeUnits = kCivilizationInfo.getNumCivilizationFreeUnits();
std::vector<int> aiUnitWeights(iNumFreeUnits, 100);
for (int i = 0; i < iNumFreeUnits; ++i)
{
int iUnitClass = kCivilizationInfo.getCivilizationFreeUnitsClass(i) ;
UnitTypes eUnit = (UnitTypes) kCivilizationInfo.getCivilizationUnits(iUnitClass) ;
if (eUnit == NO_UNIT)
{
aiUnitWeights[i] = 0;
}
else
{
if (GC.getUnitInfo(eUnit).getDomainType() == DOMAIN_SEA)
{
aiUnitWeights[i] += std::max(-100, GC.getDefineINT("REVOLUTION_EUROPE_UNIT_SHIP_MODIF IER"));
}
}
}
if (iNumFreeUnits > 0)
{
int iIndex = GC.getGameINLINE().getSorenRand().pickValue(aiUnit Weights, "Pick Expeditionary force unit");
int iUnitClass = kCivilizationInfo.getCivilizationFreeUnitsClass(iI ndex);
ProfessionTypes eUnitProfession = (ProfessionTypes) kCivilizationInfo.getCivilizationFreeUnitsProfessi on(iIndex);
UnitTypes eUnit = (UnitTypes)kCivilizationInfo.getCivilizationUnits( iUnitClass);
FAssert(eUnit != NO_UNIT);
int iNumUnits = std::max(1, getRevolutionEuropeUnitThresholdMultiplier() / 100);
for (int i = 0; i < iNumUnits; ++i)
{
addRevolutionEuropeUnit(eUnit, eUnitProfession);
}
3. Sources of accumulated Liberty Bells
There are two ways to accumulate Liberty Bells
a. Liberty Bells yielded by your cities
Spoiler for SDK CvPlayer::getYieldRate(YieldTypes eIndex):
int CvPlayer::getYieldRate(YieldTypes eIndex) const
{
FAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");
FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex is expected to be within maximum bounds (invalid Index)");
if (getNumCities() == 0)
{
return 0;
}
int iTotalRate = GC.getCivilizationInfo(getCivilizationType()).getF reeYields(eIndex);
int iLoop;
for (CvCity* pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
iTotalRate += pLoopCity->calculateNetYield(eIndex);
}
return iTotalRate;
}
b. the gold you paid for purchasing Veteran Soldiers or Cannons from the King
Both exchange rates are 1:1.
For example, you paid 750 gold for the first Veteran Soldier from the King, then the amount of accumulated Liberty Bells increased 750.
4. Explanation on revolutionEuropeUnitThreshold and RevolutionEuropeUnitThresholdMultiplier
(1) RevolutionEuropeUnitThresholdMultiplier
The initial value of RevolutionEuropeUnitThresholdMultiplier is 100.
The game updates your RevolutionEuropeUnitThresholdMultiplier when and only when the King adds units to REF.
The formula is: (new RevolutionEuropeUnitThresholdMultiplier) = (old RevolutionEuropeUnitThresholdMultiplier) * 110%
Suppose GameSpeed = Normal and player = Human, the formula can be simplified to revolutionEuropeUnitThreshold = 75 * RevolutionEuropeUnitThresholdMultiplier / 100 * iAITrainPercent / 100
Spoiler for SDK CvPlayer::revolutionEuropeUnitThreshold():
int CvPlayer::revolutionEuropeUnitThreshold() const
{
int iThreshold = ((GC.getDefineINT("REVOLUTION_EUROPE_UNIT_THRESHOL D") * std::max(0, (getRevolutionEuropeUnitThresholdMultiplier()))) / 100);
5. The number and unitclass of incremental REF
(1) The number of the units added by the King = [(updated RevolutionEuropeUnitThresholdMultiplier) / 100]
(2) The unitclass of the units added by the King is randomly chosen from Regulars, Regular Dragoons, Artillery and Man-o-War. Each unitclass' weight is equal to its initial REF unit number. Moreover, navy unitclass suffers -50% penalties.
Therefore, the probability w.r.t. Regulars, Regular Dragoons, Artillery and Man-o-War is 4/9, 2/9, 2/9 and 1/9.
6. Exchange rate between accumulated Liberty Bells and REF units
We still assume GameSpeed = Normal and player = Human.
For convenience, we ignore the rounding in calculation.
(RevolutionEuropeUnitThresholdMultiplier * 110% / 100) REF units = (75 * RevolutionEuropeUnitThresholdMultiplier / 100 * iAITrainPercent / 100) accumulated Liberty Bells
Therefore, the exchange rate between accumulated Liberty Bells and REF units is approximate equal to
Pilgrim: 109.1
Pioneer: 75
Explorer: 68.2
Conquistador: 61.4
Governor: 51.1
Patriot: 40.9
Revolutionary: 34.1
Corollary: It is harmful to purchase units from Kings, though they are much cheaper.
Appendix: REF growth reference table
Multiplier = updated RevolutionEuropeUnitThresholdMultiplier
Units = the number of the units added by the King
Total Units = size of REF
Difficulty = revolutionEuropeUnitThreshold = Liberty Bells needed to make REF grow