インフレーション

計算式/インフレーション
Last-modified: 2011-01-20 20:01:14

インフレの計算式 †

インフレ率=ターン数[iTurns]*インフレ倍率[m]+ターン数[iTurns]*(ターン数[iTurns]-1)*インフレ倍率[m]*インフレ倍率[m]/200
ターン数[iTurns]=min(最大ターン数,(表示ターン数+経過ターン数)/2)+ゲーム速度のターン数補正
インフレ倍率[m]=ゲーム速度のインフレ倍率/100*難易度のインフレ倍率/100*(ランダムイベントによるインフレ倍率+AIインフレ補正[a])/100
AIインフレ補正[a]=難易度のAIインフレ補正*(難易度のAIの時代ごとインフレ補正*現在の時代+100)/100
min(A,B):AとBのどちらか小さい方の数字。
最大ターン数:何ターン経過すると終わるか。先の時代から始めると小さくなる。最大経過ターン数。
表示ターン数:右上に表示されるターン数。先の時代から始めると増加した状態で始まる。
経過ターン数:ゲームスタートからのターン数。先の時代から始めても1からカウント。
ゲーム速度のターン数補正:増加し始めるまでに余裕を持たせるための補正。速度標準で-90。CIV4GameSpeedInfo.xmlの<iInflationOffset>
ゲーム速度のインフレ倍率:速度標準で30。CIV4GameSpeedInfo.xmlの<iInflationPercent>
難易度のインフレ倍率:CIV4HandicapInfo.xmlの<iInflationPercent>
ランダムイベントによるインフレ倍率:ランダムイベントによってインフレが減少(増加)したときの補正。
難易度のAIインフレ補正:CIV4HandicapInfo.xmlの<iAIInflationPercent>
難易度のAIの時代ごと補正:CIV4HandicapInfo.xmlの<iAIPerEraModifier>
現在の時代:太古:1 古代:2 中世:3 ルネサンス:4 工業化時代:5 現代:6 未来:7
Spoiler for Beyond the Sword Inflation:

int CvPlayer::calculateInflationRate() const
{
	int iTurns = ((GC.getGameINLINE().getGameTurn() + GC.getGameINLINE().getElapsedGameTurns()) / 2);

	if (GC.getGameINLINE().getMaxTurns() > 0)
	{
		iTurns = std::min(GC.getGameINLINE().getMaxTurns(), iTurns);
	}

	iTurns += GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationOffset();

	if (iTurns <= 0)
	{
		return 0;
	}

	int iInflationPerTurnTimes10000 = GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent();
	iInflationPerTurnTimes10000 *= GC.getHandicapInfo(getHandicapType()).getInflationPercent();
	iInflationPerTurnTimes10000 /= 100;

	int iModifier = m_iInflationModifier;
	if (!isHuman() && !isBarbarian())
	{
		int iAIModifier = GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIInflationPercent();
		iAIModifier *= std::max(0, ((GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIPerEraModifier() * getCurrentEra()) + 100));
		iAIModifier /= 100;

		iModifier += iAIModifier - 100;
	}

	iInflationPerTurnTimes10000 *= std::max(0, 100 + iModifier);
	iInflationPerTurnTimes10000 /= 100;

	// Keep up to second order terms in binomial series
	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100;
	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000;

	FAssert(iRatePercent >= 0);

	return iRatePercent;
}

int CvPlayer::calculatePreInflatedCosts() const
{
	CyArgsList argsList;
	argsList.add(getID());
	long lResult;
	gDLL->getPythonIFace()->callFunction(PYGameModule, "getExtraCost", argsList.makeFunctionArgs(), &lResult);

	return (calculateUnitCost() + calculateUnitSupply() + getTotalMaintenance() + getCivicUpkeep() + (int)lResult);
} 

int CvPlayer::calculateInflatedCosts() const
{
	int iCosts;

	iCosts = calculatePreInflatedCosts();

	iCosts *= std::max(0, (calculateInflationRate() + 100));
	iCosts /= 100;

	return iCosts;
}