I'm finally rewriting the unmaintainable mess that is Neoband's bookless spell system.
This time around, I've opted for a vaguely OOP-like approach. Spell effects are named functions, spells are structs that include a function pointer. Realms are arrays of spells, and are declared with the function pointer for each spell pointing to the requisite effect function.
It's a bit verbose, but (if it works!) it will allow for a kind of polymorphism; in that I can use one function for all of the bookless realms, invoking each spell effect through the spell's function pointer.
Thus far I've implemented the required functions and reimplemented the original Pyromancer class, with some modifications. The other classes should follow soon, though also with modifications.
Doing this loses me some flexibility in the handling of the different realms. OTOH it cuts out a lot of duplicated code, and lets me add new realms much more easily... Which I suppose is a good thing.
Anyway, just note that I'm still working on this variant, and it should be more playable, more balanced, and less buggy in the near future.
This time around, I've opted for a vaguely OOP-like approach. Spell effects are named functions, spells are structs that include a function pointer. Realms are arrays of spells, and are declared with the function pointer for each spell pointing to the requisite effect function.
It's a bit verbose, but (if it works!) it will allow for a kind of polymorphism; in that I can use one function for all of the bookless realms, invoking each spell effect through the spell's function pointer.
Thus far I've implemented the required functions and reimplemented the original Pyromancer class, with some modifications. The other classes should follow soon, though also with modifications.
Doing this loses me some flexibility in the handling of the different realms. OTOH it cuts out a lot of duplicated code, and lets me add new realms much more easily... Which I suppose is a good thing.
Anyway, just note that I'm still working on this variant, and it should be more playable, more balanced, and less buggy in the near future.
Comment