Sunsword vs <u.ux,u.uy>

Using #invoke on wielded or carried Sunsword and picking direction
'>' or '<' lights the hero's spot.  But setting levl[u.ux][u.uy].lit
was too simplistic.  Lighting on the Rogue Level operates on full
rooms when done inside a room and doesn't to anything with done in a
corridor.

litroom() gave inappropriate messages in a couple of special cases.
This commit is contained in:
PatR
2024-05-16 13:26:46 -07:00
parent 26b12f83fe
commit 6aa42750ad
2 changed files with 22 additions and 11 deletions
+9 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 artifact.c $NHDT-Date: 1711734229 2024/03/29 17:43:49 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.230 $ */ /* NetHack 3.7 artifact.c $NHDT-Date: 1715889721 2024/05/16 20:02:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.236 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1930,11 +1930,14 @@ arti_invoke(struct obj *obj)
if (u.dx || u.dy) { if (u.dx || u.dy) {
do_blinding_ray(obj); do_blinding_ray(obj);
} else if (u.dz) { } else if (u.dz) {
/* up or down; light this map spot */ /* up or down => light this map spot; litroom() uses
levl[u.ux][u.uy].lit = 1; radius 0 for Sunsword, except on Rogue level where
pline("%s", ((Blind || levl[u.ux][u.uy].waslit) whole room gets lit and corridor spots remain unlit */
? nothing_seems_to_happen litroom(TRUE, obj);
: "It is lit here now.")); pline("%s", ((!Blind && levl[u.ux][u.uy].lit
&& !levl[u.ux][u.uy].waslit)
? "It is lit here now."
: nothing_seems_to_happen));
} else { /* zapyourself() */ } else { /* zapyourself() */
boolean vulnerable = (u.umonnum == PM_GREMLIN); boolean vulnerable = (u.umonnum == PM_GREMLIN);
int damg = obj->blessed ? 15 : !obj->cursed ? 10 : 5; int damg = obj->blessed ? 15 : !obj->cursed ? 10 : 5;
+13 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 read.c $NHDT-Date: 1708126537 2024/02/16 23:35:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.300 $ */ /* NetHack 3.7 read.c $NHDT-Date: 1715889745 2024/05/16 20:02:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.308 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -2385,6 +2385,7 @@ litroom(
struct obj *otmp; struct obj *otmp;
boolean blessed_effect = (obj && obj->oclass == SCROLL_CLASS boolean blessed_effect = (obj && obj->oclass == SCROLL_CLASS
&& obj->blessed); && obj->blessed);
boolean no_op = (u.uswallow || Underwater || Is_waterlevel(&u.uz));
char is_lit = 0; /* value is irrelevant but assign something anyway; its char is_lit = 0; /* value is irrelevant but assign something anyway; its
* address is used as a 'not null' flag for set_lit() */ * address is used as a 'not null' flag for set_lit() */
@@ -2447,12 +2448,14 @@ litroom(
pline("%s shines briefly.", Monnam(u.ustuck)); pline("%s shines briefly.", Monnam(u.ustuck));
else else
pline("%s glistens.", Monnam(u.ustuck)); pline("%s glistens.", Monnam(u.ustuck));
} else if (!Blind) } else if (!Blind && (!Is_rogue_level(&u.uz)
pline("A lit field surrounds you!"); || levl[u.ux][u.uy].typ != CORR)) {
pline("A lit field %ssurrounds you!", no_op ? "briefly " : "");
}
} }
/* No-op when swallowed or in water */ /* No-op when swallowed or in water */
if (u.uswallow || Underwater || Is_waterlevel(&u.uz)) if (no_op)
return; return;
/* /*
* If we are darkening the room and the hero is punished but not * If we are darkening the room and the hero is punished but not
@@ -2477,9 +2480,14 @@ litroom(
gr.rooms[rnum].rlit = on; gr.rooms[rnum].rlit = on;
} }
/* hallways remain dark on the rogue level */ /* hallways remain dark on the rogue level */
} else } else if (is_art(obj, ART_SUNSWORD)) {
/* Sunsword's #invoke power directed up or down lights hero's spot
(do_clear_area() rejects radius 0 so call set_lit() directly) */
set_lit(u.ux, u.uy, (genericptr_t) &is_lit);
} else {
do_clear_area(u.ux, u.uy, blessed_effect ? 9 : 5, do_clear_area(u.ux, u.uy, blessed_effect ? 9 : 5,
set_lit, (genericptr_t) (on ? &is_lit : (char *) 0)); set_lit, (genericptr_t) (on ? &is_lit : (char *) 0));
}
/* /*
* If we are not blind, then force a redraw on all positions in sight * If we are not blind, then force a redraw on all positions in sight