Skip to content

Commit

Permalink
Block Voluntary Vassalage if master can't DoW
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursiveVision committed Aug 30, 2024
1 parent 10f41c7 commit 5ba1797
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions (1) Community Patch/Core Files/Text/CoreText_en_US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3282,6 +3282,12 @@
<Row Tag="TXT_KEY_DIPLO_VASSALAGE_AND_INVALID_ITEM">
<Text>Not allowed if deal contains a Defensive Pact or Liberation.</Text>
</Row>
<Row Tag="TXT_KEY_DIPLO_VASSALAGE_YOU_DECLARE_WAR_REQUIRED">
<Text>They must be able to declare war on everyone who is currently at war with you!</Text>
</Row>
<Row Tag="TXT_KEY_DIPLO_VASSALAGE_THEM_DECLARE_WAR_REQUIRED">
<Text>You must be able to declare war on everyone who is currently at war with them!</Text>
</Row>
<Row Tag="TXT_KEY_DIPLO_VASSAL_REVOKE_US_NO_VASSALS">
<Text>We have no vassals to liberate!</Text>
</Row>
Expand Down
38 changes: 38 additions & 0 deletions CvGameCoreDLL_Expansion2/CvDealClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,18 @@ bool CvDeal::IsPossibleToTradeItem(PlayerTypes ePlayer, PlayerTypes eToPlayer, T
if (ContainsItemType(TRADE_ITEM_DEFENSIVE_PACT) || ContainsItemType(TRADE_ITEM_VASSALAGE_REVOKE))
return false;

// Voluntary Vassalage only: the would-be master needs to be able to go to war with everyone currently at war with the vassal
if (!bPeaceDeal)
{
for (int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)
{
PlayerTypes eLoopPlayer = (PlayerTypes)iPlayerLoop;
TeamTypes eLoopTeam = GET_PLAYER(eLoopPlayer).getTeam();
if (pFromTeam->isAtWar(eLoopTeam) && !pToTeam->isAtWar(eLoopTeam) && !pToTeam->canDeclareWar(eLoopTeam, eToPlayer))
return false;
}
}

break;
}

Expand Down Expand Up @@ -2401,6 +2413,32 @@ CvString CvDeal::GetReasonsItemUntradeable(PlayerTypes ePlayer, PlayerTypes eToP
strTooltip += strReason;
}

// Voluntary Vassalage only: the would-be master needs to be able to go to war with everyone currently at war with the vassal
if (!bPeaceDeal)
{
for (int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)
{
PlayerTypes eLoopPlayer = (PlayerTypes)iPlayerLoop;
TeamTypes eLoopTeam = GET_PLAYER(eLoopPlayer).getTeam();
if (pFromTeam->isAtWar(eLoopTeam) && !pToTeam->isAtWar(eLoopTeam) && !pToTeam->canDeclareWar(eLoopTeam, eToPlayer))
{
if (bFromHuman)
{
strReason = GetLocalizedText("TXT_KEY_DIPLO_VASSALAGE_YOU_DECLARE_WAR_REQUIRED");
strTooltip += strDivider;
strTooltip += strReason;
}
else if (bToHuman)
{
strReason = GetLocalizedText("TXT_KEY_DIPLO_VASSALAGE_THEM_DECLARE_WAR_REQUIRED");
strTooltip += strDivider;
strTooltip += strReason;
}
break;
}
}
}

break;
}

Expand Down

0 comments on commit 5ba1797

Please sign in to comment.