How do you save delegates' content?

I wanted to create a system in which a player would be able to pick up and equip various different items. Some of these items would then have the ability to trigger certain events when a particular thing happens.

For example, a sword that, when an enemy is hit, regenerates X ammount of HP to the player.

my plan for doing this was to use delegates. i would have a global static class to create them:

public static class OnAfter
{
    public delegate void OnFunction();
}

And then, when a function is called, two delegates are created:

public OnAfter.OnFunction onHit;
public OnAfter.OnFunction afterHit;

With the following “hit” function:

public void Hit(Creature attacker, Creature reciver)
    {
        onHit();
        //other code
        afterHit();
    }

Now, i have a problem: when i want to add something to the onHit() delegate, i just add it with a += when adding an object to the player’s inventory. But when i need to save, the script inside that delegate is lost. After testing some stuff, .JSON does not save delegates’ content (rightfully so), and i’m having a hard time coming up with a solution to this problem (i also have a headache today, so that might also explain why i’m struggling).

Can anyone help me with this?

Have a Map with a (maybe enum?) key and have the delegate as the value. When you save, make sure you save all of the ‘keys’ that the item has, on load, load those keys and += the values again.