public static void WaitWhileCasting(CastingBreak statCheck, double breakValue, WoWUnit targetCheck) { Thread.Sleep(150); while (Me.IsCasting) { Thread.Sleep(100); switch (statCheck) { case CastingBreak.None: Thread.Sleep(1); break; case CastingBreak.HealthIsAbove: if (targetCheck.HealthPercent > breakValue) { Spell.StopCasting(); return; } break; case CastingBreak.HealthIsBelow: if (targetCheck.HealthPercent < breakValue) { Spell.StopCasting(); return; } break; case CastingBreak.PowerIsAbove: if (targetCheck.PowerPercent > breakValue) { Spell.StopCasting(); return; } break; case CastingBreak.PowerIsBelow: if (targetCheck.PowerPercent < breakValue) { Spell.StopCasting(); return; } break; } } }