My ai logic typically uses variables to determine the state of the AI and then logic is in an if-else if type of structure.
For example:
I have an AI Monster called Slime. The slime has 3 behavior states.
Peaceful: 0
Aggressive: 1
Attacking: 2
The slime has Instance variables:
Level
Behavior
the game then compares the slime level and player level
if(slime.Level > Player.Level)
if(Player is near Slime) Behavior = 2
else Behavior = 1
else Behavior = 0
Then the game can choose which AI to implement based off of this.
For each slime
if(behavior = 0) Implement peaceful AI
else if(behavior =1) implement an aggressive AI
else is in combat, do combat AI.
Something like that can be taken further and broken down as much or little as needed, looking at things such as health, items, environment anything.
the very important aspect of this is being able to differentiate one slime from another and properly pick the slime based on the behaviors etc. For this, I find instance variables to be invaluable in dynamic/diverse AI's