Dealing damage to enemy using colour

How would i go about dealing damage to let’s say a blue enemy using a blue weapon and the enemy changes color after taking set damage and the player would have to use a different colored gun to damage them?

Thanks