]> granicus.if.org Git - nethack/commitdiff
monsters with multiple attacks missing wildly (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 2 Feb 2006 07:20:08 +0000 (07:20 +0000)
committernethack.rankin <nethack.rankin>
Thu, 2 Feb 2006 07:20:08 +0000 (07:20 +0000)
     Reduce verbosity for monsters with multiple attacks who "swing wildly
at you and miss" or "miss your displaced image" due to their confusion or
your invisibility or displacement.  It's aggravating to sit through that
three times for claw/claw/bite or swing/swing/kick when those longer
descriptions of why such missing happened guarantee multiple --More--
prompts.  (Can't simply use Norep() to deal with this because wildmiss()
varies its messages.)

     This makes monsters marginally smarter--independent of their defined
intelligence levels--by skipping their remaining attacks when the first
turns out to be targetted at nothing.  The exception is for monsters with
both melee and spell attacks; they'll keep going in case they end up
choosing a spell which doesn't need a target location.  (It's rather ironic
that the most intelligent monsters are the ones who'll foolishly continue
swinging at thin air.  This could be improved by forcing then to skip ahead
to their spell attack.)  Exploding monsters aren't affected because they
don't have multiple attacks.  Offhand I can't think of any other situation
where a wild miss on the first of N attacks could still yield a successful
result on any of the other N-1 actions.

     Monsters attempting ranged attacks who get multiple shots (due to
multiple weapon attacks per turn rather than to multi-shot volley during
a single attack) will end up conserving ammo when they stop after seeing
that the first shot didn't find a target.  Note that trying to attack you
but accidentally attacking some other target isn't affected since that
doesn't yield the wild miss outcome.  Intelligent monsters probably ought
to recognize that their attack against you ended up hitting someone else
and refrain from repeating that mistake N-1 more times.  Whether feedback
from that ought to carry over to their next turn is not so clear cut.

doc/fixes35.0
src/mhitu.c

index f838aedd9a88068f987dd92a93b2e3e4c2cec080..8a8b85e502999bbbba9811aef3e67b86f29a8571 100644 (file)
@@ -109,6 +109,7 @@ fix monsndx panic which happened after currently moving monster expelled
        swallowed hero onto magic trap and was made tame by its effect; taming
        no longer replaces monster
 reduced message verbosity when re-entering a temple
+reduced message verbosity when monster with multiple attacks missed wildly
 zapping a never seen wand while blinded won't make the wand a discovery
 zapping an unID'd wand of teleportation at self will discover it (usually)
 zapping unlocking magic at self while punished will remove attached chain
index a2a3fe3ead3782406a8aa0d68020f1aa9eba4940..c899298c922c45225b7ede56a232fa443b4304ef 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mhitu.c    3.5     2005/12/05      */
+/*     SCCS Id: @(#)mhitu.c    3.5     2006/02/01      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -304,7 +304,9 @@ mattacku(mtmp)
                /* Might be attacking your image around the corner, or
                 * invisible, or you might be blind....
                 */
-       
+       boolean giveup = FALSE;
+               /* Are further attack attempts useless? */
+
        if(!ranged) nomul(0);
        if(mtmp->mhp <= 0 || (Underwater && !is_swimmer(mtmp->data)))
            return(0);
@@ -561,8 +563,12 @@ mattacku(mtmp)
                                        sum[i] = hitmu(mtmp, mattk);
                                } else
                                    missmu(mtmp, (tmp == j), mattk);
-                           } else
+                           } else {
                                wildmiss(mtmp, mattk);
+                               /* skip any remaining attacks unless this
+                                  monster might attempt undirected spell */
+                               giveup = !attacktype(mtmp->data, AT_MAGC);
+                           }
                        }
                        break;
 
@@ -652,19 +658,19 @@ mattacku(mtmp)
                                /* KMH -- Don't accumulate to-hit bonuses */
                                if (otmp)
                                        tmp -= hittmp;
-                           } else
+                           } else {
                                wildmiss(mtmp, mattk);
+                               /* skip any remaining attacks unless this
+                                  monster might attempt undirected spell */
+                               giveup = !attacktype(mtmp->data, AT_MAGC);
+                           }
                        }
                        break;
                case AT_MAGC:
                        if (range2)
                            sum[i] = buzzmu(mtmp, mattk);
-                       else {
-                           if (foundyou)
-                               sum[i] = castmu(mtmp, mattk, TRUE, TRUE);
-                           else
-                               sum[i] = castmu(mtmp, mattk, TRUE, FALSE);
-                       }
+                       else
+                           sum[i] = castmu(mtmp, mattk, TRUE, foundyou);
                        break;
 
                default:                /* no attack */
@@ -681,6 +687,7 @@ mattacku(mtmp)
            if(sum[i] == 2) return 1;           /* attacker dead */
            if(sum[i] == 3) break;  /* attacker teleported, no more attacks */
            /* sum[i] == 0: unsuccessful attack */
+           if (giveup) break;  /* skip any remaining attacks */
        }
        return(0);
 }