yea
change
doPlayerAddSpentMana(p.cid, manaspent)
doTargetCombatMana(0, p.cid, -manaspent, -manaspent, CONST_ME_NONE)
to
if getPlayerMana(p.cid) == getPlayerMaxMana(p.cid) then
doPlayerAddSpentMana(p.cid, manaspent)
doTargetCombatMana(0, p.cid, -manaspent, -manaspent...