That's because typing code without being able to test it sucks...It looks ok to me...but maybe try this one...I'm not a huge fan of the syntax I was using for the debuffs...so maybe try it like this:
Code:
/run if UnitCastingInfo("target") and GetSpellCooldown("Wind Shear")==0 then SpellStopCasting() CastSpellByName("Wind Shear") end
/run if GetSpellCooldown("Shamanistic Rage")==0 and UnitMana("player")/UnitManaMax("Player")<0.20 then CastSpellByName("Shamanistic Rage") end
/run local _,_,_,c=UnitBuff("player","Maelstrom Weapon") if c==5 then CastSpellByName("Lightning Bolt") end
/run local i=1; while(i<=40) do n,_,_,_,_,_,_,c,_,_=UnitDebuff("target",i); if n=="Flame Shock" and c=="player" then break else i=i+1 end end; if i>40 then CastSpellByName("Flame Shock") end
/run local i=1; while(i<=40) do n,_,_,_,_,_,_,c,_,_=UnitDebuff("target",i); if n=="Stormstrike" and c=="player" then break else i=i+1 end end; if i<=40 then CastSpellByName("Earth Shock") end
/run local i=1; while(i<=40) do n,_,_,_,_,_,_,c,_,_=UnitDebuff("target",i); if n=="Stormstrike" and c=="player" then break else i=i+1 end end; if i>40 then CastSpellByName("Stormstrike") end
/run if GetSpellCooldown("Earth Shock")==0 then CastSpellByName("Earth Shock") end
/run local _,t,_,_ = GetTotemInfo(1); if totemname==nil or totemname=="" then CastSpellByName("Magma Totem") end
/run local _,_,_,c=UnitBuff("player","Lightning Shield") if c~=nil and c<=1 then CastSpellByName("Lightning Shield") end
/run if GetSpellCooldown("Lava Lash")==0 then CastSpellByName("Lava Lash") end
/run local _,t,_,_ = GetTotemInfo(1); if (totemname==nil or totemname=="") and GetSpellCooldown("Fire Nova")==0 then CastSpellByName("Fire Nova") end