CvMinorCivAI::ChangeFriendshipWithMajorTimes100(PlayerTypes, int, bool)
- Defined in
- CvMinorCivAI.cpp, line 6293
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_ChangeFriendshipWithMajorTimes100
Hooks
static bool BeforeCvMinorCivAI_ChangeFriendshipWithMajorTimes100(CvMinorCivAI* self, PlayerTypes ePlayer, int iChange, bool bFromQuest);static void AfterCvMinorCivAI_ChangeFriendshipWithMajorTimes100(CvMinorCivAI* self, PlayerTypes ePlayer, int iChange, bool bFromQuest);static void ReplaceCvMinorCivAI_ChangeFriendshipWithMajorTimes100(void (*original)(CvMinorCivAI*, PlayerTypes, int, bool), CvMinorCivAI* self, PlayerTypes ePlayer, int iChange, bool bFromQuest);CivRegisterBefore<CivHooks::CvMinorCivAI_ChangeFriendshipWithMajorTimes100>(host, &BeforeCvMinorCivAI_ChangeFriendshipWithMajorTimes100);CivRegisterAfter<CivHooks::CvMinorCivAI_ChangeFriendshipWithMajorTimes100>(host, &AfterCvMinorCivAI_ChangeFriendshipWithMajorTimes100);CivRegisterReplace<CivHooks::CvMinorCivAI_ChangeFriendshipWithMajorTimes100>(host, &ReplaceCvMinorCivAI_ChangeFriendshipWithMajorTimes100);
Code
6292/// Changes the base level of Friendship between this Minor and the specified Major Civ6293void CvMinorCivAI::ChangeFriendshipWithMajorTimes100(PlayerTypes ePlayer, int iChange, bool bFromQuest)6294{6295 CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");6296 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");62976298 if(iChange != 0)6299 {6300 // If this friendship was earned from a Quest, then we might apply a modifier to it6301 if(bFromQuest && iChange > 0)6302 {6303 if(GET_PLAYER(ePlayer).getMinorQuestFriendshipMod() != 0)6304 {6305 iChange *= (100 + GET_PLAYER(ePlayer).getMinorQuestFriendshipMod());6306 iChange /= 100;6307 }6308 }63096310 SetFriendshipWithMajorTimes100(ePlayer, GetBaseFriendshipWithMajorTimes100(ePlayer) + iChange, bFromQuest);6311 }6312}