Feat affordability preview improved #346
Closed
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.
This contains two deprecation commits. The feature of this PR is in the main
featcommit, so you may wanna look into the diff of that commit only to get an overview of how it works.I would like to deprecate the scheduled changes system of skills because, while it is an interesting idea, I think there are plenty of ways to work around it if you design/implement skills in a smart way. Personally I have never used it, and I believe it is a bloat to support further.
This is a massive improvement over the current Affordability Preview system we have in MSU which I implemented in #88. That system is convoluted to work with from the user's perspective and is also limited in certain aspects. The new system is far more intuitive and in fact covers some edge cases which the old system failed in.
Old System (the one this PR deprecates):
modifyPreviewFieldandmodifyPreviewPropertyfunctions from inside a skill'sonAffordablePreviewfunction. The parameters of those functions are convoluted to work with.onUpdate,onAfterUpdate, andexecuteScheduledChangesfunctions and then applies the new change.New System:
onUpdatePreviewandonAfterUpdatePreviewwhich by default call their regular counterparts. But you can overwrite these functions for custom functionality during previewing.skill_containerin between getting the affordability status of skills and their cost string. This is probably less "efficient" than the old system but honestly this is better and I wish I had done it this way the first time around.Example:
Let's say I have a skill which after at least 2 tiles reduces the AP cost of all attacks by 1. But this effect expires when you use any skill.
Old System usage:
New System: