If the mana orbs in your container are not working when the player’s mana container is halved from having not killed his shade yet, it is due to the mana gain being set to increase only when mana is more than 1.
To fix this, change the else statement from if(Mana < 1) to if (!halfMana && Mana < 1 || (halfMana && Mana < 0.5)).
This will allow the mana orbs to gain mana even when the main mana container is halved.