Does Firebolt actually deal "FIRE" damage?
Yeah, it should. But I generally agree with you that using the damage type as a pass/fail filter is a terrible idea. Also match the level of the dummy cast to the level of the original cast!
Angedayle, what Uncle didn't mention here is that while knowing
when a unit takes damage is made trivial by natives/systems it's actually pretty difficult to determine
what action caused that damage.
For example: if a Mountain King attacks me, casts a Thunderclap that hits me and some others, and also is ordered by a trigger to damage me as a part of some spell... all of those will fire the damage event with the damage source as the MK with no way to differentiate between which ability/attack was used. You can't use the damage amounts because those are affected by armor value, armor type, and the damage/weapon type itself. Some systems can determine if damage was done by an attack (as the
Damage from Normal Attack native can now do), but there's no way to tell different spells apart. Code damage can be determined if you plan ahead to keep track of it.
In order to resolve this, the easiest solution is just to not let the MK damage me with its spell directly. Instead of the MK casting Thunderclap or Storm Bolt, a 'fake' dummy ability that does nothing is given to the hero, and upon that cast a trigger creates a dummy caster, gives it the correct 'real' ability before ordering the dummy to cast. Now when the damage event fires you can check to see if the damage was done by a dummy caster, and if that dummy caster also has the Thunderclap ability then the damage was dealt by TC. If the dummy has the Storm Bolt ability then the damage was dealt by SB.
Crucially this requires the dummy caster not to be reused for different spells, and the dummy caster must stay alive until the spell it actually cast can no longer deal any damage. You can reuse the same unit-type dummy for multiple spells, but not reuse the same exact dummy caster unit. (A dummy can of course be reused if all spells it was given are removed from it and it has no active spell effects at the time of reuse.) If the dummy's expiration timer runs out before damage is finished being dealt, it may be impossible to check the damage source since it would return
null rather than the correct caster.