Candlelight is proportional to the number of candles; minimum range is 2 rather than 1 for playability. */
| 840 | /* Candlelight is proportional to the number of candles; |
| 841 | minimum range is 2 rather than 1 for playability. */ |
| 842 | int |
| 843 | candle_light_range(struct obj *obj) |
| 844 | { |
| 845 | int radius; |
| 846 | |
| 847 | if (obj->otyp == CANDELABRUM_OF_INVOCATION) { |
| 848 | /* |
| 849 | * The special candelabrum emits more light than the |
| 850 | * corresponding number of candles would. |
| 851 | * 1..3 candles, range 2 (minimum range); |
| 852 | * 4..6 candles, range 3 (normal lamp range); |
| 853 | * 7 candles, range 4 (bright). |
| 854 | */ |
| 855 | radius = (obj->spe < 4) ? 2 : (obj->spe < 7) ? 3 : 4; |
| 856 | } else if (Is_candle(obj)) { |
| 857 | /* |
| 858 | * Range is incremented quadratically. You can get the same |
| 859 | * amount of light as from a lamp with 4 candles, and |
| 860 | * even better light with 9 candles, and so on. |
| 861 | * 1..3 candles, range 2; |
| 862 | * 4..8 candles, range 3; |
| 863 | * 9..15 candles, range 4; &c. |
| 864 | */ |
| 865 | long n = obj->quan; |
| 866 | |
| 867 | radius = 1; /* always incremented at least once */ |
| 868 | while(radius*radius <= n && radius < MAX_RADIUS) { |
| 869 | radius++; |
| 870 | } |
| 871 | } else { |
| 872 | /* we're only called for lit candelabrum or candles */ |
| 873 | /* impossible("candlelight for %d?", obj->otyp); */ |
| 874 | radius = 3; /* lamp's value */ |
| 875 | } |
| 876 | return radius; |
| 877 | } |
| 878 | |
| 879 | /* light emitting artifact's range depends upon its curse/bless state */ |
| 880 | int |
no outgoing calls
no test coverage detected