From 105c081aa2e2336411d45badb9da2cfba3aa61b3 Mon Sep 17 00:00:00 2001 From: WinterSolstice8 <60417494+wintersolstice8@users.noreply.github.com> Date: Tue, 3 Feb 2026 08:35:50 -0700 Subject: [PATCH] [core] Adjust RNG calls in synthutils to not truncate --- src/map/utils/synthutils.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/map/utils/synthutils.cpp b/src/map/utils/synthutils.cpp index e39e18758d2..a6453bacff9 100644 --- a/src/map/utils/synthutils.cpp +++ b/src/map/utils/synthutils.cpp @@ -474,7 +474,7 @@ auto calcSynthResult(CCharEntity* PChar) -> uint8 uint8 currentHQTier = 0; // Recipe current available HQ tier, based on current skill ID being checked. float chanceHQ = 0; uint8 maxChanceHQ = 50; - uint8 randomRoll = 0; // 1 to 100. + float randomRoll = 0; // 1.0f to 100.f if (PChar->CraftContainer->getCraftType() == CRAFT_DESYNTHESIS) { @@ -495,10 +495,10 @@ auto calcSynthResult(CCharEntity* PChar) -> uint8 } // Skill is involved. - successRate = 95; // Assume sucess rate is maxed. - randomRoll = 1 + xirand::GetRandomNumber(100); // Random call must be called for each involved skill. 1 to 100 both included. - currentHQTier = 0; // This is reset at the start of every loop. "finalHQTier" is not. - synthDifficulty = getSynthDifficulty(PChar, skillID); // Get synth difficulty for current skill. + successRate = 95; // Assume sucess rate is maxed. + randomRoll = xirand::GetRandomNumber(1.0f, 100.f); // Random call must be called for each involved skill. 1 to 100 both included. + currentHQTier = 0; // This is reset at the start of every loop. "finalHQTier" is not. + synthDifficulty = getSynthDifficulty(PChar, skillID); // Get synth difficulty for current skill. // Skill is at or over synth recipe level. if (synthDifficulty <= 0) @@ -617,17 +617,17 @@ auto calcSynthResult(CCharEntity* PChar) -> uint8 chanceHQ = maxChanceHQ; } - randomRoll = 1 + xirand::GetRandomNumber(100); + randomRoll = xirand::GetRandomNumber(1.0f, 100.f); if (randomRoll <= chanceHQ) // We HQ. Proceed to selct HQ Tier { synthResult = SYNTHESIS_HQ; - randomRoll = 1 + xirand::GetRandomNumber(100); + randomRoll = xirand::GetRandomNumber(1.0f, 100.f); if (randomRoll <= 25) // 25% Chance after HQ to upgrade to HQ2 { synthResult = SYNTHESIS_HQ2; - randomRoll = 1 + xirand::GetRandomNumber(100); + randomRoll = xirand::GetRandomNumber(1.0f, 100.f); if (randomRoll <= 25) // 25% Chance after HQ2 to upgrade to HQ3 {