Skip to content

Commit

Permalink
Add alignment bonus for having same master
Browse files Browse the repository at this point in the history
Fix build error
  • Loading branch information
RecursiveVision committed Dec 16, 2024
1 parent ca65e5e commit 3f6eca5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48132,7 +48132,7 @@ int CvDiplomacyAI::GetVassalTaxScore(PlayerTypes ePlayer)
int iOpinionWeight = 0;

int iGoldTaxedSinceVassalStarted = GetVassalGoldPerTurnTaxedSinceVassalStarted(ePlayer);
int iPercentTaxed = iGoldTaxedSinceVassalStarted * 100 / max(iGoldCollectedSinceVassalStarted, 1);
int iPercentTaxed = iGoldTaxedSinceVassalStarted * 100 / max(GetVassalGoldPerTurnCollectedSinceVassalStarted(ePlayer), 1);

// Opinion weight from how much % we've taxed them
iOpinionWeight = ((int) pow((float)iPercentTaxed, /*1.5f*/ GD_FLOAT_GET(OPINION_WEIGHT_VASSAL_TAX_EXPONENT))) / max(/*4*/ GD_INT_GET(OPINION_WEIGHT_VASSAL_TAX_DIVISOR), 1);
Expand Down
14 changes: 14 additions & 0 deletions CvGameCoreDLL_Expansion2/CvVotingClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10985,6 +10985,20 @@ CvLeagueAI::AlignmentLevels CvLeagueAI::EvaluateAlignment(PlayerTypes ePlayer, b
{
iAlignment -= 1;
}

// Vassals of same master?
TeamTypes eMyTeam = GetPlayer()->getTeam();
TeamTypes eTheirTeam = GET_PLAYER(ePlayer).getTeam();
TeamTypes eMaster = GET_TEAM(eMyTeam).GetMaster();
if (eMaster != NO_TEAM && GET_TEAM(eTheirTeam).GetMaster() == eMaster)
{
bool bWeAreVoluntary = GET_TEAM(eMyTeam).IsVoluntaryVassal(eMaster);
bool bTheyAreVoluntary = GET_TEAM(eTheirTeam).IsVoluntaryVassal(eMaster);
if ((bWeAreVoluntary && bTheyAreVoluntary) || (!bWeAreVoluntary && !bTheyAreVoluntary))
iAlignment += 4;
else
iAlignment += 2;
}
}

// Encourage bloc formation
Expand Down

0 comments on commit 3f6eca5

Please sign in to comment.