steventhorne / legendhub

Source code for the legendhub website.
https://www.legendhub.org
MIT License
3 stars 3 forks source link

Improve rune charm options to reduce duplicate code #139

Closed steventhorne closed 1 year ago

steventhorne commented 1 year ago

Expected Behavior

All rune charm information should be included in the charmOptions variable. This will help reduce the duplicate boilerplate code when computing rune charm stats.

Current Behavior

Currently there are large switch/case statements that have duplicate code which will be difficult to maintain.

Context

Reducing duplicate boilerplate code makes the code easier to maintain. It also prevents hard to find bugs by ensuring that duplicate paths share the same code and will fail for every case instead of just one or two cases.

Ner-f commented 1 year ago

I updated the charmOptions to include the stats and reduced the code in the runecharm functions. I also changed the selectors to an array so its easier to iterate through them and looks a bit cleaner.

steventhorne commented 1 year ago

Fixed in #141