fix: Fixes honor check crash on target killed (#1987)

This commit is contained in:
Kamron Batman 2024-10-30 16:33:43 -07:00 committed by GitHub
parent cc6d029add
commit dabaa1eb5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}