Weekly Update #3 - Bouncing Projectiles
Added 2021-01-15 01:56:39 +0000 UTCI wanted to add a character who's attacks chain bounced to other enemies. The number of bounces could be changed and I wanted it to be an addon to an existing attack, so I made it an Effect that can be added to a spell.
First let's break down the requirements:
Bounce strike should:
- Prioritize new (un-hit) targets
- Bounce to the closest target
- If no new targets, bounce to the oldest target that is still alive
If bounces is greater than 0, we run the following actions:
1. Clone the spell
2. Reduce the new cloned spell's remaining bounces by 1
3. Set the new cloned spells'
location to: "NearestOtherToTargetHit"
pattern to: "PrioritizeUnhit"
origin tile to the hit unit's tile
4. If this is not the original spell, Despawn it
Now how do we prioritize unhit? Well, every time the spell hits an enemy, we can add that enemy to a list of Hit Beings. If the list already contains the enemy, we just move it to the end of the list. Then when we are prioritizing Un Hit enemies, we get the list of All Enemies and for each enemy in our list of Hit Beings, if the list of All Enemies contains the Hit Being, we move that Enemy to the end of the list.
This will happen in the order we hit the enemies, so the most recently hit Enemy will be at the very end of the "All Enemies" list!
I don't really like how you can embed webm's here since I'm too lazy to make gifs. Maybe when this goes public I'll start making gifs? I'll just upload the webm for now.