Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just like the previous version (v1) this fix addresses 2 points that still prevent aspd buffs from selecting the correct character. The changes to the fairy, enchanted and awakened code sections remain mostly the same between v1 and this version. The main difference is that for characters who are eligible for an aspd buff, a variable is set in the character's respective init section in Player:init(). The buffing sections can use this variable instead of a more lengthy table search. These variables correspond to the same list added in v1, and are set to true if the character is not on that list.
A similar approach as above for avoiding table searches was used to optimize the cooldown bar update code in arena.lua. The non_cooldown_characters list was removed since it's no longer needed.
The intention is not just avoiding table searches, but also to achieve easier code maintenance. The centralized lists in main have to be updated when new characters are added or existing characters have their attacks modified. By instead placing that information inside the init code on a per character basis, it will be in the same place where their attacks are modified or where new characters are added. This makes it more convenient to update and less likely to forget.
Additional goals that were not achieved: