]> granicus.if.org Git - nethack/commitdiff
silver wands
authornethack.allison <nethack.allison>
Sun, 9 Nov 2003 23:38:33 +0000 (23:38 +0000)
committernethack.allison <nethack.allison>
Sun, 9 Nov 2003 23:38:33 +0000 (23:38 +0000)
From the newsgroup:
> <email deleted> (<Someone>)
> Newsgroups: rec.games.roguelike.nethack
> Subject: Question: Why don't silver wands give silver damage?
> Date: 9 Nov 2003 09:18:50 -0800
> Organization: http://groups.google.com
> Lines: 7
> <email deleted>
>
> I had a character cornered by a werejackal the other day.  I'm not too
> bothered by the death but why didn't the silver wand he desperately
> wielded in his final moments do extra damage?  I mean, silver rings do
> so why not wands?  I realise this is a pretty minor problem since not
> that many people will be going around wielding wands, but still.
>
>  ~<Someone>

There was a code path for objects such as wands that avoided
all the silver checks. Now fixed.

doc/fixes34.3
src/uhitm.c

index d2c136c048d6171620458e786d4619533ea8b116..c2cdc1933a05bf23ae209f4c99c1b5be71b63258 100644 (file)
@@ -88,6 +88,7 @@ sleeping shopkeeper responds to various events without waking
 rotting corpses grammar fix
 allow successful teleport to more locations on debug mode level teleport menu
 trapped monster repeatedly switched between ranged and hand-to-hand weapon
+silver items such as wands avoided all the silver checks in hmon_hitmon()
 
 
 Platform- and/or Interface-Specific Fixes
index 0396a0fda3b3f4cbad8790834b3cedc1a33f4a21..1a18afd77d319ae514586325cfd2904d4109907a 100644 (file)
@@ -544,7 +544,7 @@ int thrown;
        boolean hittxt = FALSE, destroyed = FALSE, already_killed = FALSE;
        boolean get_dmg_bonus = TRUE;
        boolean ispoisoned = FALSE, needpoismsg = FALSE, poiskilled = FALSE;
-       boolean silvermsg = FALSE;
+       boolean silvermsg = FALSE, silverobj = FALSE;
        boolean valid_weapon_attack = FALSE;
        boolean unarmed = !uwep && !uarm && !uarms;
 #ifdef STEED
@@ -665,8 +665,9 @@ int thrown;
                        hittxt = TRUE;
                    }
                    if (objects[obj->otyp].oc_material == SILVER
-                               && hates_silver(mdat))
-                       silvermsg = TRUE;
+                               && hates_silver(mdat)) {
+                       silvermsg = TRUE; silverobj = TRUE;
+                   }
 #ifdef STEED
                    if (u.usteed && !thrown && tmp > 0 &&
                            weapon_type(obj) == P_LANCE && mon != u.ustuck) {
@@ -888,6 +889,15 @@ int thrown;
                        if(tmp < 1) tmp = 1;
                        else tmp = rnd(tmp);
                        if(tmp > 6) tmp = 6;
+                       /*
+                        * Things like silver wands can arrive here so
+                        * so we need another silver check.
+                        */
+                       if (objects[obj->otyp].oc_material == SILVER
+                                               && hates_silver(mdat)) {
+                               tmp += rnd(20);
+                               silvermsg = TRUE; silverobj = TRUE;
+                       }
                    }
                }
            }
@@ -1026,13 +1036,20 @@ int thrown;
        if (silvermsg) {
                const char *fmt;
                char *whom = mon_nam(mon);
+               char silverobjbuf[BUFSZ];
 
                if (canspotmon(mon)) {
                    if (barehand_silver_rings == 1)
                        fmt = "Your silver ring sears %s!";
                    else if (barehand_silver_rings == 2)
                        fmt = "Your silver rings sear %s!";
-                   else
+                   else if (silverobj) {
+                       Sprintf(silverobjbuf, "Your %s%s %s %%s!",
+                               strstri(xname(obj), "silver") ?
+                                       "" : "silver ",
+                               xname(obj), otense(obj, "sear"));
+                       fmt = silverobjbuf;
+                   } else
                        fmt = "The silver sears %s!";
                } else {
                    *whom = highc(*whom);       /* "it" -> "It" */