Precompute base progress/quality increases

This commit is contained in:
Asriel Camora
2023-06-20 17:07:16 -07:00
parent 1d0d4cf8ce
commit cdd4f5923e
8 changed files with 55 additions and 38 deletions
+27 -3
View File
@@ -2,9 +2,33 @@ namespace Craftimizer.Simulator;
public readonly record struct SimulationInput
{
public CharacterStats Stats { get; init; }
public RecipeInfo Recipe { get; init; }
public Random Random { get; init; }
public CharacterStats Stats { get; }
public RecipeInfo Recipe { get; }
public Random Random { get; }
public int BaseProgressGain { get; }
public int BaseQualityGain { get; }
public SimulationInput(CharacterStats stats, RecipeInfo recipe, int seed)
{
Stats = stats;
Recipe = recipe;
Random = new Random(seed);
// https://github.com/NotRanged/NotRanged.github.io/blob/0f4aee074f969fb05aad34feaba605057c08ffd1/app/js/ffxivcraftmodel.js#L88
{
var baseIncrease = (Stats.Craftsmanship * 10f / Recipe.ProgressDivider) + 2;
if (Stats.CLvl <= Recipe.RLvl)
baseIncrease *= Recipe.ProgressModifier / 100f;
BaseProgressGain = (int)baseIncrease;
}
{
var baseIncrease = (Stats.Control * 10f / Recipe.QualityDivider) + 35;
if (Stats.CLvl <= Recipe.RLvl)
baseIncrease *= Recipe.QualityModifier / 100f;
BaseQualityGain = (int)baseIncrease;
}
}
public Condition[] AvailableConditions => ConditionUtils.GetPossibleConditions(Recipe.ConditionsFlag);
}