This is not an AI thing, however. It's a flag, to know when a spell is effective or not. It knows when it's a good idea to cure someone of poison, because the person is poisoned. It knows when it's a good idea to heal someone, because they are damaged. If not, the pet would just be randomly spamming cures and heals for no reason at all.