Damage to mana first?

sahisahi

Knight
Jan 13, 2016
832
79
28
Lets say theres a spell ''mana shield'' the incoming damage goes to mana pool first, then to the health.

Its this even possible?
 

Falkor

Squire
Apr 11, 2018
300
105
43
wpshard.com
Shard Name
Whispering Pines
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.
 
  • Like
Reactions: sahisahi

sahisahi

Knight
Jan 13, 2016
832
79
28
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;
                    
                }
    
        
        }
}
 
Jun 24, 2016
179
44
28
34
You need to supply more code. What is the method you're overriding? Does that method exist in RunUO even?