FloricSpacer / AbyssDiver

12 stars 12 forks source link

Companion & curse rework #99

Closed Annonymus-v02 closed 1 year ago

Annonymus-v02 commented 1 year ago

Defines classes for characters, curses and events and includes the toJson and clone methods which allow SugarCube to deserialise them back into the proper class. All events are now in one queue, attached to the character (Character.events), and curses are events too. Most of the computed properties, like lewdness, assets etc. are now computed on-demand by going through the events and applying them all. This also has the effect of decreasing size of save files. Also includes a plethora of bug fixes found while going through the code to adapt usages to the new format. I tried to make things as backwards-compatible as possible, so for example the curses' variation properties will still work as expected, but for higher code quality it is recommended to use the new properties with more descriptive names (e.g., hairColor). Also it's not possible for everything, so there are a few things that may not work as expected anymore. I have to admit my implementation of the clone and toJSON methods is a bit hacky. If you have an idea for how to do it more cleanly, let me know.

The new files have numeric prefixes. These are necessary to determine the order in which tweego includes them in the result, to make sure files that depend on each other are executed in the right order.

I went through all the twee files to use the curses in the new way, but I did so fairly superficially, there are still improvements to be made, such as using the curses' new incompatibility list instead of manually checking for known incompatible curses.

I'd appreciate it if you could tell me about any operations on curses or characters you find yourself doing frequently, such as adding a curse or checking if a character has a curse, so I can make a function that does it for you, like I did for those examples to reduce the repetition in the code base.

Some future improvements that are left:

[^1]: Actually it did so inconsistently, sometimes and sometimes not. I've fixed it so now it always does.