]> granicus.if.org Git - nethack/commitdiff
mimic orange follow-up
authornethack.allison <nethack.allison>
Sat, 4 Jan 2003 16:28:21 +0000 (16:28 +0000)
committernethack.allison <nethack.allison>
Sat, 4 Jan 2003 16:28:21 +0000 (16:28 +0000)
include/extern.h
src/mhitu.c
src/objnam.c
src/polyself.c
src/vault.c

index 0b8fb70d195f05fa59368087cb977f1ce721276c..e2e6740a089bd65a7219e0d69f363776315d386a 100644 (file)
@@ -1359,6 +1359,7 @@ E char *FDECL(makesingular, (const char *));
 E struct obj *FDECL(readobjnam, (char *,struct obj *,BOOLEAN_P));
 E int FDECL(rnd_class, (int,int));
 E const char *FDECL(cloak_simple_name, (struct obj *));
+E const char *FDECL(mimic_obj_name, (struct monst *));
 
 /* ### options.c ### */
 
index f67d8664e0b6a32c55bbc67f639fe1ed4303c8c6..49d0f34d20eac95e675b33673aaca0455f10e867 100644 (file)
@@ -316,7 +316,11 @@ mattacku(mtmp)
                /* Might be attacking your image around the corner, or
                 * invisible, or you might be blind....
                 */
-
+       boolean mimickobj = (youmonst.m_ap_type == M_AP_OBJECT && 
+                               (youmonst.mappearance > STRANGE_OBJECT &&
+                                youmonst.mappearance < NUM_OBJECTS));
+               /* you are mimicking an object */
+       
        if(!ranged) nomul(0);
        if(mtmp->mhp <= 0 || (Underwater && !is_swimmer(mtmp->data)))
            return(0);
@@ -438,15 +442,15 @@ mattacku(mtmp)
                return(0);
        }
 
-       /* player might be mimicking gold */
-       if (youmonst.m_ap_type == M_AP_OBJECT
-               && youmonst.mappearance == GOLD_PIECE
-               && !range2 && foundyou && !u.uswallow) {
+       /* player might be mimicking an object */
+       if (mimickobj && !range2 && foundyou && !u.uswallow) {
            if (!youseeit)
-                pline("%s %s!", Something, likes_gold(mtmp->data) ?
+                pline("%s %s!", Something,
+                       (likes_gold(mtmp->data) && youmonst.mappearance == GOLD_PIECE) ?
                        "tries to pick you up" : "disturbs you");
-           else pline("Wait, %s!  That gold is really %s named %s!",
+           else pline("Wait, %s!  That %s is really %s named %s!",
                        m_monnam(mtmp),
+                       mimic_obj_name(&youmonst),
                        an(mons[u.umonnum].mname),
                        plname);
            if (multi < 0) {    /* this should always be the case */
@@ -454,7 +458,7 @@ mattacku(mtmp)
                Sprintf(buf, "You appear to be %s again.",
                        Upolyd ? (const char *) an(youmonst.data->mname) :
                            (const char *) "yourself");
-               unmul(buf);     /* immediately stop mimicking gold */
+               unmul(buf);     /* immediately stop mimicking */
            }
            return 0;
        }
index c94250cb13fbd8a22bf3d5709443c69a36312664..6bc5568f836e8443e8e24ba0d726b146dee0cee8 100644 (file)
@@ -2667,6 +2667,19 @@ struct obj *cloak;
     return "cloak";
 }
 
+const char *
+mimic_obj_name(mtmp)
+struct monst *mtmp;
+{
+    boolean mimickobj = (mtmp->m_ap_type == M_AP_OBJECT &&
+                       (mtmp->mappearance > STRANGE_OBJECT &&
+                        mtmp->mappearance < NUM_OBJECTS));
+    if (mimickobj) {
+       if (mtmp->mappearance == GOLD_PIECE) return "gold";
+       else return obj_descr[objects[mtmp->mappearance].oc_descr_idx].oc_name;
+    }
+    return "whatcha-may-callit";
+}
 #endif /* OVLB */
 
 /*objnam.c*/
index bd58398a6c46f90d07712b44be991d4fa0dcabcf..b591136d00318e791bab78a5d63e3df2ee1bae16 100644 (file)
@@ -33,8 +33,9 @@ polyman(fmt, arg)
 const char *fmt, *arg;
 {
        boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow,
-               was_mimicking_gold = (youmonst.m_ap_type == M_AP_OBJECT
-                                     && youmonst.mappearance == GOLD_PIECE);
+               was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT &&
+                               (youmonst.mappearance > STRANGE_OBJECT &&
+                                youmonst.mappearance < NUM_OBJECTS));
        boolean was_blind = !!Blind;
 
        if (Upolyd) {
@@ -52,7 +53,7 @@ const char *fmt, *arg;
 
        if (sticky) uunstick();
        find_ac();
-       if (was_mimicking_gold) {
+       if (was_mimicking) {
            if (multi < 0) unmul("");
        } else {
            /*
@@ -331,6 +332,9 @@ int mntmp;
 {
        boolean sticky = sticks(youmonst.data) && u.ustuck && !u.uswallow,
                was_blind = !!Blind, dochange = FALSE;
+       boolean was_mimicking = (youmonst.m_ap_type == M_AP_OBJECT &&
+                               (youmonst.mappearance > STRANGE_OBJECT &&
+                                youmonst.mappearance < NUM_OBJECTS));
        int mlvl;
 
        if (mvitals[mntmp].mvflags & G_GENOD) { /* allow G_EXTINCT */
@@ -356,9 +360,8 @@ int mntmp;
                flags.female = u.mfemale;
        }
 
-       if (youmonst.m_ap_type == M_AP_OBJECT &&
-               youmonst.mappearance == GOLD_PIECE) {
-           /* stop mimicking gold immediately */
+       if (was_mimicking) {
+           /* stop mimicking immediately */
            if (multi < 0) unmul("");
        } else if (mons[mntmp].mlet != S_MIMIC) {
            /* as in polyman() */
index eb7f3d23c2cd92d1824bd0b6f373afbaf1279357..11feb0a63718ada16998fbe993b0dec04c4748dd 100644 (file)
@@ -134,6 +134,9 @@ invault()
 #endif
     struct monst *guard;
     int trycount, vaultroom = (int)vault_occupied(u.urooms);
+    boolean mimickobj = (youmonst.m_ap_type == M_AP_OBJECT &&
+                       (youmonst.mappearance > STRANGE_OBJECT &&
+                        youmonst.mappearance < NUM_OBJECTS));
 
     if(!vaultroom) {
        u.uinvault = 0;
@@ -241,9 +244,10 @@ fnd:
        else
            pline("Someone else has entered the Vault.");
        newsym(guard->mx,guard->my);
-       if ((youmonst.m_ap_type == M_AP_OBJECT &&
-               youmonst.mappearance == GOLD_PIECE) || u.uundetected) {
-           /* You're mimicking a pile of gold or you're hidden. */
+       if (mimickobj || u.uundetected) {
+           if (youmonst.mappearance != GOLD_PIECE)
+               verbalize("Hey! who left that %s in here?", mimic_obj_name(&youmonst));
+           /* You're mimicking some object or you're hidden. */
            pline("Puzzled, %s turns around and leaves.", mhe(guard));
            mongone(guard);
            return;