CvPlayerCulture::GetInfluencePerTurn(PlayerTypes) const
- Defined in
- CvCultureClasses.cpp, line 2690
- Class
- CvPlayerCulture
- Hook name
CivHooks::CvPlayerCulture_GetInfluencePerTurn
Hooks
static bool BeforeCvPlayerCulture_GetInfluencePerTurn(const CvPlayerCulture* self, PlayerTypes ePlayer, int& result);static void AfterCvPlayerCulture_GetInfluencePerTurn(const CvPlayerCulture* self, PlayerTypes ePlayer, int& result);static int ReplaceCvPlayerCulture_GetInfluencePerTurn(int (*original)(const CvPlayerCulture*, PlayerTypes), const CvPlayerCulture* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvPlayerCulture_GetInfluencePerTurn>(host, &BeforeCvPlayerCulture_GetInfluencePerTurn);CivRegisterAfter<CivHooks::CvPlayerCulture_GetInfluencePerTurn>(host, &AfterCvPlayerCulture_GetInfluencePerTurn);CivRegisterReplace<CivHooks::CvPlayerCulture_GetInfluencePerTurn>(host, &ReplaceCvPlayerCulture_GetInfluencePerTurn);
Code
2689/// Influence being applied each turn2690int CvPlayerCulture::GetInfluencePerTurn(PlayerTypes ePlayer) const2691{2692 int iRtnValue = 0;2693 int iModifier = 0;26942695 CvPlayer &kOtherPlayer = GET_PLAYER(ePlayer);2696 CvTeam &kOtherTeam = GET_TEAM(kOtherPlayer.getTeam());26972698 if ((int)ePlayer != m_pPlayer->GetID() && kOtherPlayer.isAlive() && !kOtherPlayer.isMinorCiv() && kOtherTeam.isHasMet(m_pPlayer->getTeam()))2699 {2700 // check to see if the other player has the Great Firewall2701 bool bTargetHasGreatFirewall = false;27022703 int iLoopCity;2704 CvCity *pLoopCity;27052706 // only check for firewall if the internet influence spread modifier is > 02707 int iTechSpreadModifier = m_pPlayer->GetInfluenceSpreadModifier();2708 if (iTechSpreadModifier > 0) 2709 {2710 for (pLoopCity = GET_PLAYER(ePlayer).firstCity(&iLoopCity); pLoopCity != NULL; pLoopCity = GET_PLAYER(ePlayer).nextCity(&iLoopCity))2711 {2712 // Buildings2713 for(int jJ = 0; jJ < GC.getNumBuildingClassInfos(); jJ++)2714 {2715 BuildingClassTypes eBuildingClass = (BuildingClassTypes)jJ;27162717 CvBuildingClassInfo* pkBuildingClassInfo = GC.getBuildingClassInfo(eBuildingClass);2718 if(!pkBuildingClassInfo)2719 {2720 continue;2721 }27222723 CvCivilizationInfo& playerCivilizationInfo = GET_PLAYER(pLoopCity->getOwner()).getCivilizationInfo();2724 BuildingTypes eBuilding = (BuildingTypes)playerCivilizationInfo.getCivilizationBuildings(eBuildingClass);2725 if(eBuilding != NO_BUILDING)2726 {27272728 CvBuildingEntry* pBuildingEntry = GC.GetGameBuildings()->GetEntry(eBuilding);2729 if (!pBuildingEntry || !pBuildingEntry->NullifyInfluenceModifier())2730 {2731 continue;2732 }27332734 if(pLoopCity->GetCityBuildings()->GetNumBuilding(eBuilding) > 0)2735 {2736 bTargetHasGreatFirewall = true; 2737 }2738 }2739 }2740 }2741 }27422743 // Loop through each of our cities2744 for (pLoopCity = m_pPlayer->firstCity(&iLoopCity); pLoopCity != NULL; pLoopCity = m_pPlayer->nextCity(&iLoopCity))2745 {2746 // Design has changed so modifier is always player-to-player so only need to get it once and can apply it at the end2747 if (pLoopCity->isCapital())2748 {2749 iModifier = pLoopCity->GetCityCulture()->GetTourismMultiplier(kOtherPlayer.GetID(), false, false, false, false, false);2750 }27512752 int iInfluenceToAdd = pLoopCity->GetCityCulture()->GetBaseTourism();27532754 // if we have the internet online, check to see if the opponent has the firewall2755 // if they have the firewall, deduct the internet bonus from them2756 if (iTechSpreadModifier > 0 && bTargetHasGreatFirewall)2757 {2758 int iInfluenceWithoutModifier = pLoopCity->GetCityCulture()->GetBaseTourismBeforeModifiers();2759 int iInfluenceWithTechModifier = iInfluenceWithoutModifier * iTechSpreadModifier;2760 iInfluenceToAdd -= (iInfluenceWithTechModifier / 100);2761 }2762 2763 iRtnValue += iInfluenceToAdd;2764 }27652766#if defined(MOD_API_UNIFIED_YIELDS_TOURISM)2767 int iExtraInfluenceToAdd = 0;27682769 // Tourism from religion2770 iExtraInfluenceToAdd += m_pPlayer->GetYieldPerTurnFromReligion(YIELD_TOURISM);27712772 // Trait bonus which adds Tourism for trade partners? 2773 iExtraInfluenceToAdd += m_pPlayer->GetYieldPerTurnFromTraits(YIELD_TOURISM);2774 2775 if (iExtraInfluenceToAdd > 0)2776 {2777 // if we have the internet online, check to see if the opponent has the firewall2778 // if they have the firewall, deduct the internet bonus from them2779 if (iTechSpreadModifier > 0 && bTargetHasGreatFirewall)2780 {2781 iExtraInfluenceToAdd -= ((iExtraInfluenceToAdd * iTechSpreadModifier) / 100);2782 }2783 }27842785 iRtnValue += iExtraInfluenceToAdd;2786#endif27872788 iRtnValue = iRtnValue * (100 + iModifier) / 100;2789 }27902791 return iRtnValue;27922793}
Calls
- CvBuildingEntry::NullifyInfluenceModifier() const
- CvBuildingXMLEntries::GetEntry(int)
- CvCity::GetCityBuildings() const
- CvCity::GetCityCulture() const
- CvCity::getOwner() const
- CvCity::isCapital() const
- CvCityBuildings::GetNumBuilding(BuildingTypes) const
- CvCityCulture::GetBaseTourism()
- CvCityCulture::GetBaseTourismBeforeModifiers()
- CvCityCulture::GetTourismMultiplier(PlayerTypes, bool, bool, bool, bool, bool) const
- CvCivilizationInfo::getCivilizationBuildings(int) const
- CvGlobals::getBuildingClassInfo(BuildingClassTypes)
- CvGlobals::GetGameBuildings() const
- CvGlobals::getNumBuildingClassInfos()
- CvPlayer::firstCity(int *, bool)
- CvPlayer::getCivilizationInfo() const
- CvPlayer::GetID() const
- CvPlayer::GetInfluenceSpreadModifier() const
- CvPlayer::getTeam() const
- CvPlayer::GetYieldPerTurnFromReligion(YieldTypes) const
- CvPlayer::GetYieldPerTurnFromTraits(YieldTypes) const
- CvPlayer::isAlive() const
- CvPlayer::isMinorCiv() const
- CvPlayer::nextCity(int *, bool)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvTeam::getTeam(TeamTypes)
- CvTeam::isHasMet(TeamTypes) const