Originally Posted by koticgood
One of those links says that Icey removed "hp state" from tower behavior
Whoever said that is wrong. Hardcoded AI still chooses units with low hp (iirc <25%) first.
I guess the following facts are most relevant for AI targeting. Note that these apply to all units, not just towers, but I'm calling it a "tower" here for simplicity.
1. It is mostly hardcoded. The few triggers that exist completely override it.
2. When a tower chooses an enemy target, it will continue attacking it for up to seven seconds or until it can no longer hit it (e.g. out of tower range).
3. Towers choose new targets based on at least four factors: the units' targets (so units attacking the tower or its allies are prioritized over other units), the units' hp, the units' proximity (closer creeps get hit first), and the units' priority (which is a number set individually for each unit).
4. When the current target attacks an ally with more than 25% hp, the tower will immediately choose a new target, but that target could be the same unit.
5. When any unit attacks a hero, a trigger is run that orders enemy creeps in a triggered 500 aoe to attack that unit. Two seconds later its last attack-move (waypoint) order is repeated, ending the aggro. This trigger has a two second cooldown.
6. Siege units are ordered by triggers to attack nearby towers periodically.
7. Neutral creep AI is different. Specifically, neutral creeps always prioritize "player" over neutral factions, so if you pull when there are observers in the game, pushing the Sentinel and Scourge into Neutral Hostile and Neutral Victim slots, the neuts and lane creeps will fight you instead of eachother.
There are of course many other details of AI one could tease out, but these seven should really answer 99.9% of the AI questions on this forum.