Crafting fix
This commit is contained in:
@@ -378,6 +378,9 @@ public class CraftingHandler
|
||||
// Handle stat rolling for equipment
|
||||
if (recipe.HasStatRolls && outputItemDef != null)
|
||||
{
|
||||
_log.LogInformation("Crafting item {ItemName} with stat rolls. MinStr={MinStr}, MaxStr={MaxStr}",
|
||||
outputItemDef.Name, outputItemDef.MinBonusStrength, outputItemDef.MaxBonusStrength);
|
||||
|
||||
var rng = new Random();
|
||||
craftedItem = new DungeonCraftedItem
|
||||
{
|
||||
@@ -393,6 +396,8 @@ public class CraftingHandler
|
||||
// 2x required level = 50% chance for max on each roll
|
||||
// Formula: skillBonus = min(1.0, skill.Level / (recipe.RequiredLevel * 2))
|
||||
float skillBonus = Math.Min(1.0f, (float)skill.Level / (recipe.RequiredLevel * 2));
|
||||
_log.LogInformation("Skill bonus: {SkillBonus} (level {Level} / required {Required})",
|
||||
skillBonus, skill.Level, recipe.RequiredLevel);
|
||||
|
||||
int totalRolled = 0;
|
||||
int maxPossibleTotal = 0;
|
||||
@@ -400,9 +405,13 @@ public class CraftingHandler
|
||||
// Roll each stat that has a range defined on the item
|
||||
rollResults = RollItemStats(outputItemDef, skillBonus, rng, out totalRolled, out maxPossibleTotal);
|
||||
|
||||
_log.LogInformation("Rolled {Count} stats, total={Total}, maxPossible={Max}",
|
||||
rollResults.Count, totalRolled, maxPossibleTotal);
|
||||
|
||||
// Apply rolled stats to the crafted item
|
||||
foreach (var (stat, value) in rollResults)
|
||||
{
|
||||
_log.LogInformation("Applying stat {Stat} = {Value}", stat, value);
|
||||
ApplyStatRoll(craftedItem, stat, value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user