]> granicus.if.org Git - nethack/commitdiff
fix B15003 - behavior of bribe-able demons
authornethack.rankin <nethack.rankin>
Wed, 18 Dec 2002 18:15:55 +0000 (18:15 +0000)
committernethack.rankin <nethack.rankin>
Wed, 18 Dec 2002 18:15:55 +0000 (18:15 +0000)
     Prevent a demon who is carrying the Amulet of Yendor from being
removed from the game when player meets his demand for a bribe since
that was effectively destroying the Amulet.  There are various ways
to accomplish this; I chose to make the bribe demand be for an amount
that the player cannot possibly satisfy in that case.

doc/fixes34.1
src/minion.c

index 3d7ac6abfa9cf2f29d1d19c0bc84b5f3f7bfc8d4..1df14f0085610e57d0ac4c07b205643022bc118c 100644 (file)
@@ -333,6 +333,7 @@ most cases of the hero dropping things need to check for dropping on an altar
 zapping undiggable trees with wand or spell of dig gave feedback about rock
 being able to see invisible shouldn't cause you to not notice when potion
        or spell of invisibility wears off
+can't successfully bribe a demon who happens to be carrying the Amulet
 
 
 Platform- and/or Interface-Specific Fixes
index 5d45a1391c480f1e7f0dff9231c78b1773a4ffc9..fa33d816fe2794b072c00353e97d0ad87ed914ef 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)minion.c   3.4     2002/01/23      */
+/*     SCCS Id: @(#)minion.c   3.4     2002/12/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -142,7 +142,7 @@ int
 demon_talk(mtmp)               /* returns 1 if it won't attack. */
 register struct monst *mtmp;
 {
-       long    demand, offer;
+       long cash, demand, offer;
 
        if (uwep && uwep->oartifact == ART_EXCALIBUR) {
            pline("%s looks very angry.", Amonnam(mtmp));
@@ -164,14 +164,23 @@ register struct monst *mtmp;
            return(1);
        }
 #ifndef GOLDOBJ
-       demand = (u.ugold * (rnd(80) + 20 * Athome)) /
+       cash = u.ugold;
 #else
-       demand = (money_cnt(invent) * (rnd(80) + 20 * Athome)) /
+       cash = money_cnt(invent);
 #endif
+       demand = (cash * (rnd(80) + 20 * Athome)) /
            (100 * (1 + (sgn(u.ualign.type) == sgn(mtmp->data->maligntyp))));
-       if (!demand)            /* you have no gold */
-           return mtmp->mpeaceful = 0;
-       else {
+
+       if (!demand) {          /* you have no gold */
+           mtmp->mpeaceful = 0;
+           return 0;
+       } else {
+           /* make sure that the demand is unmeetable if the monster
+              has the Amulet, preventing it from being satisified and
+              removed from the game (along with said Amulet...) */
+           if (mon_has_amulet(mtmp))
+               demand = cash + (long)rn1(1000,40);
+
            pline("%s demands %ld %s for safe passage.",
                  Amonnam(mtmp), demand, currency(demand));
 
@@ -184,7 +193,8 @@ register struct monst *mtmp;
                          Amonnam(mtmp));
                } else {
                    pline("%s gets angry...", Amonnam(mtmp));
-                   return mtmp->mpeaceful = 0;
+                   mtmp->mpeaceful = 0;
+                   return 0;
                }
            }
        }