Today's task was refactoring the level up logic out of the UI widget where it was and into a separate class (I have named it Leveler) that contains all the logic and none of the state.
This is required so that the Leveler can be called from a different place to the UI. This new place is an automated character builder that can be parameterised with various strategies for developing a character and then asked to churn out a given player character (class/race/gender/etc) at a given level, applying the parameterised build at each level.
The automated character builder is required for a few reasons. I want to be able to automate various builds across all the different character classes and then run them through a "scorer" to determine their relative power, and also run them in a party through a simulated adventure.
As a bonus the code is now a lot more testable, not that I have time to write much in the way of tests.
The lesson here, children: don't put your business logic in your UI code.
No comments:
Post a Comment