Production cost: by category and/or tech and/or techtype #275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we only needed to map cost by just a category or just a tech level - that was the MVP at the time.
Now we have our first case of wanting different cost based on tierLevel and tierType.
Soon gamma too will want to mix category and level as well.
Thus this refactor removes caching lookup dictionaries by just one particular key, and instead pulls the table into one collection to be filtered on dynamically.
Each EntityDefault will match against ProductionCost entries by category, tierType, and tierlevel, and pick the one that matches the most of these filters - scoring them based on number matched.
Because there can be ties (category and level, level and type) a weight is set for each match to weigh the most important thing to filter by, then the differentiators. Category>Level>Type.
For example if a level 2, category A, type 3 item will only match the production cost in the following order, picking the first one that matches:
If there is no match it defaults to 1.0 as usual.