Elemental Master, Variant (5e Feat)
From D&D Wiki
Prerequisites: One damage dealing spell
First pick a damage type for your spells, (like Fire, Thunder, Cold, Necrotic), you have 30 charges to switch between elements. Whenever you cast a damage-dealing spell, you can now substitute the spell's damage type with the chosen type. Any spell effects and parameters besides damage type remain unchanged. You may identify any elemental weaknesses in enemies by sense. You gain resistance with the chosen element and are weak against the opposite element.