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.
This commit is contained in:
copperwater
2017-11-06 11:01:15 -05:00
committed by Pasi Kallinen
parent c00c307d57
commit 14b4515927

View File

@@ -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); */