From 103a37e7628ae3253c4949b5164d1e65792337d3 Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Wed, 28 Feb 2024 19:35:56 -0600 Subject: [PATCH] [Crash Fix] D20 crash if mitigation average resulted in 0 (#4131) --- zone/attack.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index e90cc7edb..f45f193b9 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1005,7 +1005,7 @@ double Mob::RollD20(int offense, int mitigation) auto atk_roll = zone->random.Roll0(offense + 5); auto def_roll = zone->random.Roll0(mitigation + 5); - int avg = (offense + mitigation + 10) / 2; + int avg = std::max(1, (offense + mitigation + 10) / 2); int index = std::max(0, (atk_roll - def_roll) + (avg / 2)); index = EQ::Clamp((index * 20) / avg, 0, 19);