]> granicus.if.org Git - nethack/commitdiff
inappropriate polyself spit attacks
authorcohrs <cohrs>
Sun, 5 Feb 2006 03:29:45 +0000 (03:29 +0000)
committercohrs <cohrs>
Sun, 5 Feb 2006 03:29:45 +0000 (03:29 +0000)
Submitted by <Someone> 12/3/05.  player poly'd as guardian naga produced a
different attack than a real guardian naga.  The fix causes an algorithm
similar to that used in spitmnu to be used in dospit.

doc/fixes35.0
src/polyself.c

index 75b7166c9d6bfe0bff2a61535461905a38b80708..dacace43ff50ea962ef3910a9e7c8de346501d2d 100644 (file)
@@ -117,6 +117,7 @@ don't see objects or read engraving when hero changes location (random
        teleport) or position (levitation timeout) while asleep or fainted
 polymorphed spellbooks may turn blank or be too faint to read
 avoid inappropriate message when using a cursed lamp while blind
+player polymorphed as a guardian naga spit the wrong kind of venom
 
 
 Platform- and/or Interface-Specific Fixes
index 3dada624e49dd5a613a9edbb7f35770ee41090b2..687242abca880ac695618667c3a0b1539ff9b46d 100644 (file)
@@ -788,12 +788,28 @@ int
 dospit()
 {
        struct obj *otmp;
+       struct attack *mattk;
 
        if (!getdir((char *)0)) return(0);
-       otmp = mksobj(u.umonnum==PM_COBRA ? BLINDING_VENOM : ACID_VENOM,
-                       TRUE, FALSE);
-       otmp->spe = 1; /* to indicate it's yours */
-       throwit(otmp, 0L, FALSE);
+       mattk = attacktype_fordmg(youmonst.data, AT_SPIT, AD_ANY);
+       if (!mattk) {
+           impossible("bad spit attack?");
+       } else {
+           switch (mattk->adtyp) {
+           case AD_BLND:
+           case AD_DRST:
+               otmp = mksobj(BLINDING_VENOM, TRUE, FALSE);
+               break;
+           default:
+               impossible("bad attack type in dospit");
+               /* fall through */
+           case AD_ACID:
+               otmp = mksobj(ACID_VENOM, TRUE, FALSE);
+               break;
+           }
+           otmp->spe = 1; /* to indicate it's yours */
+           throwit(otmp, 0L, FALSE);
+       }
        return(1);
 }