hawkthorne/hawkthorne-journey — pull request #2239 by niamu (2014-10-04 06:21:21+00:00)
Title: Fix enemy flashing on high frequency attacks

After a little guidance from @DaNiwa I was finally able to reproduce #1610. That is not an easy bug to reproduce on a fast machine. It's caused by the hurt state being called faster than the timers can be cancelled before they're recreated again. So with a lot of trial and error I believe I finally have an appropriate fix that has worked very well for me on multiple rounds against the Turkey boss.

Used player flashing as a reference and developed a foolproof method for always making sure that enemy flashing is cancelled at the appropriate time.

**Side note**:

The player node would also be subject to this bug as will were it not for the player being invulnerable when they are hurt and flashing. The added check for whether the player is in an invulnerable state before adding a new flashing timer makes all the difference. Worth noting for the future in case that feature is ever changed.

**Testing recommendations**:
- level: black-caverns-2
- cheats: give_weapons, god
- wait for a while for there to be many projectiles and and mini turkeys on screen
- spam throwing knives as fast as possible at Turkey boss to attempt a constant flashing state