Damage to mana first?

sahisahi

Well-Known Member
Jan 13, 2016
744
29
Lets say theres a spell ''mana shield'' the incoming damage goes to mana pool first, then to the health.

Its this even possible?
 

Falkor

Well-Known Member
Apr 11, 2018
124
36
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

Well-Known Member
Jan 13, 2016
744
29
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;
                    
                }
    
        
        }
}
 

Anon the Felon

Well-Known Member
Jun 24, 2016
148
30
33
You need to supply more code. What is the method you're overriding? Does that method exist in RunUO even?