So we all know you could do something along these lines to apply 100 magic damage to a creature:
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(100), oTarget);
However, if oTarget has 50% magic immunity and 50 magic resist he won't take any damage. Is there a way to get around this?
If you're wondering why I ask, it's due to my HP display script that I'm improving at the moment. Specifically I'm trying to make it play nicely with heals by default -- which means if a creature has 10 max HP, 100k total scripted HP (so 90k hidden initially), and 15k effective HP they'd be sitting at 2499 actual HP and 12501 hidden HP (so they appear Near Death). However, if they get healed for 5k HP then they'll shoot up to 7499 HP and appear Injured instead.
Now, my script will update their health percentage correctly (since it considers both actual and hidden HP) -- but ideally I'd like to be able to detect that they're above 2499 HP while being below 25% effective HP (easy to do), knock their HP back down to 2499 (the point of this thread), and then bump their hidden HP up by 5000 (easy to do) which gets everything back on track as the player has 2499 actual HP and 127501 hidden HP at the end (20% health and thus stays at "Near Death").
If the target doesn't have resistances, vulnerabilities, or immunities that's simple (just apply 5000 damage of some type in this case) -- but I'm not sure what to do if they do possess one or more of those. Ideally I want a "pure/true" damage value like the DamageEffectIncrease for non-physical damage but applied via scripting instead of a creature having to swing a weapon.
Another example where this would be a problem is if a creature has a lot of regeneration -- they might be brought down to, say, 36% HP (and thus slip into Badly Wounded) and then start regenerating. But since they're "held" at 49.9% of HP the regeneration will nudge them back into "Injured" status.
Obviously this is mainly a visual display issue and the builder can always get around this by adding hidden HP rather than an actual heal effect...but it would be nice to be able to fix this problem.