Alternate between Enemy AI attacks and movment

Hi, i’m dealing with a problem in which my boss is too easy to beat with low values, and with medium/hard values of damage it’s almost impossible to outdamage it, the thing is that i have some long range attacks but they are almost only triggered at the begging of the fight when the player is reaching the enemy, once the enemy is within a close range it will only melee attack and keep attacking until either it dies or the player dies. The thing is, i wanted to implement a function to alternate the attacks and a certain movment to target points, that way the AI would move to that point, then attack long range and then once it reaches the player again attack close range and repeat, sadly it didn’t worked and i wanted to know why.