Bazaar developer reference

CvGrandStrategyAI::GetPersonalityAndGrandStrategy(FlavorTypes, bool)

Defined in
CvGrandStrategyAI.cpp, line 781
Class
CvGrandStrategyAI
Hook name
CivHooks::CvGrandStrategyAI_GetPersonalityAndGrandStrategy

Hooks

static bool BeforeCvGrandStrategyAI_GetPersonalityAndGrandStrategy(CvGrandStrategyAI* self, FlavorTypes eFlavorType, bool bBoostGSMainFlavor, int& result);static void AfterCvGrandStrategyAI_GetPersonalityAndGrandStrategy(CvGrandStrategyAI* self, FlavorTypes eFlavorType, bool bBoostGSMainFlavor, int& result);static int ReplaceCvGrandStrategyAI_GetPersonalityAndGrandStrategy(int (*original)(CvGrandStrategyAI*, FlavorTypes, bool), CvGrandStrategyAI* self, FlavorTypes eFlavorType, bool bBoostGSMainFlavor);CivRegisterBefore<CivHooks::CvGrandStrategyAI_GetPersonalityAndGrandStrategy>(host, &BeforeCvGrandStrategyAI_GetPersonalityAndGrandStrategy);CivRegisterAfter<CivHooks::CvGrandStrategyAI_GetPersonalityAndGrandStrategy>(host, &AfterCvGrandStrategyAI_GetPersonalityAndGrandStrategy);CivRegisterReplace<CivHooks::CvGrandStrategyAI_GetPersonalityAndGrandStrategy>(host, &ReplaceCvGrandStrategyAI_GetPersonalityAndGrandStrategy);

Code

779/// Get the base Priority for a Grand Strategy; these are elements common to ALL Grand Strategies780#if defined(MOD_AI_SMART_V3)781int CvGrandStrategyAI::GetPersonalityAndGrandStrategy(FlavorTypes eFlavorType, bool bBoostGSMainFlavor)782#else783int CvGrandStrategyAI::GetPersonalityAndGrandStrategy(FlavorTypes eFlavorType)784#endif785{786	if(m_eActiveGrandStrategy != NO_AIGRANDSTRATEGY)787	{788		CvAIGrandStrategyXMLEntry* pGrandStrategy = GetAIGrandStrategies()->GetEntry(m_eActiveGrandStrategy);789		int iModdedFlavor = pGrandStrategy->GetFlavorModValue(eFlavorType) + m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor(eFlavorType);790		iModdedFlavor = max(0,iModdedFlavor);791#if defined(MOD_AI_SMART_V3)792		if(MOD_AI_SMART_V3 && bBoostGSMainFlavor && (pGrandStrategy->GetFlavorValue(eFlavorType) > 0))793		{794			iModdedFlavor = min(10, ((pGrandStrategy->GetFlavorValue(eFlavorType) + iModdedFlavor + 1) / 2));795		}796#endif797		return iModdedFlavor;798	}799	return m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor(eFlavorType);800}

Calls

Called by