CvDiplomacyAI::IsAngryAboutProtectedMinorAttacked(PlayerTypes)
- Defined in
- CvDiplomacyAI.cpp, line 8096
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_IsAngryAboutProtectedMinorAttacked
Hooks
static bool BeforeCvDiplomacyAI_IsAngryAboutProtectedMinorAttacked(CvDiplomacyAI* self, PlayerTypes ePlayer, bool& result);static void AfterCvDiplomacyAI_IsAngryAboutProtectedMinorAttacked(CvDiplomacyAI* self, PlayerTypes ePlayer, bool& result);static bool ReplaceCvDiplomacyAI_IsAngryAboutProtectedMinorAttacked(bool (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsAngryAboutProtectedMinorAttacked>(host, &BeforeCvDiplomacyAI_IsAngryAboutProtectedMinorAttacked);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsAngryAboutProtectedMinorAttacked>(host, &AfterCvDiplomacyAI_IsAngryAboutProtectedMinorAttacked);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsAngryAboutProtectedMinorAttacked>(host, &ReplaceCvDiplomacyAI_IsAngryAboutProtectedMinorAttacked);
Code
8096bool CvDiplomacyAI::IsAngryAboutProtectedMinorAttacked(PlayerTypes ePlayer)8097{8098 CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Anton your save file and version.");8099 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index. Please send Anton your save file and version.");8100 if (ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return false;81018102 // Anger over killed city-states trumps this, don't stack8103 if (IsAngryAboutProtectedMinorKilled(ePlayer))8104 return false;8105 8106 int iNumProtectedMinorsAttacked = GetOtherPlayerNumProtectedMinorsAttacked(ePlayer);8107 if(iNumProtectedMinorsAttacked > 0)8108 {8109 int iTurnsSinceMinorAttack = GetTurnsSincePlayerAttackedProtectedMinor(ePlayer);8110 if (iTurnsSinceMinorAttack > -1 && iTurnsSinceMinorAttack < /*75*/ GC.getOPINION_WEIGHT_ATTACKED_PROTECTED_MINOR_NUM_TURNS_UNTIL_FORGIVEN()) //antonjs: consider: scale by game speed8111 {8112 return true;8113 }8114 }8115 return false;8116}