Bazaar developer reference

CvUnit::GetConversionStrength(const CvCity *) const

Defined in
CvUnit.cpp, line 8942
Class
CvUnit
Hook name
CivHooks::CvUnit_GetConversionStrength

Hooks

static bool BeforeCvUnit_GetConversionStrength(const CvUnit* self, const CvCity* pCity, int& result);static void AfterCvUnit_GetConversionStrength(const CvUnit* self, const CvCity* pCity, int& result);static int ReplaceCvUnit_GetConversionStrength(int (*original)(const CvUnit*, const CvCity*), const CvUnit* self, const CvCity* pCity);CivRegisterBefore<CivHooks::CvUnit_GetConversionStrength>(host, &BeforeCvUnit_GetConversionStrength);CivRegisterAfter<CivHooks::CvUnit_GetConversionStrength>(host, &AfterCvUnit_GetConversionStrength);CivRegisterReplace<CivHooks::CvUnit_GetConversionStrength>(host, &ReplaceCvUnit_GetConversionStrength);

Code

8941#if defined(MOD_RELIGION_CONVERSION_MODIFIERS)8942int CvUnit::GetConversionStrength(const CvCity* pCity) const8943#else8944int CvUnit::GetConversionStrength() const8945#endif8946{8947	int iReligiousStrength = GC.getRELIGION_MISSIONARY_PRESSURE_MULTIPLIER() * GetReligionData()->GetReligiousStrength();8948	CvGameReligions* pReligions = GC.getGame().GetGameReligions();8949	ReligionTypes eReligion = GetReligionData()->GetReligion();8950	if(eReligion > RELIGION_PANTHEON)8951	{8952		const CvReligion* pReligion = pReligions->GetReligion(eReligion, getOwner());8953		if(pReligion)8954		{8955			int iStrengthMod;8956			if (IsGreatPerson())8957			{8958				iStrengthMod = pReligion->m_Beliefs.GetProphetStrengthModifier();8959			}8960			else8961			{8962				iStrengthMod = pReligion->m_Beliefs.GetMissionaryStrengthModifier();8963			}89648965			if(iStrengthMod != 0)8966			{8967				iReligiousStrength *= (100 + iStrengthMod);8968				iReligiousStrength /= 100;8969			}8970		}8971	}89728973#if defined(MOD_RELIGION_CONVERSION_MODIFIERS)8974	if (pCity != NULL && MOD_RELIGION_CONVERSION_MODIFIERS) {8975		// Modify iReligiousStrength based on city defenses, but only against hostile units (ie any not the same team as the city)8976		PlayerTypes eFromPlayer = getOwner();8977		PlayerTypes eToPlayer = pCity->getOwner();89788979		if (getTeam() != pCity->getTeam()) {8980			CvPlayer& pToPlayer = GET_PLAYER(eToPlayer);8981			int iCityModifier = pCity->GetConversionModifier();8982			8983			if (pToPlayer.isMinorCiv() && pToPlayer.GetMinorCivAI()->IsActiveQuestForPlayer(eFromPlayer, MINOR_CIV_QUEST_SPREAD_RELIGION)) {8984				// The City State actively wants this religion8985				iCityModifier *= -1;8986			}89878988			iReligiousStrength *= (100 + (iCityModifier + pToPlayer.GetConversionModifier() + pToPlayer.GetPlayerPolicies()->GetNumericModifier(POLICYMOD_CONVERSION_MODIFIER))); 8989			iReligiousStrength /= 100;8990		}8991	}8992	// CUSTOMLOG("Unit conversion str: %i", iReligiousStrength);89938994#endif8995	return iReligiousStrength;8996}

Calls

Called by