diff -Naur nethack-3.4.3/include/extern.h nethack-candle/include/extern.h --- nethack-3.4.3/include/extern.h 2003-12-08 10:39:13.000000000 +1100 +++ nethack-candle/include/extern.h 2006-11-19 14:11:41.093750000 +1100 @@ -1578,6 +1578,7 @@ E const char *FDECL(halu_gname, (ALIGNTYP_P)); E const char *FDECL(align_gtitle, (ALIGNTYP_P)); E void FDECL(altar_wrath, (int,int)); +E int FDECL(candle_on_altar, (struct obj *)); /* ### priest.c ### */ diff -Naur nethack-3.4.3/src/light.c nethack-candle/src/light.c --- nethack-3.4.3/src/light.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-candle/src/light.c 2006-11-19 13:31:58.703125000 +1100 @@ -159,6 +159,16 @@ at_hero_range = ls->range; } + /* Candle ranges need to be recomputed to allow altar + effects */ + + if (ls->type == LS_OBJECT) { + struct obj *otmp = (struct obj *) ls->id; + if (Is_candle(otmp)) { + ls->range = candle_light_range(otmp); + } + } + if (ls->flags & LSF_SHOW) { /* * Walk the points in the circle and see if they are @@ -569,6 +579,9 @@ radius++; n /= 7L; } while (n > 0L); + + radius += candle_on_altar(obj); + } else { /* we're only called for lit candelabrum or candles */ /* impossible("candlelight for %d?", obj->otyp); */ diff -Naur nethack-3.4.3/src/pray.c nethack-candle/src/pray.c --- nethack-3.4.3/src/pray.c 2003-12-08 10:39:13.000000000 +1100 +++ nethack-candle/src/pray.c 2006-11-19 14:08:36.609375000 +1100 @@ -1527,12 +1527,12 @@ alignment = u.ualign.record / 2; /* Different alignment altar */ else alignment = u.ualign.record; - if ((p_trouble > 0) ? (u.ublesscnt > 200) : /* big trouble */ + if ((int)Luck < 0 || u.ugangr || alignment < 0) + p_type = 0; /* too naughty... */ + else if ((p_trouble > 0) ? (u.ublesscnt > 200) : /* big trouble */ (p_trouble < 0) ? (u.ublesscnt > 100) : /* minor difficulties */ (u.ublesscnt > 0)) /* not in trouble */ - p_type = 0; /* too soon... */ - else if ((int)Luck < 0 || u.ugangr || alignment < 0) - p_type = 1; /* too naughty... */ + p_type = 1; /* too soon... */ else /* alignment >= 0 */ { if(on_altar() && u.ualign.type != p_aligntyp) p_type = 2; @@ -1621,15 +1621,15 @@ } if (p_type == 0) { + if(on_altar() && u.ualign.type != alignment) + (void) water_prayer(FALSE); + angrygods(u.ualign.type); /* naughty */ + } else if (p_type == 1) { if(on_altar() && u.ualign.type != alignment) (void) water_prayer(FALSE); u.ublesscnt += rnz(250); change_luck(-3); gods_upset(u.ualign.type); - } else if(p_type == 1) { - if(on_altar() && u.ualign.type != alignment) - (void) water_prayer(FALSE); - angrygods(u.ualign.type); /* naughty */ } else if(p_type == 2) { if(water_prayer(FALSE)) { /* attempted water prayer on a non-coaligned altar */ @@ -1869,4 +1869,28 @@ return FALSE; } + +/* + * A candle on a coaligned altar burns brightly or dimly + * depending on your prayer status. + */ + +int +candle_on_altar(candle) +struct obj *candle; +{ + if (candle->where != OBJ_FLOOR + || !IS_ALTAR(levl[candle->ox][candle->oy].typ) + || a_align(candle->ox, candle->oy) != u.ualign.type) { + + return 0; + } + + can_pray(FALSE); + + /* Return a value indicating the chances of successful prayer */ + + return (p_type > 2 ? 1 : p_type - 1); +} + /*pray.c*/