/// Possible Contact Statement - guy has his military positioned aggressively near us
void CvDiplomacyAI::DoAggressiveMilitaryStatement(PlayerTypes ePlayer, DiploStatementTypes& eStatement)
{
if (eStatement == NO_DIPLO_STATEMENT_TYPE)
{
// Don't bother if they've already made or broken a military promise to us
if (GetMilitaryPromiseState(ePlayer) > NO_PROMISE_STATE)
return;
// We must be able to declare war on each other - in both directions, since the promise is mutual
TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();
if (!GET_TEAM(eTeam).canDeclareWar(GetTeam(), ePlayer) || !GET_TEAM(GetTeam()).canDeclareWar(eTeam, GetID()))
return;
// They're HIGH or INCREDIBLE this turn
if (GetMilitaryAggressivePosture(ePlayer) < AGGRESSIVE_POSTURE_HIGH)
return;
// AI teammates of humans can't send this, otherwise the humans on our team might get a backstabbing penalty for something they weren't aware of
if (GetPlayer()->IsAITeammateOfHuman())
return;
// Don't send this to AI teammates of humans, otherwise the humans on their team might get a backstabbing penalty for something they weren't aware of
if (GET_PLAYER(ePlayer).IsAITeammateOfHuman())
return;
// This promise is mutual, so don't send the statement if we (or our teammates) are planning war
if (AvoidExchangesWithPlayer(ePlayer, /*bWarOnly*/ true))
return;
// Check other player status
for (int iThirdPartyLoop = 0; iThirdPartyLoop < MAX_MAJOR_CIVS; iThirdPartyLoop++)
{
PlayerTypes eThirdParty = (PlayerTypes) iThirdPartyLoop;
if (eThirdParty == GetID() || eThirdParty == ePlayer)
continue;
// Are they at war with anyone we're neighbors with?
if (GetPlayer()->GetProximityToPlayer(eThirdParty) == PLAYER_PROXIMITY_NEIGHBORS && GET_TEAM(GET_PLAYER(ePlayer).getTeam()).isAtWar(GET_PLAYER(eThirdParty).getTeam()))
return;
// Are they an AI preparing for a coop war against us with a human? Don't send this statement, because being dragged into a war early is unfun for humans
if (!GET_PLAYER(ePlayer).isHuman() && GET_PLAYER(eThirdParty).isHuman() && GET_PLAYER(eThirdParty).GetDiplomacyAI()->GetCoopWarState(ePlayer, GetID()) == COOP_WAR_STATE_PREPARING)
return;
}
DiploStatementTypes eTempStatement = DIPLO_STATEMENT_AGGRESSIVE_MILITARY_WARNING;
int iTurnsBetweenStatements = 20;
if (GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) >= iTurnsBetweenStatements)
eStatement = eTempStatement;
}
}