예제 #1
0
void CK2Character::setStateStats()
{
	// start with regent's stats or mine
	if (regent != NULL)
		memcpy(stateStats, regent->getStats(), 5*sizeof(int));
	else
		memcpy(stateStats, stats, 5*sizeof(int));

	// add 1/2 of primary spouse's stats
	CK2Character* spouse = getPrimarySpouse();
	if (spouse != NULL)
	{
		for (int i = 0; i < 5; ++i)
			stateStats[i] += spouse->getStats()[i] / 2;
	}

	// add relevant advisors
	for (int i = 0; i < 5; ++i)
	{
		if (advisors[i] != NULL)
			stateStats[i] += advisors[i]->getStats()[i];
	}
}
예제 #2
0
int CK2Character::getDemesneCap(CK2Version& version) const
{
	// http://forum.paradoxplaza.com/forum/showthread.php?584969-What-are-the-high-and-low-bound-demense-limits-for-different-ranks-authority-tech&p=13429280&viewfull=1#post13429280

	int rulerTier = 0;
	if (primaryTitleString.substr(0, 2) == "b_")
		rulerTier = 1;
	else if (primaryTitleString.substr(0, 2) == "c_")
		rulerTier = 2;
	else if (primaryTitleString.substr(0, 2) == "d_")
		rulerTier = 3;
	else if (primaryTitleString.substr(0, 2) == "k_")
		rulerTier = 4;
	else if (primaryTitleString.substr(0, 2) == "e_")
		rulerTier = 5;
	if (rulerTier == 0) // not a ruler - no demesne
		return 0;

	double stewardshipBonus = stats[STEWARDSHIP];
	CK2Character* spouse = getPrimarySpouse();
	if (spouse)
		stewardshipBonus += floor(spouse->getStats()[STEWARDSHIP] / 2.0);
	stewardshipBonus /= 4.0;

	double successionFactor = 1.0;
	if (primaryTitle->getSuccessionLaw() == "gavelkind")
		successionFactor = 1.3;

	int legalismBonus = 0;
	double legalismTech;
	if (CK2Version("1.10") > version)
	{
		legalismTech = capital->getTechLevels()[TECH_LEGALISM_OLD];
	}
	else
	{
		legalismTech = capital->getTechLevels()[TECH_LEGALISM];
	}
	if (legalismTech >= 1.0)
	{
		if (rulerTier >= 2)
			legalismBonus++;
	}
	if (legalismTech >= 2.0)
	{
		if (rulerTier == 1 || rulerTier >= 3)
			legalismBonus++;
	}
	if (legalismTech >= 3.0)
	{
		if (rulerTier == 2 || rulerTier >= 4)
			legalismBonus++;
	}
	if (legalismTech >= 4.0)
	{
		if (rulerTier >= 3)
			legalismBonus++;
	}
	if (legalismTech >= 5.0)
	{
		if (rulerTier == 5)
			legalismBonus++;
	}
	
	return (int)(floor( (rulerTier + stewardshipBonus) * successionFactor) + legalismBonus);
}