#author("2017-07-02T15:47:18+09:00","","")
*インフレーション [#f63c5102]
**インフレの計算式 [#x4fd28c8]
インフレ率 = [iTurns] x [m] + [iTurns] x ([iTurns] -1) x [m] x [m] / 200

-[iTurns] = ターン数&br;= min(最大ターン数 , (表示ターン数 + 経過ターン数) / 2) + ゲーム速度のターン数補正
-[m] = インフレ倍率&br;= ゲーム速度のインフレ倍率 / 100 x 難易度のインフレ倍率 / 100 x (ランダムイベントによるインフレ倍率 + [a]) / 100
--[a] = AIインフレ補正&br;= 難易度のAIインフレ補正 x (難易度のAIの時代ごとインフレ補正 x 現在の時代 + 100) / 100

 最大ターン数:何ターン経過すると終わるかの最大値で、先の時代から始めると小さくなる
 表示ターン数:右上に表示されるターン数で、先の時代から始めると増加した状態で始まる
 経過ターン数:ゲームスタートからのターン数で、先の時代から始めても1からカウント
 ゲーム速度のターン数補正:増加し始めるまでに余裕を持たせるための補正で、CIV4GameSpeedInfo.xmlの<iInflationOffset>(速度標準で-90%)

 ゲーム速度のインフレ倍率:CIV4GameSpeedInfo.xmlの<iInflationPercent>(速度標準で30%)
 難易度のインフレ倍率:CIV4HandicapInfo.xmlの<iInflationPercent>
 ランダムイベントによるインフレ倍率:ランダムイベントによってインフレが増減したときの補正

 難易度のAIインフレ補正:CIV4HandicapInfo.xmlの<iAIInflationPercent>
 難易度のAIの時代ごと補正:CIV4HandicapInfo.xmlの<iAIPerEraModifier>
 現在の時代:太古 = 1から未来 = 7まで、時代が一つ進む毎に+1

 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;
}



*コメント [#bb7dffed]
#pcomment(reply)



トップ   編集 差分 バックアップ 添付 複製 ページ名変更 リロード   新規 ページ一覧 単語検索 最終更新   スマホ版表示に変更   最終更新のRSS