Hello,
You can try it:
ret=1;
if (UnitPower("player" ,SPELL_POWER_ENERGY) <= 74) then ret = 0; return; end
local nameSpell = GetSpellInfo(51713);
if (not nameSpell) then return; end
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId = UnitBuff("player", nameSpell);
if (not expirationTime) then return; end
local expireTimeLeft = expirationTime-GetTime();
if expireTimeLeft > 6 then ret = 0 end
I have added line:
if (UnitPower("player" ,SPELL_POWER_ENERGY) <= 74) then ret = 0; return; end
or you can use condition "Energy".