Working on crafting fixes
This commit is contained in:
@@ -392,18 +392,43 @@ public class CraftingHandler
|
||||
CraftingLevelAtCreation = skill.Level
|
||||
};
|
||||
|
||||
// Calculate skill quality bonus
|
||||
// Formula creates a curve where you need to significantly overlevel the recipe to get perfect rolls
|
||||
// At required level: ~10% chance for max
|
||||
// At 2x required level: ~40% chance
|
||||
// At 4x required level: ~75% chance
|
||||
// At 10x required level: ~95% chance
|
||||
float levelRatio = (float)skill.Level / Math.Max(1, recipe.RequiredLevel);
|
||||
float skillBonus = Math.Min(0.95f, (levelRatio - 1f) / 10f); // Caps at 95% to keep some RNG
|
||||
skillBonus = Math.Max(0.05f, skillBonus); // Minimum 5% chance
|
||||
// Calculate skill quality bonus using EXPONENTIAL scaling
|
||||
// Every time you double the level requirement, your chance for perfect rolls increases exponentially
|
||||
//
|
||||
// Example: Recipe requires level 1, has 5 stats rolling 1-100 each
|
||||
// - At level 1 (1x): ~0.1% chance per stat = 0.00000000001% for all 5 perfect (basically impossible)
|
||||
// - At level 2 (2x): ~1% chance per stat = 0.000000001% for all 5 perfect (extremely rare)
|
||||
// - At level 4 (4x): ~10% chance per stat = 0.001% for all 5 perfect (very rare)
|
||||
// - At level 8 (8x): ~30% chance per stat = 0.24% for all 5 perfect (rare)
|
||||
// - At level 16 (16x): ~60% chance per stat = 7.7% for all 5 perfect (uncommon)
|
||||
// - At level 32 (32x): ~85% chance per stat = 44% for all 5 perfect (common)
|
||||
// - At level 64 (64x): ~95% chance per stat = 77% for all 5 perfect (very common)
|
||||
//
|
||||
// Formula: skillBonus = 1 - (0.999^(2^doublings))
|
||||
// This creates exponential growth where each doubling significantly increases your odds
|
||||
|
||||
_log.LogInformation("Skill bonus: {SkillBonus:F2} (level {Level} / required {Required}, ratio {Ratio:F2})",
|
||||
skillBonus, skill.Level, recipe.RequiredLevel, levelRatio);
|
||||
float levelRatio = (float)skill.Level / Math.Max(1, recipe.RequiredLevel);
|
||||
|
||||
// Calculate how many times we've doubled the requirement (log base 2)
|
||||
double doublings = Math.Log(levelRatio, 2);
|
||||
|
||||
// Exponential formula: each doubling dramatically increases quality
|
||||
// Using 0.999 as base means at exactly the requirement you have ~0.1% chance
|
||||
// At 2x (1 doubling) = ~1% chance
|
||||
// At 4x (2 doublings) = ~10% chance
|
||||
// At 8x (3 doublings) = ~30% chance
|
||||
// At 16x (4 doublings) = ~60% chance
|
||||
double exponentialFactor = Math.Pow(2, doublings);
|
||||
float skillBonus = (float)(1.0 - Math.Pow(0.999, exponentialFactor));
|
||||
|
||||
// Cap at 99% to keep some RNG element even at extreme overleveling
|
||||
skillBonus = Math.Min(0.99f, skillBonus);
|
||||
|
||||
// Ensure minimum of 0.1% chance even at minimum level
|
||||
skillBonus = Math.Max(0.001f, skillBonus);
|
||||
|
||||
_log.LogInformation("Skill bonus: {SkillBonus:F4} (level {Level} / required {Required}, ratio {Ratio:F2}x, doublings {Doublings:F2})",
|
||||
skillBonus, skill.Level, recipe.RequiredLevel, levelRatio, doublings);
|
||||
|
||||
int totalRolled = 0;
|
||||
int maxPossibleTotal = 0;
|
||||
|
||||
Reference in New Issue
Block a user