Ah, I could have sworn I'd seen this some time in the past. Here it is

.
Originally Posted by DanF5771
Barb Galleys use UNITAI_ATTACK_SEA and thus require their own AI function CvUnitAI::AI_barbAttackSeaMove(). Obviously, you won't find any AI_attackCity or AI_targetCity calls in there, as boats are only allowed to attack units outside cities. Also, there aren't any similar NumCities-thresholds implemented here and the AreaAI of their area (= water!) has no effect. So once they are around, they will check their valid options in the following order:
flip a coin (50% chance) and -if lucky- check whether an improvement can be pillaged this turn (AI_pillageRange(iRange=1))
--> they will move onto Fishing Boats in adjacent tiles and pillage them
.
check whether an enemy unit can be attacked on this or on the next turn (AI_anyAttack(iRange=2, iOddsThreshold=25))
--> they will target your Work Boats 4 tiles away; this can be exploited to keep them away from your improvements by some nice disco-fox dancing or to lure them into the fishing grounds of your neighbors
.
check whether an improvement can be pillaged within 4 turns ((AI_pillageRange(iRange=4))
--> they will use their advanced AI radar to spot your improvements 7 tiles away , however, this radar can only detect improvements in the fog, if they exist for more than 20 turns (improved knowledge!, 5 turns for land units and improvements on land); the closest improvement "wins" (max(pillageValue/pathTurns))
.
AI_heal()
.
AI_patrol()
--> move into a random adjacent tile (iValue = 1...10,000); prefer unowned tiles (+20,000) and tiles not adjacent to borders (+10,000); if movement points left, recalculate ALL options (if the patrol-move reveals a "fresh" improvement, that was hidden from the AI radar in the fog before, option 3 will now be enabled and the respective mission (AI_pillageRange(iRange=4)) will be pushed)