First, a confession: This isn't really for any particular project. I'm just trying to get a solid handle on the process involved in this trigger for my own education. Any help you can provide is fantastic, and I'm looking for the theoretical best answer more than the easy one. I speak jass if it is useful to answer in code.
So, to it.
Blizzard has a number of "wave" spells, like Carrion Swarm, Shockwave, Impale, Breath of Fire, Breath of Frost, Breath of Lemmings. Mostly these spells are pretty unfortunate: There's no way to easy "get" who the spell affected, they frequently have hardcoded targets or buffs, they lag through doodads and so on.
So I'd like to understand how these spells can be coded. Firstly, one must be able to get all the units/doodads/structures or whathaveyou inside the area that you want to affect. Let's suppose that we have:
- The caster's X/Y
- The angle between the caster and the target X/Y or unit
- The full distance of the wave
- The angle from either side of the casting direction that should also be affected
How do we get what widgets are in that space? It looks like this:
Then there's another level of complexity. This is a wave, so it should affect the closest targets first, then farther out et cetera
. How do we get the widgets in slices of a certain depth of the original area, so that we may affect them in stages? It might look like this:
I ought to tell you that my geometry isn't very fresh, so I welcome any amount of detail you wish to give.