mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Crash Fix] D20 crash if mitigation average resulted in 0 (#4131)
This commit is contained in:
parent
34f19489d0
commit
103a37e762
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user