From 72ac4bb345c6eac7e99b77e7a62b362550310a99 Mon Sep 17 00:00:00 2001 From: harlanx Date: Tue, 30 Aug 2022 13:52:46 +0800 Subject: [PATCH] skip randomization when min>=max --- cheat-library/src/user/cheat/player/RapidFire.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cheat-library/src/user/cheat/player/RapidFire.cpp b/cheat-library/src/user/cheat/player/RapidFire.cpp index 455a42f..004a638 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.cpp +++ b/cheat-library/src/user/cheat/player/RapidFire.cpp @@ -64,7 +64,7 @@ namespace cheat::feature } else { - ConfigWidget("Min Multiplier", f_minMultiplier, 1, 2, 1000, "Attack count minimum multiplier."); + ConfigWidget("Min Multiplier", f_minMultiplier, 1, 1, 1000, "Attack count minimum multiplier."); ConfigWidget("Max Multiplier", f_maxMultiplier, 1, 2, 1000, "Attack count maximum multiplier."); } } @@ -157,7 +157,10 @@ namespace cheat::feature } if (f_Randomize) { - countOfAttacks = rand() % (f_maxMultiplier.value() - f_minMultiplier.value()) + f_minMultiplier.value(); + if (f_minMultiplier.value() >= f_maxMultiplier.value()) + countOfAttacks = f_minMultiplier.value(); + else + countOfAttacks = rand() % (f_maxMultiplier.value() - f_minMultiplier.value()) + f_minMultiplier.value(); return countOfAttacks; }