From: copperwater Date: Mon, 6 Nov 2017 16:01:15 +0000 (-0500) Subject: Candle light radius is now square root, not logarithmic X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14b4515927953356898181600588e6f7e90cb891;p=nethack Candle light radius is now square root, not logarithmic After some discussion with Alex Smith, it seems like a good change for both gameplay and realism that candles' light radius should decay quadratically instead of exponentially. Now a light radius of 4 from candles can be accomplished by burning 9 candles, and players who find a lot of candles might even be able to get up to 5 (16 candles) or 6 (25 candles). The main impetus for this change is that with the existing formula, the more candles -> more light mechanic was more or less useless outside of wizard mode, because you needed 49 candles to do better than a lamp. --- diff --git a/src/light.c b/src/light.c index 243282bfe..c34acfcdc 100644 --- a/src/light.c +++ b/src/light.c @@ -712,20 +712,19 @@ struct obj *obj; radius = (obj->spe < 4) ? 2 : (obj->spe < 7) ? 3 : 4; } else if (Is_candle(obj)) { /* - * Range is incremented by powers of 7 so that it will take - * wizard mode quantities of candles to get more light than - * from a lamp, without imposing an arbitrary limit. - * 1..6 candles, range 2; - * 7..48 candles, range 3; - * 49..342 candles, range 4; &c. + * Range is incremented quadratically. You can get the same + * amount of light as from a lamp with 4 candles, and + * even better light with 9 candles, and so on. + * 1..3 candles, range 2; + * 4..8 candles, range 3; + * 9..15 candles, range 4; &c. */ long n = obj->quan; radius = 1; /* always incremented at least once */ - do { + while(radius*radius <= n) { radius++; - n /= 7L; - } while (n > 0L); + } } else { /* we're only called for lit candelabrum or candles */ /* impossible("candlelight for %d?", obj->otyp); */