Hooks
static bool BeforeCvDiplomacyAI_DoDenounceStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);static void AfterCvDiplomacyAI_DoDenounceStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);static void ReplaceCvDiplomacyAI_DoDenounceStatement(void (*original)(CvDiplomacyAI*, PlayerTypes, DiploStatementTypes&), CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoDenounceStatement>(host, &BeforeCvDiplomacyAI_DoDenounceStatement);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoDenounceStatement>(host, &AfterCvDiplomacyAI_DoDenounceStatement);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoDenounceStatement>(host, &ReplaceCvDiplomacyAI_DoDenounceStatement);
Code
14433/// Possible Contact Statement14434void CvDiplomacyAI::DoDenounceStatement(PlayerTypes ePlayer, DiploStatementTypes& eStatement)14435{14436 CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");14437 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");1443814439 if(eStatement == NO_DIPLO_STATEMENT_TYPE)14440 {14441 if(IsDenounceAcceptable(ePlayer, /*bBias*/ false))14442 {14443 DiploStatementTypes eTempStatement = DIPLO_STATEMENT_DENOUNCE;1444414445 if(GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) >= 60 &&14446 GetNumTurnsSinceStatementSent(ePlayer, DIPLO_STATEMENT_DENOUNCE_RANDFAILED) >= 10)14447 {14448 bool bSendStatement = true;1444914450 // 1 in 2 chance we don't actually send the message (don't want full predictability)14451 //if (50 < GC.getGame().getJonRandNum(100, "Diplomacy AI: rand roll to see if we ask to work with a player"))14452 // bSendStatement = false;1445314454 if(bSendStatement)14455 {14456 eStatement = eTempStatement;14457 }1445814459 // Add this statement to the log so we don't evaluate it again until time has passed14460 else14461 DoAddNewStatementToDiploLog(ePlayer, DIPLO_STATEMENT_DENOUNCE_RANDFAILED);14462 }14463 }14464 }14465}