CvMinorCivAI::DoTestSeedQuestCountdownForPlayer(PlayerTypes, bool)
- Defined in
- CvMinorCivAI.cpp, line 5224
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_DoTestSeedQuestCountdownForPlayer
Hooks
static bool BeforeCvMinorCivAI_DoTestSeedQuestCountdownForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, bool bForceSeed);static void AfterCvMinorCivAI_DoTestSeedQuestCountdownForPlayer(CvMinorCivAI* self, PlayerTypes ePlayer, bool bForceSeed);static void ReplaceCvMinorCivAI_DoTestSeedQuestCountdownForPlayer(void (*original)(CvMinorCivAI*, PlayerTypes, bool), CvMinorCivAI* self, PlayerTypes ePlayer, bool bForceSeed);CivRegisterBefore<CivHooks::CvMinorCivAI_DoTestSeedQuestCountdownForPlayer>(host, &BeforeCvMinorCivAI_DoTestSeedQuestCountdownForPlayer);CivRegisterAfter<CivHooks::CvMinorCivAI_DoTestSeedQuestCountdownForPlayer>(host, &AfterCvMinorCivAI_DoTestSeedQuestCountdownForPlayer);CivRegisterReplace<CivHooks::CvMinorCivAI_DoTestSeedQuestCountdownForPlayer>(host, &ReplaceCvMinorCivAI_DoTestSeedQuestCountdownForPlayer);
Code
5223/// How long before we trigger a new quest?5224void CvMinorCivAI::DoTestSeedQuestCountdownForPlayer(PlayerTypes ePlayer, bool bForceSeed)5225{5226 if(!bForceSeed)5227 {5228 // Only seed if there is a potential spot for a personal quest for this player5229 if(GetNumActivePersonalQuestsForPlayer(ePlayer) >= GetMaxActivePersonalQuestsForPlayer())5230 {5231 return;5232 }52335234 // Only seed if the countdown for this player is not already active5235 if(GetQuestCountdownForPlayer(ePlayer) > 0)5236 {5237 return;5238 }5239 }52405241 int iNumTurns = 0;52425243 // Quests are now available for the first time?5244 if(GC.getGame().getElapsedGameTurns() == GetFirstPossibleTurnForPersonalQuests())5245 {5246 int iRand = /*20*/ GC.getMINOR_CIV_PERSONAL_QUEST_FIRST_POSSIBLE_TURN_RAND();5247 iNumTurns += GC.getGame().getJonRandNum(iRand, "Random # of turns for Minor Civ personal quest counter - first time.");5248 }5249 else5250 {5251 iNumTurns += /*20*/ GC.getMINOR_CIV_PERSONAL_QUEST_MIN_TURNS_BETWEEN();52525253 int iRand = /*25*/ GC.getMINOR_CIV_PERSONAL_QUEST_RAND_TURNS_BETWEEN();5254 if(GetPersonality() == MINOR_CIV_PERSONALITY_HOSTILE)5255 {5256 iRand *= /*200*/ GC.getMINOR_CIV_PERSONAL_QUEST_RAND_TURNS_BETWEEN_HOSTILE_MULTIPLIER();5257 iRand /= 100;5258 }5259 iNumTurns += GC.getGame().getJonRandNum(iRand, "Random # of turns for Minor Civ personal quest counter.");5260 }52615262 // Modify for Game Speed5263 iNumTurns *= GC.getGame().getGameSpeedInfo().getGreatPeoplePercent();5264 iNumTurns /= 100;52655266 SetQuestCountdownForPlayer(ePlayer, iNumTurns);5267}
Calls
- CvGame::getElapsedGameTurns() const
- CvGame::getGameSpeedInfo() const
- CvGame::getJonRandNum(int, const char *)
- CvGameSpeedInfo::getGreatPeoplePercent() const
- CvGlobals::getGame()
- CvGlobals::getMINOR_CIV_PERSONAL_QUEST_FIRST_POSSIBLE_TURN_RAND()
- CvGlobals::getMINOR_CIV_PERSONAL_QUEST_MIN_TURNS_BETWEEN()
- CvGlobals::getMINOR_CIV_PERSONAL_QUEST_RAND_TURNS_BETWEEN()
- CvGlobals::getMINOR_CIV_PERSONAL_QUEST_RAND_TURNS_BETWEEN_HOSTILE_MULTIPLIER()
- CvMinorCivAI::GetFirstPossibleTurnForPersonalQuests() const
- CvMinorCivAI::GetMaxActivePersonalQuestsForPlayer() const
- CvMinorCivAI::GetNumActivePersonalQuestsForPlayer(PlayerTypes) const
- CvMinorCivAI::GetPersonality() const
- CvMinorCivAI::GetQuestCountdownForPlayer(PlayerTypes)
- CvMinorCivAI::SetQuestCountdownForPlayer(PlayerTypes, int)