void CvPlayerAI::AI_conquerCity(CvCity* pCity)
{
CvCity* pNearestCity;
bool bRaze;
if (canRaze(pCity))
{
if (GC.getGameINLINE().getElapsedGameTurns() > 20)
{
if (getNumCities() > 4)
{
if (!(pCity->isHolyCity()) && !(pCity->hasActiveWorldWonder()))
{
bRaze = true;
if (!bRaze)
{
if (pCity->getPreviousOwner() != BARBARIAN_PLAYER)
{
pNearestCity = GC.getMapINLINE().findCity(pCity->getX_INLINE(), pCity->getY_INLINE(), NO_PLAYER, getTeam(), true, false, NO_TEAM, NO_DIRECTION, pCity);
if (pNearestCity == NULL)
{
if (pCity->getPreviousOwner() != NO_PLAYER)
{
if (GET_TEAM(GET_PLAYER(pCity->getPreviousOwner()).getTeam()).countNumCitiesByArea(pCity->area()) > 3)
{
bRaze = true;
}
}
}
else
{
if (plotDistance(pCity->getX_INLINE(), pCity->getY_INLINE(), pNearestCity->getX_INLINE(), pNearestCity->getY_INLINE()) > 9)
{
bRaze = true;
}
}
}
}
if (!bRaze)
{
if (pCity->area()->getCitiesPerPlayer(getID()) > 0)
{
if (AI_isFinancialTrouble())
{
if (pCity->getPopulation() < 4)
{
bRaze = true;
}
}
}
}
if (!bRaze)
{
if (pCity->area()->getCitiesPerPlayer(getID()) > 0)
{
if (pCity->getPreviousOwner() != BARBARIAN_PLAYER)
{
if (GC.getGameINLINE().getSorenRandNum(100, "AI Raze City") < GC.getLeaderHeadInfo(getPersonalityType()).getRazeCityProb())
{
bRaze = true;
}
}
}
}
if (bRaze)
{
pCity->doTask(TASK_RAZE);
}
}
}
}
}
}