[COLOR="Green"]/************************************************************************************************/
/* BETTER_BTS_AI_MOD 08/10/09 jdog5000 */
/* */
/* Naval AI */
/************************************************************************************************/[/COLOR]
[COLOR="Green"]// BBAI TODO: Turn this into a function, have docked escort ships do it to[/COLOR]
CvCity* pCity = plot()->getPlotCity();
if( pCity != NULL )
{
if( pCity->isBlockaded() )
{
[B]int iBlockadeRange = GC.getDefineINT("SHIP_BLOCKADE_RANGE");[/B]
[COLOR="Green"]// City under blockade[/COLOR]
[COLOR="Green"]// Attacker has low odds since anyAttack checks above passed, try to break if sufficient numbers[/COLOR]
int iAttackers = plot()->plotCount(PUF_isUnitAIType, UNITAI_ATTACK_SEA, -1, NO_PLAYER, getTeam(), PUF_isGroupHead, -1, -1);
int iBlockaders = GET_PLAYER(getOwnerINLINE()).AI_getWaterDanger(plot(), [B](iBlockadeRange + 1)[/B]);
if( iAttackers [B]>[/B] (iBlockaders + 2) [B]|| iAttackers >= 2*iBlockaders[/B])
{
if( iAttackers > GC.getGameINLINE().getSorenRandNum(2*iBlockaders + 1, "AI - Break blockade") )
{
[COLOR="Green"]// BBAI TODO: Make odds scale by # of blockaders vs number of attackers[/COLOR]
[B]if (baseMoves() >= iBlockadeRange)[/B]
{
if (AI_anyAttack(1, 15))
{
return;
}
}
[B]else
{
[COLOR="Green"]//Assumption: Every ship can reach a blockade with 2 moves[/COLOR]
if (AI_anyAttack(2, 15))
{
return;
}
}
[COLOR="Green"]//If no mission was pushed yet and we have a lot of ships, try again with even lower odds[/COLOR]
if(iAttackers > 2*iBlockaders)
{
if (AI_anyAttack(1, 10))
{
return;
}
}[/B]
}
}
}
}
[COLOR="Green"]/************************************************************************************************/
/* BETTER_BTS_AI_MOD END */
/************************************************************************************************/[/COLOR]