]> granicus.if.org Git - nethack/commitdiff
fix #M63: Problem with magic lamp changing
authornethack.rankin <nethack.rankin>
Sun, 24 Apr 2005 03:43:42 +0000 (03:43 +0000)
committernethack.rankin <nethack.rankin>
Sun, 24 Apr 2005 03:43:42 +0000 (03:43 +0000)
     Fix the problem From a bug report, so finding it in a bones file yielded a fully functional magic
lamp.  Fix as user suggested:  convert the lamp first.

     It also left the djinni who would normally have disappeared right after
the wish.  Water demons from fountains have that problem too.  Unfortunately
my fix is a bit buggy:  when removing the monster before granting the wish,
the player can notice.  Is there a straightforward way to display a monster
where none is present on the map?  Or do we need something comparable to the
obj->in_use flag for monsters, so that the bones code can discard particular
ones?

doc/fixes34.4
src/apply.c
src/fountain.c
src/potion.c

index aea59ed743dc1be827e9881b8756b00fa38740dd..153b420437fe13467162199df23ceea50072e4ed 100644 (file)
@@ -118,6 +118,7 @@ with astral vision, the ";" command should only display "normal vision"
 reanimating a statue containing gold produced double gold
 probing the resulting double-gold monster caused "static object freed" panic
 cursed wand might explode if used to engrave
+fatal wish from magic lamp left functional magic lamp in bones data
 
 
 Platform- and/or Interface-Specific Fixes
index e8383d15106b534535d5721da7dd7913816020b8..7f56fac2ce6eed2eb141dc9793d1633cdbd2baae 100644 (file)
@@ -1271,21 +1271,28 @@ dorub()
        if (uwep->otyp == MAGIC_LAMP) {
            if (uwep->spe > 0 && !rn2(3)) {
                check_unpaid_usage(uwep, TRUE);         /* unusual item use */
-               djinni_from_bottle(uwep);
-               makeknown(MAGIC_LAMP);
+               /* bones preparation:  perform the lamp transformation
+                  before releasing the djinni in case the latter turns out
+                  to be fatal (a hostile djinni has no chance to attack yet,
+                  but an indebtted one who grants a wish might bestow an
+                  artifact which blasts the hero with lethal results) */
                uwep->otyp = OIL_LAMP;
                uwep->spe = 0; /* for safety */
                uwep->age = rn1(500,1000);
                if (uwep->lamplit) begin_burn(uwep, TRUE);
+               djinni_from_bottle(uwep);
+               makeknown(MAGIC_LAMP);
                update_inventory();
-           } else if (rn2(2) && !Blind)
-               You("see a puff of smoke.");
-           else pline(nothing_happens);
+           } else if (rn2(2)) {
+               You("%s smoke.", !Blind ? "see a puff of" : "smell");
+           } else
+               pline(nothing_happens);
        } else if (obj->otyp == BRASS_LANTERN) {
            /* message from Adventure */
            pline("Rubbing the electric lamp is not particularly rewarding.");
            pline("Anyway, nothing exciting happens.");
-       } else pline(nothing_happens);
+       } else
+           pline(nothing_happens);
        return 1;
 }
 
index 663344df25d4b7c06763e098decf5f65b3ab8fbf..886eb64891e89bb2e4aec4d1a2d58c1e154191fe 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)fountain.c 3.5     2003/03/23      */
+/*     SCCS Id: @(#)fountain.c 3.5     2005/04/23      */
 /*     Copyright Scott R. Turner, srt@ucla, 10/27/86 */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -56,8 +56,10 @@ dowaterdemon() /* Water demon */
            if (rnd(100) > (80 + level_difficulty())) {
                pline("Grateful for %s release, %s grants you a wish!",
                      mhis(mtmp), mhe(mtmp));
-               makewish();
+               /* bones prep:  remove demon first in case the wish
+                  turns out to be fatal (artifact blast) */
                mongone(mtmp);
+               makewish();
            } else if (t_at(mtmp->mx, mtmp->my))
                (void) mintrap(mtmp);
        }
index 399105794609fe08dc0c56d120134de1aab73e87..1fada4b2940eba9b951a51188c530bdb80c403b2 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)potion.c   3.5     2005/03/26      */
+/*     SCCS Id: @(#)potion.c   3.5     2005/04/23      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2070,8 +2070,10 @@ register struct obj *obj;
 
        switch (chance) {
        case 0 : verbalize("I am in your debt.  I will grant one wish!");
-               makewish();
+               /* bones prep:  remove djinni first in case the wish
+                  turns out to be fatal (artifact blast) */
                mongone(mtmp);
+               makewish();
                break;
        case 1 : verbalize("Thank you for freeing me!");
                (void) tamedog(mtmp, (struct obj *)0);