Refactor Auto Spell and move its config to libconfig #3237
Merged
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.
Pull Request Prelude
Changes Proposed
This PR was mostly part of #3230 where I have refactored Auto Spell to make easier implement the renewal rebalance. Since these rebalance PRs are taking some time for me to finish and with Keikun's suggestion of moving the config to libconfig, I decided to make this as a separate PR so we can move this part earlier.
This PR moves Auto Spell skill list to LibConfig and reworks the listing/selection logic to remove the if hard to read if chains to something more generic. This way we can implement the renewal rebalance changes with a few lines instead of a huge ugly
#if
/#else
blocks.To avoid as much as possible from breaking something with this rewrite, I made some sort of "unit tests" for Auto Spell to try to cover as many cases as I could. You can check the testing code in this PR in my fork: https://github.com/guilherme-gm/Hercules/pull/9/files#diff-57e0249af7272bf23858146fc95e4674d48e2ffdf89e0824333cb54e232dd56d (Only PRE-RE version of it applies to this PR, and it should work for both pre-re and re)
It is kinda hackish, but this testing PR only extracts the functions to smaller ones with the same names as in this PR so I can test it using a plugin to run as many cases as possible. The same plugin can be used in this PR and it should pass for PRE-RE and RE (if you tweak to use pre-re version of the plugin).
About the decisions on the rewrite:
skill->autospell
renamed to make it clear at which moment this function takes partIf you are wondering how this will cover the rebalance PR, my idea is to add a constant that may be used in
SkillLevel
to indicate to use half of AutoSpell level. From my tests, it should be a simple change and quite clean.Issues addressed:
None