- float sharpen_intensity;
- if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)
- sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);
- if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)
- sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);
+ float sharpen_intensity, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED);
+ if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
+ if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
+
+ // Check the health stat to see whether the player is still alive, then remove the effect if they are dead so it isn't there when they respawn...
+ // then bound the given value since powerup warning time is 5 seconds, so fade the effect from 5 seconds down.
+ sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5);