]> granicus.if.org Git - nethack/commitdiff
general musical instrument use while polymorphed
authorcohrs <cohrs>
Tue, 27 Jan 2004 00:23:31 +0000 (00:23 +0000)
committercohrs <cohrs>
Tue, 27 Jan 2004 00:23:31 +0000 (00:23 +0000)
Extend the previous patch to cover all blown instruments.  Also covers
the case of the player strangling.  The test is moved to a new can_blow
function to keep the test in one place.  It supports any monster, although
all current tests are for the player.

doc/fixes35.0
include/extern.h
src/apply.c
src/mondata.c
src/music.c

index 42098bd68a58f8957c66277b42dc26ce2585cba9..fd3ef1c653b78a01572641f4008c390e20972131 100644 (file)
@@ -55,7 +55,7 @@ player polymorphed as a ceiling hider cannot reach the floor, but
        automatically unhide on #sit
 trappers do not hide on the ceiling
 non-magical whistles do not work underwater
-try to restrict whistle use to monsters that can blow a whistle
+try to restrict whistles and musical instruments to monsters that can blow
 
 
 Platform- and/or Interface-Specific Fixes
index 671e85f2ed998807833865ea9742ececf02faf7f..81e6c958ecc9ba43ae1d070323f571747e3e5d26 100644 (file)
@@ -1204,6 +1204,7 @@ E boolean FDECL(can_blnd, (struct monst *,struct monst *,UCHAR_P,struct obj *));
 E boolean FDECL(ranged_attk, (struct permonst *));
 E boolean FDECL(hates_silver, (struct permonst *));
 E boolean FDECL(passes_bars, (struct permonst *));
+E boolean FDECL(can_blow, (struct monst *));
 E boolean FDECL(can_track, (struct permonst *));
 E boolean FDECL(breakarm, (struct permonst *));
 E boolean FDECL(sliparm, (struct permonst *));
index ee2252337f2f866b545bc3f9810a8c899a0bdf8b..81589770cf49f8db3939d9b4da048ab69ead9e0b 100644 (file)
@@ -389,9 +389,7 @@ STATIC_OVL void
 use_whistle(obj)
 struct obj *obj;
 {
-       if ((is_silent(youmonst.data) || youmonst.data->msound == MS_BUZZ) &&
-           (breathless(youmonst.data) || verysmall(youmonst.data) ||
-            !has_head(youmonst.data) || youmonst.data->mlet == S_EEL)) {
+       if (!can_blow(&youmonst)) {
            You("are incapable of using the whistle.");
        } else if(Underwater) {
            You("blow bubbles through %s.", yname(obj));
@@ -407,9 +405,7 @@ struct obj *obj;
 {
        register struct monst *mtmp, *nextmon;
 
-       if ((is_silent(youmonst.data) || youmonst.data->msound == MS_BUZZ) &&
-           (breathless(youmonst.data) || verysmall(youmonst.data) ||
-            !has_head(youmonst.data) || youmonst.data->mlet == S_EEL)) {
+       if (!can_blow(&youmonst)) {
                You("are incapable of using the whistle.");
        } else if (obj->cursed && !rn2(2)) {
                You("produce a %shigh-pitched humming noise.",
index b9fd5b3ed9d9e4b80e28753ab7dac1e7822c1c01..b580c4d832114e610e67dd292b3034999cd0d4ad 100644 (file)
@@ -246,6 +246,18 @@ struct permonst *mptr;
                      (slithy(mptr) && !bigmonst(mptr)));
 }
 
+boolean
+can_blow(mtmp)         /* returns TRUE if monster can blow (whistle, etc) */
+register struct monst *mtmp;
+{
+       if ((is_silent(mtmp->data) || mtmp->data->msound == MS_BUZZ) &&
+           (breathless(mtmp->data) || verysmall(mtmp->data) ||
+            !has_head(mtmp->data) || mtmp->data->mlet == S_EEL))
+           return FALSE;
+       if ((mtmp == &youmonst) && Strangled) return FALSE;
+       return TRUE;
+}
+
 boolean
 can_track(ptr)         /* returns TRUE if monster can track well */
        register struct permonst *ptr;
index d3ba97e49a175798a249669a9794b0205409b336..e0412a5813d7b6913cf02710d3a1c5326398946c 100644 (file)
@@ -487,6 +487,12 @@ struct obj *instr;
     if (Underwater) {
        You_cant("play music underwater!");
        return(0);
+    } else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE ||
+               instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN ||
+               instr->otyp == FIRE_HORN || instr->otyp == BUGLE) &&
+              !can_blow(&youmonst)) {
+       You("are incapable of playing %s.", the(distant_name(instr, xname)));
+       return(0);
     }
     if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE) {
        c = yn("Improvise?");