Skip to content

Conversation

@MikeJeffers
Copy link

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:

  1. Category A, level 2, type 3
  2. Category A, level 2
  3. Category A
  4. Level 2, type 3
  5. Level 2,
  6. Type 3

If there is no match it defaults to 1.0 as usual.

@MikeJeffers MikeJeffers added enhancement New feature or request Gamma This issue or PR has to do with Gamma Strongholds labels Jan 24, 2021
@MikeJeffers MikeJeffers self-assigned this Jan 24, 2021
@MikeJeffers MikeJeffers merged commit 7d15833 into Development Feb 5, 2021
@MikeJeffers MikeJeffers deleted the prodcost-bytiertype branch February 5, 2021 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Gamma This issue or PR has to do with Gamma P20 Strongholds

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant