From bd898f8d19a32772287437cd97bc979911159138 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Thu, 4 Sep 2025 17:18:42 -0500 Subject: [PATCH] fix the minmax calls on success chance printing --- src/game/boe.party.cpp | 4 ++-- src/game/boe.town.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/boe.party.cpp b/src/game/boe.party.cpp index 2f04b152..e621cdf3 100644 --- a/src/game/boe.party.cpp +++ b/src/game/boe.party.cpp @@ -1394,7 +1394,7 @@ void cast_town_spell(location where) { }else{ total_modifier = -5 * adj + 5 * univ.town.door_diff_adjust() + univ.scenario.ter_types[ter].flag2 * 7; r1 = get_ran(1,1,100) + total_modifier; - success_chance = minmax(min_fail_roll - 1 - total_modifier, 0, 100); + success_chance = minmax(0, 100, min_fail_roll - 1 - total_modifier); } if(r1 < min_fail_roll) { add_string_to_buf(" Door unlocked."); @@ -1416,7 +1416,7 @@ void cast_town_spell(location where) { if(univ.town.is_fire_barr(where.x,where.y)) total_modifier -= 8; short min_fail_roll = (120 - combat_percent[min(19,level)]); - short success_chance = minmax(min_fail_roll - 1 - total_modifier, 0, 100); + short success_chance = minmax(0, 100, min_fail_roll - 1 - total_modifier); r1 = get_ran(1,1,100) + total_modifier; if(r1 < min_fail_roll) { add_string_to_buf(" Barrier broken."); diff --git a/src/game/boe.town.cpp b/src/game/boe.town.cpp index bff0c895..3734840e 100644 --- a/src/game/boe.town.cpp +++ b/src/game/boe.town.cpp @@ -1165,7 +1165,7 @@ void pick_lock(location where,short pc_num) { short success_chance = 0; short max_success_roll = (unlock_adjust * 15 + 30); if(unlock_adjust < 5){ - success_chance = minmax(max_success_roll - total_modifier, 0, 100); + success_chance = minmax(0, 100, max_success_roll - total_modifier); } if((unlock_adjust >= 5) || (r1 > max_success_roll)) { add_string_to_buf(" Didn't work. (" + std::to_string(success_chance) + "\% chance)"); @@ -1203,7 +1203,7 @@ void bash_door(location where,short pc_num) { r1 = get_ran(1,1,100) + total_modifier; bool success_chance = 0; if(unlock_adjust < 5 && univ.scenario.ter_types[terrain].flag3 == 1){ - success_chance = minmax(max_success_roll - total_modifier, 0, 100); + success_chance = minmax(0, 100, max_success_roll - total_modifier); } if(unlock_adjust >= 5 || r1 > max_success_roll || univ.scenario.ter_types[terrain].flag3 != 1) { add_string_to_buf(" Didn't work. (" + std::to_string(success_chance) + "\% chance)");