Do you want an easy method to allow PCs highly specialized to fight against magic to resist it without just relying on saving throws or an X% chance to avoid the spell entirely? Then use this. Due to the broadness of this concept, it could also easily be ported to be used as a Legendary Resistances for demigod like or high level characters.
When your character fails a spell saving throw, use your character's HD as a monster to factor in their vulnerability. Your character's HD is calculated as a combination of your level + your magic resistance and your magical vulnerability (if any). Magic Vulnerability counts as things like curses and weak willpower, and is only applied occasionally. Magic Resistance can still apply versus spells that do not grant saves; this is your protection instead.
To determine Magic Resistance, use the rule of threes.
- Every singular item that grants +3 to an elemental resistance or spell saves
- Every three items that grant +1 resistance to a specific save, element, or magic effect
- Any item that blocks the effects of a specific spell of at least third level or higher.
For example; if your character carries a wooden leg that makes them immune to the spell Tessoc's Marionette, and carried a cluster of 3 or more coins that granted them bonuses against evil fairy trickery, then you could consider their magic resistance as +2. When calculating their HD against spells, consider it as their actual HD + 2, which could render them immune to some spells.
If the spell is not affected by HD, then instead spell elements may be blocked. If your magic resistance is equal to or higher then the spell level or at least half the monster's HD for spell-like abilities, then you can block a single spell element. For example, if an ice spell freezes you to the ground in addition to dealing cold damage, your resistance lets you block one of the two elements automatically, even if you fail your save or the spell isn't changed by HD. Whichever would be worse to hit you is the one that is resisted. So if you're on death's door, you get stuck to the ground but take no damage. If you have plenty of HP but need to move to strike your target, you take the damage but don't get frozen to the ground, and so on.
Magic Resistance could also be applied when you succeed a saving throw, but the spell has secondary or extra effects beyond the first. Spells that deal multiple dice in damage, but have one or more still apply on a successful saving throw, may have extra damage dice blocked by the magic resistance. Each time you resist a spell or spell effect, your magic resistance number drops by 1. This means as your resistance is depleted you both start becoming susceptible to spells of weaker levels and gain less protection from spells.