Lets say theres a spell ''mana shield'' the incoming damage goes to mana pool first, then to the health.

Its this even possible?
 
Don't necro summons work like that, pulling their master's mana first and then health when they're attacked? I don't have time right now to dig through the code but maybe that can point you in the right direction.
 
OOOpps just realized the code above is not right it checks for attacker instead of defender backpack, anyway is not working

Defender takes double damage for some reason

C#:
if (attacker != null/* && attacker is PlayerMobile*/ && defender != null && defender is PlayerMobile)
{
    Item manashield = defender.Backpack.FindItemByType(typeof(manashield));

        if (defender.Backpack != null && manashield != null)
        {
            
          int toShield = damage / 2;

                if (defender.Mana >= toShield)
                {
                    defender.Mana -= toShield;
                    damage -= toShield;
                
                }
                else
                {
                    damage -= defender.Mana;
                    defender.Mana = 0;
                    
                }
    
        
        }
}
 
Back