Immunity Logic
By definition, this is an extension of warhead logic by way of adding a quicker method of preventing certain units from being affected by a particular warhead.

Define Your Immunity Types

Firstly, you must define a list of immunity types that will be used on warheads. This is very similar to defining new armor types in that it is a simple list. The advantage is that you can define the same immunity across multiple warheads. However, you can only have up to 200 immunities.

As such:
[ImmunityTypes]
1=Fire
2=Ice
3=Shock
Defining On Warheads
Secondly, you must set up your warheads. This part, though, is very self-explaining.

For example:
[FireWH]
ImmunityType=Fire

[IceWH]
ImmunityType=Ice

[ShockWH]
ImmunityType=Shock
Enabling On Units
Thirdly, you must add the immunity any unit that you want to be immune to a particular warhead. The ImmuneTo tags are not limited, and as such, they accept a list of [ImmunityTypes].

For example:
[SOMEUNIT]
ImmuneTo=Ice
VeteranImmuneTo=Ice,Fire
EliteImmuneTo=Fire,Shock

If you follow the example, when "SOMEUNIT" is created and at rookie level, it is immune to any warhead with ImmunityType=Ice. Now, when this unit ranks up to veteran, it includes any warhead with ImmunityType=Fire in addition to ImmunityType=Ice. However, when the unit reaches its final promotion, it retains ImmunityType=Fire, gains ImmunityType=Shock but then loses ImmunityType=Ice.