Fix aspd buffing v2#19
Open
nmaligec wants to merge 2 commits into
Open
Conversation
This uses the same approach as the v1 fix, but checks a variable set directly on the unit itself instead of checking a global table. Manually set the can_use_aspd variable to true in each unit section in Player:init, where the unit has a timed action with tag 'shoot' or 'attack'.
Similar to the aspd buff changes, the draw code now checks a variable set directly on the unit, instead of going through a table. Manually added the has_cooldown variable to each appropriate unit section in Player:init. Also removed the non_cooldown_characters table from main.lua, as the only place that uses it has been modified in a way that no longer needs it. Note: Even though the pyromancer and cryomancer do damage on a timer, it is handled by the DotArea code and so the variables needed to fill their charge bar never get set. These are the only two characters that exclussively attack through dot damage routines. For both, the cooldown flags were left false by default. Originally they were left out from the list of non_cooldown_characters.
Author
|
Issues are turned off and since I touch on the relevant section of code here, I'll note it here. Some characters are unintentionally more rare than othersIn the code for the buy screen, it checks if the 3 character buy options are all contained in a special list of non_attacking_characters. It keeps reselecting until at least one character is not on the list. This roughly reduces the chance of getting, say a squire, by the chance that the other two are not on the restricted list. The current list of restricted characters is: cleric, stormweaver, squire, chronomancer, sage, psykeeper, bane, carver, fairy, priest, flagellant, merchant, miner |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: