[BtS-3.13] BombingMissions

Dale

Mohawk Games Developer
Joined
Mar 14, 2002
Messages
7,601
Bombing Missions for Beyond the Sword 3.13!

The air-bombing missions which featured in the BtS Mod Road to War are now available separately! Bombers can now air-bomb city defenses, city buildings, strategic air-bomb or the port air-bomb mission to attempt to sink ships.

********************
UPDATE 1.3
- AI now uses logic to choose which mission to perform.
- New XML tags for Civ4TechInfos.xml to specify the two techs that increase the chance to hit a building.
- New XML tag for Civ4UnitInfos.xml to signify what airbomb missions a unit can perform.

Please re-download to get the new version!
********************

Instructions:
1. Download the mod. http://forums.civfanatics.com/downloads.php?do=file&id=7910
2. Install and select your Mods folder: ..\Sid Meiers Civilization 4\Beyond the Sword\Mods\
3. Launch BtS and switch to mod BombingMissions.
4. Play as you normally would.

Information:

1. Air-bomb Defenses:
Works as the typical air-bomb mission in Civ4. Either bomb tile improvements or city defenses to lower the defense percentage.

2. Air-bomb Buildings: (Thanks Seven05 for assistance)
Attempt to destroy one of the city's buildings. Works well against well-established and built-up cities. If successful one building is totally destroyed (could be a wonder too!).

3. Air-bomb Production Buildings:
Attempt to destroy a production building in the city. If successful one production building is totally destroyed.

4. Port Air-bomb:
Attempt to damage one of the ships in the city's port. Any ship in the city can be the target. If successful the ship is damaged, with a chance of the ship being sunk completely.

5. Strategic Air-bomb: (Thanks Stormwaltz for assistance)
Attempt to damage the current build project of the city. If successful hammers are removed from the current build project.









 
OK, question, Dale...


What determines the odds of destroying a building? I just made like 20 passes with a Stealth Bomber on a Barbarian city (loaded with various buildings) and out of all 20 passes, only one pass was successful in taking out a building (harbor).

Is there a way to bump up the odds?

Also, it looks like there should be 4 bombing missions: (Defense, Building, Port and Factory). I'm only seeing 3 out of 4, with the Factory mission missing? The Barbarian city I'm testing on currently has a factory in it.
 
Thankyou for [BtS-3.13] BombingMissions

Big question will you combine [BtS-3.13] BombingMissions with your [BtS] Ranged Bombardment

I was looking at the SDK files and got lost with this one CvUnit c++ and I do Thankyou for both mods. I hope you do combine your two mods. I feel alot more people would like also. These two mod together with Archery Barrage would make one great mod.
 
OK, question, Dale...


What determines the odds of destroying a building? I just made like 20 passes with a Stealth Bomber on a Barbarian city (loaded with various buildings) and out of all 20 passes, only one pass was successful in taking out a building (harbor).

It's a simple thing, it selects a building index at random, and if it exists then it destroys it. It works on the principle of carpet bombing, and the more buildings the better the chance to hit something.

Is there a way to bump up the odds?

Yeah, you can change the function to pick a building in airBomb() and airBomb2().
Code:
build = GC.getGameINLINE().getSorenRandNum(GC.getNumBuildInfos(), "Airbomb building");

Also, it looks like there should be 4 bombing missions: (Defense, Building, Port and Factory). I'm only seeing 3 out of 4, with the Factory mission missing? The Barbarian city I'm testing on currently has a factory in it.

That was a specific mission for Road to War which had four different factories. If you want to turn it on, modify canAirBomb3() so it doesn't return false straight away. You'll also have to modify the building picker for this one to pick from your factories index value in airBomb3() and airBomb().
 
I second the need for Ranged Bombardment to be combined with this. (Archery barrage can wait, as that's mostly ancient stuff and this is focused on modern times. :D)

Fantastic work! Kudos. :)
 
Yeah, you can change the function to pick a building in airBomb() and airBomb2().
Code:
build = GC.getGameINLINE().getSorenRandNum(GC.getNumBuildInfos(), "Airbomb building");

Ok, I'm in CvUnit.cpp, and I think I found what you were mentioning above. Would I change the value in the font highlighted red? If so, would it be a greater or lesser value than 10?

Code:
		// Dale - RtW: AI missions START
		{
			if (pCity->isCoastal(GC.getMIN_WATER_SIZE_FOR_OCEAN()))
			{
                randomNum = GC.getGameINLINE().getSorenRandNum(30, "airbomb missions");
			} else {
                randomNum = GC.getGameINLINE().getSorenRandNum(20, "airbomb missions");
			}
			[COLOR="Red"]if (randomNum <= 10)[/COLOR]
			{
				pCity->changeDefenseModifier(-airBombCurrRate());
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_DEFENSES_REDUCED_TO", pCity->getNameKey(), pCity->getDefenseModifier(false), getNameKey());
				gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, m_pUnitInfo->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
				szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_DEFENSES_REDUCED_TO", getNameKey(), pCity->getNameKey(), pCity->getDefenseModifier(false));
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
			} [COLOR="red"]else if (randomNum > 10 && randomNum <= 20)[/COLOR] {
				build = GC.getGameINLINE().getSorenRandNum(GC.getNumBuildInfos(), "Airbomb building");
				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
				{
					pCity->setNumRealBuilding((BuildingTypes)build, -1);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB2SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB2SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB2FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB2FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
 
Grave:

That's the function that randomly chooses the AI mission (defense, building, port) against a city. It's nothing to do with chance of hitting anything.
 
I've re-enabled the AirBomb3 mission and have it selecting a random building from a list. To make it interesting you get one try to find a valid target until you have researched computers at which time you get four tries. Once you have lasers this increases to eight tries.

Here's the SDK source if anybody wants it:
Spoiler :
Code:
bool CvUnit::canAirBomb3(const CvPlot* pPlot) const
{
	if (getDomainType() != DOMAIN_AIR)
	{
		return false;
	}
	if (airBombBaseRate() == 0)
	{
		return false;
	}
	if (isMadeAttack())
	{
		return false;
	}
	return true;
}


bool CvUnit::canAirBomb3At(const CvPlot* pPlot, int iX, int iY) const
{
	// Seven05: Modified Dale's orginal code to support list of valid target buildings
	CvCity* pCity;
	CvPlot* pTargetPlot;
	bool bValidTarget = false;

	if (!canAirBomb3(pPlot))
	{
		return false;
	}

	pTargetPlot = GC.getMapINLINE().plotINLINE(iX, iY);
	if (plotDistance(pPlot->getX_INLINE(), pPlot->getY_INLINE(), pTargetPlot->getX_INLINE(), pTargetPlot->getY_INLINE()) > airRange())
	{
		return false;
	}

	if (pTargetPlot->isOwned())
	{
		if (!atWar(pTargetPlot->getTeam(), getTeam()))
		{
			return false;
		}
	}

	pCity = pTargetPlot->getPlotCity();
	if (pCity == NULL)
	{
		return false;
	}
	else
	{
		int iTargetBuildings[13] = {
			GC.getInfoTypeForString("BUILDING_FORGE"),
			GC.getInfoTypeForString("BUILDING_MALI_MINT"),
			GC.getInfoTypeForString("BUILDING_FACTORY"),
			GC.getInfoTypeForString("BUILDING_GERMAN_ASSEMBLY_PLANT"),
			GC.getInfoTypeForString("BUILDING_COAL_PLANT"),
			GC.getInfoTypeForString("BUILDING_JAPANESE_SHALE_PLANT"),
			GC.getInfoTypeForString("BUILDING_HYDRO_PLANT"),
			GC.getInfoTypeForString("BUILDING_NUCLEAR_PLANT"),
			GC.getInfoTypeForString("BUILDING_INDUSTRIAL_PARK"),
			GC.getInfoTypeForString("BUILDING_DRYDOCK"),
			GC.getInfoTypeForString("BUILDING_AIRPORT"),
			GC.getInfoTypeForString("BUILDING_BARRACKS"),
			GC.getInfoTypeForString("BUILDING_ZULU_IKHANDA")};

		for (int iI = 0; iI < 13; iI++)
		{
			if (pCity->getNumRealBuilding((BuildingTypes)iTargetBuildings[iI]) > 0)
			{
				bValidTarget = true;
			}
		}
	}
	return bValidTarget;
}


bool CvUnit::airBomb3(int iX, int iY)
{
	// Seven05: Modified version of Dales original code.
	// Pre-computers, a single random building is selected from the list, with
	// computers there are 4 attempts to find a valid building, with lasers
	// this increases to 8 attempts.
	CvCity* pCity;
	CvPlot* pPlot;
	CvWString szBuffer;
	int build, iI, iAttempts, iMaxAttempts;
	bool bNoTarget = true;

	if (!canAirBomb3At(plot(), iX, iY))
	{
		return false;
	}
	pPlot = GC.getMapINLINE().plotINLINE(iX, iY);
	if (interceptTest(pPlot))
	{
		return true;
	}

	int iTargetBuildings[13] = {
		GC.getInfoTypeForString("BUILDING_FORGE"),
		GC.getInfoTypeForString("BUILDING_MALI_MINT"),
		GC.getInfoTypeForString("BUILDING_FACTORY"),
		GC.getInfoTypeForString("BUILDING_GERMAN_ASSEMBLY_PLANT"),
		GC.getInfoTypeForString("BUILDING_COAL_PLANT"),
		GC.getInfoTypeForString("BUILDING_JAPANESE_SHALE_PLANT"),
		GC.getInfoTypeForString("BUILDING_HYDRO_PLANT"),
		GC.getInfoTypeForString("BUILDING_NUCLEAR_PLANT"),
		GC.getInfoTypeForString("BUILDING_INDUSTRIAL_PARK"),
		GC.getInfoTypeForString("BUILDING_DRYDOCK"),
		GC.getInfoTypeForString("BUILDING_AIRPORT"),
		GC.getInfoTypeForString("BUILDING_BARRACKS"),
		GC.getInfoTypeForString("BUILDING_ZULU_IKHANDA")};

	pCity = pPlot->getPlotCity();

	if (pCity != NULL)
	{
		iI = GC.getGameINLINE().getSorenRandNum(13, "Airbomb building");
		build = iTargetBuildings[iI];

		if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
		{
			bNoTarget = false;
		}

		if (GET_TEAM(GET_PLAYER(getOwner()).getTeam()).isHasTech((TechTypes)GC.getInfoTypeForString("TECH_COMPUTERS")))
		{
			iAttempts = 0;
			if (GET_TEAM(GET_PLAYER(getOwner()).getTeam()).isHasTech((TechTypes)GC.getInfoTypeForString("TECH_LASER")))
			{
				iMaxAttempts = 8;
			}
			else
			{
				iMaxAttempts = 4;
			}

			while (bNoTarget)
			{
				iAttempts++;
				iI = GC.getGameINLINE().getSorenRandNum(13, "Airbomb building");
				build = iTargetBuildings[iI];

				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0 || iAttempts > iMaxAttempts)
				{
					bNoTarget = false;
				}
			}
		}

		bool bBarb = pCity->isBarbarian();
		changeExperience(GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), bBarb ? GC.getDefineINT("BARBARIAN_MAX_XP_VALUE") : -1, !bBarb, pCity->getOwnerINLINE() == getOwnerINLINE());
		if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
		{
			pCity->setNumRealBuilding((BuildingTypes)build, -1);
			szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB3SUCCESS");
			gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
			szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB3SUCCESS");
			gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
		} else {
			szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB3FAIL");
			gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
			szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB3FAIL");
			gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
		}
	}

	setReconPlot(pPlot);
	setMadeAttack(true);
	changeMoves(GC.getMOVE_DENOMINATOR());
	if (pPlot->isActiveVisible(false))
	{
		CvAirMissionDefinition kAirMission;
		kAirMission.setMissionType(MISSION_AIRBOMB);
		kAirMission.setUnit(BATTLE_UNIT_ATTACKER, this);
		kAirMission.setUnit(BATTLE_UNIT_DEFENDER, NULL);
		kAirMission.setDamage(BATTLE_UNIT_DEFENDER, 0);
		kAirMission.setDamage(BATTLE_UNIT_ATTACKER, 0);
		kAirMission.setPlot(pPlot);
		kAirMission.setMissionTime(GC.getMissionInfo((MissionTypes)MISSION_AIRBOMB).getTime() * gDLL->getSecsPerTurn());
		gDLL->getEntityIFace()->AddMission(&kAirMission);
	}
	if (isSuicide())
	{
		kill(true);
	}
	return true;
}

Thanks for this component Dale, its a perfect addition to my slowly growing mod :)
 
