Skip to content

Commit

Permalink
Made some final adjustments for Mastery Victory.
Browse files Browse the repository at this point in the history
Mastery Victory will now reduce the game turn limit by 12% (eg. 440
turns in a standard game rather than 500.)

The AI will now allow itself to use multiple stage4 victory strategies
when mastery victory is enabled.

The AI will never use diplo4 when mastery victory is enabled.
  • Loading branch information
karadoc committed Jun 3, 2012
1 parent 6975c30 commit 4fe38a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
10 changes: 8 additions & 2 deletions CvGameCoreDLL/CvGame.cpp
Expand Up @@ -241,11 +241,17 @@ void CvGame::init(HandicapTypes eHandicap)
if (getEstimateEndTurn() > getGameTurn())
{
//bValid = false;
// Karadoc: mastery victory
// K-Mod. mastery victory
if (bMastery)
{
bValid = true;
// The usual time limit represents an extreme end-game.
// So for the mastery victory, we should reduce it to something more 'normal'.
int iTurns = std::max(1, (getEstimateEndTurn() - getGameTurn()) * 88 / 100); // ad hoc ratio.
setEstimateEndTurn(getGameTurn() + iTurns);
}
else
// K end.
// K-Mod end
{
bValid = false;
for (iI = 0; iI < GC.getNumVictoryInfos(); iI++)
Expand Down
17 changes: 13 additions & 4 deletions CvGameCoreDLL/CvPlayerAI.cpp
Expand Up @@ -19493,6 +19493,15 @@ void CvPlayerAI::AI_updateVictoryStrategyHash()
bool bStartedOtherLevel3 = false;
bool bStartedOtherLevel4 = false;

// K-Mod
bool bMasteryVictory = false;
for (VictoryTypes i = (VictoryTypes)0; !bMasteryVictory && i < GC.getNumVictoryInfos(); i=(VictoryTypes)(i+1))
{
if (GC.getGameINLINE().isVictoryValid(i) && GC.getVictoryInfo(i).isTotalVictory())
bMasteryVictory = true;
}
// K-Mod end

// Space victory
int iVictoryStage = AI_calculateSpaceVictoryStage();

Expand All @@ -19507,7 +19516,7 @@ void CvPlayerAI::AI_updateVictoryStrategyHash()
bStartedOtherLevel3 = true;
m_iVictoryStrategyHash |= AI_VICTORY_SPACE3;

if (iVictoryStage > 3 && !bStartedOtherLevel4)
if (iVictoryStage > 3 && (bMasteryVictory || !bStartedOtherLevel4))
{
bStartedOtherLevel4 = true;
m_iVictoryStrategyHash |= AI_VICTORY_SPACE4;
Expand All @@ -19530,7 +19539,7 @@ void CvPlayerAI::AI_updateVictoryStrategyHash()
bStartedOtherLevel3 = true;
m_iVictoryStrategyHash |= AI_VICTORY_CONQUEST3;

if (iVictoryStage > 3 && !bStartedOtherLevel4)
if (iVictoryStage > 3 && (bMasteryVictory || !bStartedOtherLevel4))
{
bStartedOtherLevel4 = true;
m_iVictoryStrategyHash |= AI_VICTORY_CONQUEST4;
Expand All @@ -19553,7 +19562,7 @@ void CvPlayerAI::AI_updateVictoryStrategyHash()
bStartedOtherLevel3 = true;
m_iVictoryStrategyHash |= AI_VICTORY_DOMINATION3;

if (iVictoryStage > 3 && !bStartedOtherLevel4)
if (iVictoryStage > 3 && (bMasteryVictory || !bStartedOtherLevel4))
{
bStartedOtherLevel4 = true;
m_iVictoryStrategyHash |= AI_VICTORY_DOMINATION4;
Expand Down Expand Up @@ -19602,7 +19611,7 @@ void CvPlayerAI::AI_updateVictoryStrategyHash()
bStartedOtherLevel3 = true;
m_iVictoryStrategyHash |= AI_VICTORY_DIPLOMACY3;

if (iVictoryStage > 3 && !bStartedOtherLevel4)
if (!bMasteryVictory && iVictoryStage > 3 && !bStartedOtherLevel4)
{
bStartedOtherLevel4 = true;
m_iVictoryStrategyHash |= AI_VICTORY_DIPLOMACY4;
Expand Down

0 comments on commit 4fe38a6

Please sign in to comment.