flare-engine
flare-engine copied to clipboard
Autotarget Closest
One of the biggest challenges I'm having in trying to create a chain lightning post power is figuring out how to get it to target properly. Would it be possible to create a target_closest bool that targets hazards towards the closest valid target (in pixels?) with direct line of sight?
Perhaps instead of being a boolean, it should be a range, to target_closest within a pixel range, so that it doesn't search the entire map for a target.
I think we can do this. But watch out for these possible issues:
- The literal "closest" enemy will be the one that chain lightning has already hit. So the target closest code might need an optional "ignore enemy X" parameter.
- Even after the target is chosen and the hazard is created, make sure that hazard cannot hit the source enemy. If a hazard that targets enemies spawns right on top of an enemy, it will just hit that one again.
I wasn't sure whether or not this should be separated from the second possible problem you mentioned - you might want a power that targets closest with the source being the caster (passive power on an item, desc=fires thorns at the closest enemy). I have run into problems when having the second stage of a power spawn a new hazard from the targeted enemy, so this is a real concern and may need it's own solution.
Edit: the more I think about it, the more it doesn't have to be a separate solution - if it's set to avoid hitting the enemy it spawns on top of, it won't interfere with a hazard spawned from the hero set to target_closest.