Seven05:

You also need to modify airbomb() which is the AI code (see bold code):

Code:
bool CvUnit::airBomb(int iX, int iY)
{
	CvCity* pCity;
	CvPlot* pPlot;
	CvWString szBuffer;

	int randomNum, build;		// Dale

	if (!canAirBombAt(plot(), iX, iY))
	{
		return false;
	}

	pPlot = GC.getMapINLINE().plotINLINE(iX, iY);

	if (!isEnemy(pPlot->getTeam()))
	{
		getGroup()->groupDeclareWar(pPlot, true);
	}

	if (!isEnemy(pPlot->getTeam()))
	{
		return false;
	}

	if (interceptTest(pPlot))
	{
		return true;
	}

	pCity = pPlot->getPlotCity();

	if (pCity != NULL)
	{
		// Dale - RtW: AI missions START
		{[b]
			if (pCity->isCoastal(GC.getMIN_WATER_SIZE_FOR_OCEAN()))
			{
                		randomNum = GC.getGameINLINE().getSorenRandNum(40, "airbomb missions");
			} else {
                		randomNum = GC.getGameINLINE().getSorenRandNum(30, "airbomb missions");
			}[/b]
			if (randomNum <= 10)
			{
				pCity->changeDefenseModifier(-airBombCurrRate());
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_DEFENSES_REDUCED_TO", pCity->getNameKey(), pCity->getDefenseModifier(false), getNameKey());
				gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, m_pUnitInfo->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
				szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_DEFENSES_REDUCED_TO", getNameKey(), pCity->getNameKey(), pCity->getDefenseModifier(false));
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
			} else if (randomNum > 10 && randomNum <= 20) {
				build = GC.getGameINLINE().getSorenRandNum(GC.getNumBuildInfos(), "Airbomb building");
				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
				{
					pCity->setNumRealBuilding((BuildingTypes)build, -1);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB2SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB2SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB2FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB2FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
			} else if (randomNum > 20 && randomNum <= 30) {
				[b]// Dale - Code for Seven05 START
				int iTargetBuildings[13] = {
					GC.getInfoTypeForString("BUILDING_FORGE"),
					GC.getInfoTypeForString("BUILDING_MALI_MINT"),
					GC.getInfoTypeForString("BUILDING_FACTORY"),
					GC.getInfoTypeForString("BUILDING_GERMAN_ASSEMBLY_PLANT"),
					GC.getInfoTypeForString("BUILDING_COAL_PLANT"),
					GC.getInfoTypeForString("BUILDING_JAPANESE_SHALE_PLANT"),
					GC.getInfoTypeForString("BUILDING_HYDRO_PLANT"),
					GC.getInfoTypeForString("BUILDING_NUCLEAR_PLANT"),
					GC.getInfoTypeForString("BUILDING_INDUSTRIAL_PARK"),
					GC.getInfoTypeForString("BUILDING_DRYDOCK"),
					GC.getInfoTypeForString("BUILDING_AIRPORT"),
					GC.getInfoTypeForString("BUILDING_BARRACKS"),
					GC.getInfoTypeForString("BUILDING_ZULU_IKHANDA")};
				iI = GC.getGameINLINE().getSorenRandNum(13, "Airbomb building");
				build = iTargetBuildings[iI];
				// Dale - Code for Seven05 END[/b]
				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
				{
					pCity->setNumRealBuilding((BuildingTypes)build, -1);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB3SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB3SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB3FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB3FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
			} else {
				int iCount = 0;
				CvUnit* pUnit = NULL;
				CLLNode<IDInfo>* pUnitNode;
				CvUnit* pLoopUnit;
				pUnitNode = pPlot->headUnitNode();
				while (pUnitNode != NULL)
				{
					pLoopUnit = ::getUnit(pUnitNode->m_data);
					pUnitNode = pPlot->nextUnitNode(pUnitNode);
					if (pLoopUnit->getDomainType() == DOMAIN_SEA)
					{
						iCount++;
					}
				}
				iCount = (GC.getGameINLINE().getSorenRandNum(iCount, "Choose ship") + 1);
				pUnitNode = pPlot->headUnitNode();
				while (iCount > 0)
				{
					pLoopUnit = ::getUnit(pUnitNode->m_data);
					pUnitNode = pPlot->nextUnitNode(pUnitNode);
					if (pLoopUnit->getDomainType() == DOMAIN_SEA)
					{
						iCount--;
						pUnit = pLoopUnit;
					}
				}
				if (pUnit != NULL)
				{
					int iDamage = (airCombatDamage(pUnit) * 2);
					int iUnitDamage = std::max(pUnit->getDamage(), std::min((pUnit->getDamage() + iDamage), airCombatLimit()));
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_ARE_ATTACKED_BY_AIR", pUnit->getNameKey(), getNameKey(), -(((iUnitDamage - pUnit->getDamage()) * 100) / pUnit->maxHitPoints()));
					gDLL->getInterfaceIFace()->addMessage(pUnit->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_AIR_ATTACK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_ATTACK_BY_AIR", getNameKey(), pUnit->getNameKey(), -(((iUnitDamage - pUnit->getDamage()) * 100) / pUnit->maxHitPoints()));
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_AIR_ATTACKED", MESSAGE_TYPE_INFO, pUnit->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
					pUnit->setDamage(iUnitDamage, getOwnerINLINE());
					if (GC.getGameINLINE().getSorenRandNum(100, "Spin the dice") < 50)
					{
						pUnit->setDamage(GC.getMAX_HIT_POINTS());
						szBuffer = gDLL->getText("TXT_KEY_MISC_YOUSINK_AIRBOMB4SUCCESS");
						gDLL->getInterfaceIFace()->addMessage(pUnit->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
						szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMYSINK_AIRBOMB4SUCCESS");
						gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
					}
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB4FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB4FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
			}
		}
		// Dale - RtW: AI missions END
	}
	else
	{
		if (pPlot->getImprovementType() != NO_IMPROVEMENT)
		{
			if (GC.getGameINLINE().getSorenRandNum(airBombCurrRate(), "Air Bomb - Offense") >=
					GC.getGameINLINE().getSorenRandNum(GC.getImprovementInfo(pPlot->getImprovementType()).getAirBombDefense(), "Air Bomb - Defense"))
			{
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_UNIT_DESTROYED_IMP", getNameKey(), GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide());
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());

				if (pPlot->isOwned())
				{
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_IMP_WAS_DESTROYED", GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide(), getNameKey(), getVisualCivAdjective(pPlot->getTeam()));
					gDLL->getInterfaceIFace()->addMessage(pPlot->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGED", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pPlot->getX_INLINE(), pPlot->getY_INLINE(), true, true);
				}

				pPlot->setImprovementType((ImprovementTypes)(GC.getImprovementInfo(pPlot->getImprovementType()).getImprovementPillage()));
			}
			else
			{
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_UNIT_FAIL_DESTROY_IMP", getNameKey(), GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide());
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMB_FAILS", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
			}
		}
	}

	setReconPlot(pPlot);

	setMadeAttack(true);
	changeMoves(GC.getMOVE_DENOMINATOR());

	if (pPlot->isActiveVisible(false))
	{
		CvAirMissionDefinition kAirMission;
		kAirMission.setMissionType(MISSION_AIRBOMB);
		kAirMission.setUnit(BATTLE_UNIT_ATTACKER, this);
		kAirMission.setUnit(BATTLE_UNIT_DEFENDER, NULL);
		kAirMission.setDamage(BATTLE_UNIT_DEFENDER, 0);
		kAirMission.setDamage(BATTLE_UNIT_ATTACKER, 0);
		kAirMission.setPlot(pPlot);
		kAirMission.setMissionTime(GC.getMissionInfo((MissionTypes)MISSION_AIRBOMB).getTime() * gDLL->getSecsPerTurn());

		gDLL->getEntityIFace()->AddMission(&kAirMission);
	}

	if (isSuicide())
	{
		kill(true);
	}

	return true;
}
 
Seven05:

You also need to modify airbomb() which is the AI code (see bold code):
Thanks, I didn't make it that far, I just made sure it would work for the player :)

Edit:
I actually ended up with this code so the AI has the same abilities as the player (you didn't declare iI in your code BTW, if anybody tries to copy that).
Spoiler :
Code:
bool CvUnit::airBomb(int iX, int iY)
{
	// Seven05: AI support for surgical strike (AirBomb4 mission)
	CvCity* pCity;
	CvPlot* pPlot;
	CvWString szBuffer;
	int iI, iAttempts, iMaxAttempts;
	bool bNoTarget = true;

	int randomNum, build;		// Dale

	if (!canAirBombAt(plot(), iX, iY))
	{
		return false;
	}

	pPlot = GC.getMapINLINE().plotINLINE(iX, iY);

	if (!isEnemy(pPlot->getTeam()))
	{
		getGroup()->groupDeclareWar(pPlot, true);
	}

	if (!isEnemy(pPlot->getTeam()))
	{
		return false;
	}

	if (interceptTest(pPlot))
	{
		return true;
	}

	pCity = pPlot->getPlotCity();

	if (pCity != NULL)
	{
		// Dale - RtW: AI missions START
		{
			if (pCity->isCoastal(GC.getMIN_WATER_SIZE_FOR_OCEAN()))
			{
                		randomNum = GC.getGameINLINE().getSorenRandNum(40, "airbomb missions");
			} else {
                		randomNum = GC.getGameINLINE().getSorenRandNum(30, "airbomb missions");
			}
			if (randomNum <= 10)
			{
				pCity->changeDefenseModifier(-airBombCurrRate());
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_DEFENSES_REDUCED_TO", pCity->getNameKey(), pCity->getDefenseModifier(false), getNameKey());
				gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, m_pUnitInfo->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
				szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_DEFENSES_REDUCED_TO", getNameKey(), pCity->getNameKey(), pCity->getDefenseModifier(false));
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
			} else if (randomNum > 10 && randomNum <= 20) {
				build = GC.getGameINLINE().getSorenRandNum(GC.getNumBuildInfos(), "Airbomb building");
				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
				{
					pCity->setNumRealBuilding((BuildingTypes)build, -1);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB2SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB2SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB2FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB2FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
			} else if (randomNum > 20 && randomNum <= 30) {
				// Dale - Code for Seven05 START
				int iTargetBuildings[13] = {
					GC.getInfoTypeForString("BUILDING_FORGE"),
					GC.getInfoTypeForString("BUILDING_MALI_MINT"),
					GC.getInfoTypeForString("BUILDING_FACTORY"),
					GC.getInfoTypeForString("BUILDING_GERMAN_ASSEMBLY_PLANT"),
					GC.getInfoTypeForString("BUILDING_COAL_PLANT"),
					GC.getInfoTypeForString("BUILDING_JAPANESE_SHALE_PLANT"),
					GC.getInfoTypeForString("BUILDING_HYDRO_PLANT"),
					GC.getInfoTypeForString("BUILDING_NUCLEAR_PLANT"),
					GC.getInfoTypeForString("BUILDING_INDUSTRIAL_PARK"),
					GC.getInfoTypeForString("BUILDING_DRYDOCK"),
					GC.getInfoTypeForString("BUILDING_AIRPORT"),
					GC.getInfoTypeForString("BUILDING_BARRACKS"),
					GC.getInfoTypeForString("BUILDING_ZULU_IKHANDA")};

				iI = GC.getGameINLINE().getSorenRandNum(13, "Airbomb building");
				build = iTargetBuildings[iI];

				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
				{
					bNoTarget = false;
				}

				if (GET_TEAM(GET_PLAYER(getOwner()).getTeam()).isHasTech((TechTypes)GC.getInfoTypeForString("TECH_COMPUTERS")))
				{
					iAttempts = 0;
					if (GET_TEAM(GET_PLAYER(getOwner()).getTeam()).isHasTech((TechTypes)GC.getInfoTypeForString("TECH_LASER")))
					{
						iMaxAttempts = 8;
					}
					else
					{
						iMaxAttempts = 4;
					}

					while (bNoTarget)
					{
						iAttempts++;
						iI = GC.getGameINLINE().getSorenRandNum(13, "Airbomb building");
						build = iTargetBuildings[iI];

						if (pCity->getNumRealBuilding((BuildingTypes)build) > 0 || iAttempts > iMaxAttempts)
						{
							bNoTarget = false;
						}
					}
				}
				// Dale - Code for Seven05 END
				if (pCity->getNumRealBuilding((BuildingTypes)build) > 0)
				{
					pCity->setNumRealBuilding((BuildingTypes)build, -1);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB3SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB3SUCCESS");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB3FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB3FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
			} else {
				int iCount = 0;
				CvUnit* pUnit = NULL;
				CLLNode<IDInfo>* pUnitNode;
				CvUnit* pLoopUnit;
				pUnitNode = pPlot->headUnitNode();
				while (pUnitNode != NULL)
				{
					pLoopUnit = ::getUnit(pUnitNode->m_data);
					pUnitNode = pPlot->nextUnitNode(pUnitNode);
					if (pLoopUnit->getDomainType() == DOMAIN_SEA)
					{
						iCount++;
					}
				}
				iCount = (GC.getGameINLINE().getSorenRandNum(iCount, "Choose ship") + 1);
				pUnitNode = pPlot->headUnitNode();
				while (iCount > 0)
				{
					pLoopUnit = ::getUnit(pUnitNode->m_data);
					pUnitNode = pPlot->nextUnitNode(pUnitNode);
					if (pLoopUnit->getDomainType() == DOMAIN_SEA)
					{
						iCount--;
						pUnit = pLoopUnit;
					}
				}
				if (pUnit != NULL)
				{
					int iDamage = (airCombatDamage(pUnit) * 2);
					int iUnitDamage = std::max(pUnit->getDamage(), std::min((pUnit->getDamage() + iDamage), airCombatLimit()));
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_ARE_ATTACKED_BY_AIR", pUnit->getNameKey(), getNameKey(), -(((iUnitDamage - pUnit->getDamage()) * 100) / pUnit->maxHitPoints()));
					gDLL->getInterfaceIFace()->addMessage(pUnit->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_AIR_ATTACK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_ATTACK_BY_AIR", getNameKey(), pUnit->getNameKey(), -(((iUnitDamage - pUnit->getDamage()) * 100) / pUnit->maxHitPoints()));
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_AIR_ATTACKED", MESSAGE_TYPE_INFO, pUnit->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
					pUnit->setDamage(iUnitDamage, getOwnerINLINE());
					if (GC.getGameINLINE().getSorenRandNum(100, "Spin the dice") < 50)
					{
						pUnit->setDamage(GC.getMAX_HIT_POINTS());
						szBuffer = gDLL->getText("TXT_KEY_MISC_YOUSINK_AIRBOMB4SUCCESS");
						gDLL->getInterfaceIFace()->addMessage(pUnit->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, GC.getUnitInfo(getUnitType()).getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
						szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMYSINK_AIRBOMB4SUCCESS");
						gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
					}
				} else {
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_AIRBOMB4FAIL");
					gDLL->getInterfaceIFace()->addMessage(pCity->getOwnerINLINE(), false, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARDED", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE(), true, true);
					szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_AIRBOMB4FAIL");
					gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szBuffer, "AS2D_BOMBARD", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pCity->getX_INLINE(), pCity->getY_INLINE());
				}
			}
		}
		// Dale - RtW: AI missions END
	}
	else
	{
		if (pPlot->getImprovementType() != NO_IMPROVEMENT)
		{
			if (GC.getGameINLINE().getSorenRandNum(airBombCurrRate(), "Air Bomb - Offense") >=
					GC.getGameINLINE().getSorenRandNum(GC.getImprovementInfo(pPlot->getImprovementType()).getAirBombDefense(), "Air Bomb - Defense"))
			{
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_UNIT_DESTROYED_IMP", getNameKey(), GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide());
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGE", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pPlot->getX_INLINE(), pPlot->getY_INLINE());

				if (pPlot->isOwned())
				{
					szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_IMP_WAS_DESTROYED", GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide(), getNameKey(), getVisualCivAdjective(pPlot->getTeam()));
					gDLL->getInterfaceIFace()->addMessage(pPlot->getOwnerINLINE(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PILLAGED", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pPlot->getX_INLINE(), pPlot->getY_INLINE(), true, true);
				}

				pPlot->setImprovementType((ImprovementTypes)(GC.getImprovementInfo(pPlot->getImprovementType()).getImprovementPillage()));
			}
			else
			{
				szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_UNIT_FAIL_DESTROY_IMP", getNameKey(), GC.getImprovementInfo(pPlot->getImprovementType()).getTextKeyWide());
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_BOMB_FAILS", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pPlot->getX_INLINE(), pPlot->getY_INLINE());
			}
		}
	}

	setReconPlot(pPlot);

	setMadeAttack(true);
	changeMoves(GC.getMOVE_DENOMINATOR());

	if (pPlot->isActiveVisible(false))
	{
		CvAirMissionDefinition kAirMission;
		kAirMission.setMissionType(MISSION_AIRBOMB);
		kAirMission.setUnit(BATTLE_UNIT_ATTACKER, this);
		kAirMission.setUnit(BATTLE_UNIT_DEFENDER, NULL);
		kAirMission.setDamage(BATTLE_UNIT_DEFENDER, 0);
		kAirMission.setDamage(BATTLE_UNIT_ATTACKER, 0);
		kAirMission.setPlot(pPlot);
		kAirMission.setMissionTime(GC.getMissionInfo((MissionTypes)MISSION_AIRBOMB).getTime() * gDLL->getSecsPerTurn());

		gDLL->getEntityIFace()->AddMission(&kAirMission);
	}

	if (isSuicide())
	{
		kill(true);
	}

	return true;
}

And yes Grave, it does simulate smart weapons to a degree. What I should do is add something for misses, like killing off some population or increasing war weariness but I'll save that for my mod, this is just a quick-fix for anybody who wants the ability with Dale's code.
 
Thanks, I didn't make it that far, I just made sure it would work for the player :)

Edit:
I actually ended up with this code so the AI has the same abilities as the player (you didn't declare iI in your code BTW, if anybody tries to copy that).

I just did a quick code paste. It was more important you saw where the code went so you could put what you wanted there. :p

And yes Grave, it does simulate smart weapons to a degree. What I should do is add something for misses, like killing off some population or increasing war weariness but I'll save that for my mod, this is just a quick-fix for anybody who wants the ability with Dale's code.

I'm going to do an update with your code, plus also a pop-kill chance (say 1 in 5 misses will result in a pop-loss).
 
Mod updated!

Added new mission thanks to Seven05 and a chance of population drop during a miss.

Please re-download to get the new version.
 
Top Bottom