void CvPlayerAI::AI_conquerCity(CvCity* pCity, PlayerTypes eOldOwner) { // Liberate a Minor's City? if (pCity->getOriginalOwner() != eOldOwner && pCity->getOriginalOwner() != GetID() && CanLiberatePlayer(eOldOwner)) { if (GET_PLAYER(pCity->getOriginalOwner()).isMinorCiv()) { if (GetDiplomacyAI()->DoPossibleMinorLiberation(pCity->getOriginalOwner(), pCity->GetID())) return; } } // Do we want to burn this city down? if (canRaze(pCity)) { // Burn the city if the empire is unhappy - keeping the city will only make things worse or if map hint dictates if (IsEmpireUnhappy() || (GC.getMap().GetAIMapHint() & 2)) { pCity->doTask(TASK_RAZE); return; } } // Puppet the city if (pCity->getOriginalOwner() != GetID()) { pCity->DoCreatePuppet(); } }
void CvPlayerAI::AI_conquerCity(CvCity* pCity, PlayerTypes eOldOwner) { PlayerTypes eOriginalOwner = pCity->getOriginalOwner(); TeamTypes eOldOwnerTeam = GET_PLAYER(eOldOwner).getTeam(); // Liberate a city? if(eOriginalOwner != eOldOwner && eOriginalOwner != GetID() && CanLiberatePlayerCity(eOriginalOwner)) { // minor civ if(GET_PLAYER(eOriginalOwner).isMinorCiv()) { if(GetDiplomacyAI()->DoPossibleMinorLiberation(eOriginalOwner, pCity->GetID())) return; } else // major civ { bool bLiberate = false; if (GET_PLAYER(eOriginalOwner).isAlive()) { // If the original owner and this player have a defensive pact // and both the original owner and the player are at war with the old owner of this city // give the city back to the original owner TeamTypes eOriginalOwnerTeam = GET_PLAYER(eOriginalOwner).getTeam(); if (GET_TEAM(getTeam()).IsHasDefensivePact(eOriginalOwnerTeam) && GET_TEAM(getTeam()).isAtWar(eOldOwnerTeam) && GET_TEAM(eOriginalOwnerTeam).isAtWar(eOldOwnerTeam)) { bLiberate = true; } // if the player is a friend and we're going for diplo victory, then liberate to score some friend points else if (GetDiplomacyAI()->IsDoFAccepted(eOriginalOwner) && GetDiplomacyAI()->IsGoingForDiploVictory()) { bLiberate = true; } } // if the player isn't human and we're going for diplo victory, resurrect players to get super diplo bonuses else if (!GET_PLAYER(eOriginalOwner).isHuman() && GetDiplomacyAI()->IsGoingForDiploVictory()) { bLiberate = true; } if (bLiberate) { DoLiberatePlayer(eOriginalOwner, pCity->GetID()); return; } } } // Do we want to burn this city down? if(canRaze(pCity)) { // Burn the city if the empire is unhappy - keeping the city will only make things worse or if map hint dictates // Huns will burn down everything possible once they have a core of a few cities (was 3, but this put Attila out of the running long term as a conqueror) if (IsEmpireUnhappy() || (GC.getMap().GetAIMapHint() & 2) || (GetPlayerTraits()->GetRazeSpeedModifier() > 0 && getNumCities() >= 3 + (GC.getGame().getGameTurn() / 100)) ) { pCity->doTask(TASK_RAZE); return; } } // Puppet the city if(pCity->getOriginalOwner() != GetID() || GET_PLAYER(m_eID).GetPlayerTraits()->IsNoAnnexing()) { pCity->DoCreatePuppet(); } }