]> granicus.if.org Git - nethack/commitdiff
fix #H4388 - wishing conduct inconsistency
authorPatR <rankin@nethack.org>
Fri, 17 Jun 2016 05:01:27 +0000 (22:01 -0700)
committerPatR <rankin@nethack.org>
Fri, 17 Jun 2016 05:01:27 +0000 (22:01 -0700)
Make wishing for an artifact and not getting it because it already
exists break never-wished-for-artifact conduct.  The wish was made
even if the result wasn't what the player wanted.

doc/fixes36.1
src/cmd.c
src/objnam.c

index 37ea2262cfebb6b8ea9553b313c44a4997b65e08..6affc4c59945279482cf64d5afe8aefe70a7efba 100644 (file)
@@ -296,6 +296,9 @@ don't give "you cannot pass through the bars" when travel is testing possible
 if blind and no gloves, using 'm<dir>' to move and then 'e' could be used to
        locate cockatrice corpse without fatal touching (by declining to eat)
 it's cannabilism for a were<foo> to eat a <foo> corpse
+conduct: wishing for an artifact and not getting it because it already exists
+       counts as wishing for an artifact, just like when not getting it
+       becuase of quest restrictions or too many artifacts in play does
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
index aaecc80f6cb95855074361713990aebefd051077..4feb9bf94880264df67706708537e51eb458a7bf 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -2634,6 +2634,26 @@ int final;
     } else {
         Sprintf(buf, "used %ld wish%s", u.uconduct.wishes,
                 (u.uconduct.wishes > 1L) ? "es" : "");
+        if (u.uconduct.wisharti) {
+            /* if wisharti == wishes
+             *  1 wish (for an artifact)
+             *  2 wishes (both for artifacts)
+             *  N wishes (all for artifacts)
+             * else (N is at least 2 in order to get here; M < N)
+             *  N wishes (1 for an artifact)
+             *  N wishes (M for artifacts)
+             */
+            if (u.uconduct.wisharti == u.uconduct.wishes)
+                Sprintf(eos(buf), " (%s",
+                        (u.uconduct.wisharti > 2L) ? "all "
+                          : (u.uconduct.wisharti == 2L) ? "both " : "");
+            else
+                Sprintf(eos(buf), " (%ld ", u.uconduct.wisharti);
+
+            Sprintf(eos(buf), "for %s)",
+                    (u.uconduct.wisharti == 1L) ? "an artifact"
+                                                : "artifacts");
+        }
         you_have_X(buf);
 
         if (!u.uconduct.wisharti)
index 2d07b6ab4544a1e698b13eb1609994ec064a8bde..6caa583b7e640c805ae30463a3a1f6fad9fd1dd3 100644 (file)
@@ -3570,7 +3570,8 @@ typfnd:
         }
 
         otmp = oname(otmp, name);
-        if (otmp->oartifact) {
+        /* name==aname => wished for artifact (otmp->oartifact => got it) */
+        if (otmp->oartifact || name == aname) {
             otmp->quan = 1L;
             u.uconduct.wisharti++; /* KMH, conduct */
         }