diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index b2769ab4d2..c163c8913f 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -418,7 +418,15 @@ namespace CalamityMod.CalPlayer double playerUndergroundDepth = point.Y - Main.worldSurface; double depthRatio = playerUndergroundDepth / totalUndergroundDepth; int lightStrength = modPlayer.GetTotalLightStrength(); - float darknessStrength = (float)depthRatio; + + // In the last 50 blocks before hell, the darkness smoothly fades away. + float FadeAwayStart = (float)(1D - 50D / totalUndergroundDepth); + float darknessStrength = (float)(depthRatio / FadeAwayStart); + if (depthRatio > FadeAwayStart) + { + // Varies from 1.0 to 0.0 as depthRatio varies from FadeAwayStart to 1.0. + darknessStrength = (1f - (float)depthRatio) / (1f - FadeAwayStart); + } // Reduce the power of cave darkness based on your light level. 5+ is enough to totally eliminate it. switch (lightStrength)