I did a whole bunch of refactoring to the updateEffects function of skill.js. I introduced a lot of additional functions to make the main method easier to read.
The important changes:
The merging of the baseEffects and activeSteps is now done in an extra function mergeEffectsAndSteps. I changed the main "algorithm" behind it. Like before, all attribute values are combined into a list for each attribute.
To ensure that the lists have the correct ordering, they get sorted afterwards, depending if an element is a divisor or not. This sorting can easily be extended in such a way that adding and multiplying (+ and +%) has the correct order as well - if necessary.
The merging of the baseEffect and the upgrades into one attribute is now done in applyUpgrades (for all of them), applyUpgrade (for one specific attribute) and applyOperation (executing the number operation, e.g. x += y, x *= 1 + y, etc.).
This refactoring is the first step to enable multi staged upgrades natively (see branch damage-stages).
I did a whole bunch of refactoring to the
updateEffects
function of skill.js. I introduced a lot of additional functions to make the main method easier to read. The important changes:baseEffects
andactiveSteps
is now done in an extra functionmergeEffectsAndSteps
. I changed the main "algorithm" behind it. Like before, all attribute values are combined into a list for each attribute. To ensure that the lists have the correct ordering, they get sorted afterwards, depending if an element is a divisor or not. This sorting can easily be extended in such a way that adding and multiplying (+ and +%) has the correct order as well - if necessary.applyUpgrades
(for all of them),applyUpgrade
(for one specific attribute) andapplyOperation
(executing the number operation, e.g. x += y, x *= 1 + y, etc.).This refactoring is the first step to enable multi staged upgrades natively (see branch damage-stages).