Find all the auras you can get out of,
Do an:
If(hasaura1 || hasaura2 || hasaura3)
{
if(inbearform && cancast kittyform)
{
cast.kitty
StyxWoW.SleepForLagDuation
Thread.Sleep(1100) //for the global CD
cast.bear
}
}
Have a look at the propertie Mechanic of object WoWSpell with the enumeration WoWSpellMechanic to know if you are slowed if you don't want to check every aura in WoW.