That looks like something that should in no way work. You aren't allowed to use macros that make combat decisions for you, including casting based on the presence or absence or buffs/debuffs, amount of health or energy.