diff --git a/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs b/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs index 0155c82..277efa6 100644 --- a/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs +++ b/TemporalTempestLight/TemporalTempestLight/Patches/TemporalStabilityPatches.cs @@ -22,14 +22,13 @@ internal class TemporalStabilityPatches var tempest = api.ModLoader.GetModSystem(); - if (!system.StormData.nowStormActive) return; - - var entityIsNotDrifter = - entity.Properties.Attributes["onDeathStabilityRecovery"].AsFloat(0) <= 0; - var damageSourceIsDrifter = - (damageSource.CauseEntity?.Properties?.Attributes["onDeathStabilityRecovery"]?.AsFloat(0) ?? 0) > 0; + if (!system.StormData.nowStormActive || !entity.Properties.Attributes.Exists) return; - if (entityIsNotDrifter || damageSourceIsDrifter) return; + var targetIsDrifter = + entity.Properties.Attributes["onDeathStabilityRecovery"].AsFloat(0) > 0; + var damageSourceIsPlayer = damageSource.SourceEntity is EntityPlayer; + + if (!targetIsDrifter || !damageSourceIsPlayer) return; system.StormData.stormActiveTotalDays -= tempest.CurrentStormDurationReduction; }