wfl 'poisoner_eval.fai'

{AI_CA_COMBAT_SCORE} + 100 +
#rate units with regeneration as worse targets #
if( find( villages, self = target.loc ), -10, 0 ) +
# units next to healers/curers are also bad targets #
min(	map(
		filter(
			map( adjacent_locs(target.loc),
				unit_at(self)
			),
			'unit', index_of(unit.side, enemies) != -1 and unit.abilities
		), 'unit_with_sp',
		if( index_of('healing',unit_with_sp.abilities) != -1, -5, 0 ) +
		if( index_of('curing',unit_with_sp.abilities) != -1, -5, 0 )
	) .. [0]
) +
#leader is always a good target! #
if( target.canrecruit, 50, 0 ) +
# consider target abilities if needed #
if( target.abilities,
	if( index_of('regenerates', target.abilities) != -1, -10, 0 ) +
		if( index_of('healing', target.abilities) != -1, 10, 0 ) +
		if( index_of('curing', target.abilities) != -1, 10, 0 ) +
		if( index_of('leadership', target.abilities) != -1, 15, 0 ),
	0
)

wflend
