From 34b2dd8a559cf5dadb3ccedf434ba9a8a6dbac45 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Thu, 12 Nov 2026 11:03:07 +0000 Subject: [PATCH] Decompile fn_23363 (CSession::GetEnemyHitWaveName) Batch #18107 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_23363 CSession::GetEnemyHitWaveName: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, KWDev, bibinir Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/Client/Session/Session.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Source/Client/Session/Session.cpp b/Source/Client/Session/Session.cpp index 3fd005de5..c0ba79ae2 100644 --- a/Source/Client/Session/Session.cpp +++ b/Source/Client/Session/Session.cpp @@ -717,16 +717,25 @@ int CSession::FindSkillFollowEffect(int key) const { // FUNCTION: fn_23363 const char* CSession::GetEnemyHitWaveName(int element) { switch (element) { - case ELE_FIRE: - switch (std::max(std::rand() % 2, 0)) { + case ELE_FIRE: { + int roll = std::rand() % 2; + if (roll < 0) { + roll = 0; + } + switch (roll) { case 0: return "_enemy_hit_fire1.wav"; case 1: return "_enemy_hit_fire2.wav"; } break; - case ELE_WIND: - switch (std::max(std::rand() % 2, 0)) { + } + case ELE_WIND: { + int roll = std::rand() % 2; + if (roll < 0) { + roll = 0; + } + switch (roll) { case 0: return "_enemy_hit_wind1.wav"; case 1: @@ -734,8 +743,10 @@ const char* CSession::GetEnemyHitWaveName(int element) { } break; } + } - switch (std::max(std::rand() % 4, 0)) { + int roll = std::rand() % 4; + switch (roll >= 0 ? roll : 0) { case 0: return "_enemy_hit_normal1.wav"; case 1: