From dabaa1eb5a2f266ad60ca721291767236af70fc1 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:33:43 -0700 Subject: [PATCH] fix: Fixes honor check crash on target killed (#1987) --- Projects/UOContent/Engines/Virtues/HonorContext.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/UOContent/Engines/Virtues/HonorContext.cs b/Projects/UOContent/Engines/Virtues/HonorContext.cs index 8eab8bd1d..8e2ba1a13 100644 --- a/Projects/UOContent/Engines/Virtues/HonorContext.cs +++ b/Projects/UOContent/Engines/Virtues/HonorContext.cs @@ -186,7 +186,7 @@ public class HonorContext Source.Mana += restore; } - if (VirtueSystem.GetVirtues(Source).Honor > targetFame) + if (VirtueSystem.GetVirtues(Source)?.Honor > targetFame) { return; } @@ -194,7 +194,7 @@ public class HonorContext // Initial honor gain is 100th of the monsters honor var dGain = targetFame / 100.0 * (_honorDamage / _totalDamage); - if (_honorDamage == _totalDamage && _firstHit == FirstHit.Granted) + if (Math.Abs(_honorDamage - _totalDamage) < 0.01 && _firstHit == FirstHit.Granted) { dGain *= 1.5; // honor gain is increased a lot more if the combat was fully honorable }