KonaeAkira / raphael-rs

Crafting rotation optimizer / macro generator for Final Fantasy XIV
https://www.raphael-xiv.com/
Apache License 2.0
67 stars 14 forks source link

Implement Trained Eye #38

Closed periodically-makes-puns closed 2 months ago

periodically-makes-puns commented 2 months ago

Resolves #33.

Most of the file changes are due to the signature of ActionMask::from_level changing to accommodate Trained Eye.

The level attribute in Recipe is possibly redundant, since I think it can be computed from recipe_level. I'm not sure whether this is actually true or not, so right now it just reads the level from the RecipeLevelTable.

The two tests in game_data/tests/test_get_game_settings.rs cover the case where Trained Eye is not applicable due to being an expert craft, and the case where Trained Eye is applicable. The Ponzecake test should cover the case where Trained Eye is not applicable due to insufficient level difference.

Issues:

KonaeAkira commented 2 months ago

Thank you for your contribution! This looks great!

About the issues you listed:

  1. You don't need to hard-code prioritizing Trained Eye over Reflect (or any other quality action). The solver will figure it out on its own (states that don't use Trained Eye should very quickly become Pareto-dominated by states that use Trained Eye).
  2. This is my fault. The quality value in states is actually stored as missing quality. Back then. the intention was to use u16::saturating_sub to guarantee that the quality never goes over max quality. I wanted to avoid using quality = std::cmp::min(max_quality, quality) I should have reverted this when implementing the quality overflow view. Right now, it works by using an ugly hack: for the simulation view, settings.max_quality is set to u16::MAX, the state is generated from the action list, then settings.max_quality is set back to normal.

You're welcome to change state.missing_quality to state.quality. Or, if you don\t want to do it., create another PR for the develop branch and I will take it from there :)