Yes and no... I know how AI systems work... they run in a loop over and over, detecting for changes in the players.... like for example, say in C++:
while (true) {
if (player1.hasBuiltFactory == true) {
ai.destroyFactory();
}
}
See what I mean?
generally games use a "personality" system to determine what it does when another player takes an action...
For attacks the AI should take into account the number and how powerful the units coming are..... maybe scan the map into "zones" and check each zone nearby the base for attacks, etc.