]> granicus.if.org Git - nethack/commitdiff
whistle use while polymorphed
authorcohrs <cohrs>
Mon, 26 Jan 2004 23:19:36 +0000 (23:19 +0000)
committercohrs <cohrs>
Mon, 26 Jan 2004 23:19:36 +0000 (23:19 +0000)
Restrict poly'd whistle use to monsters that can blow a whistle.  The
restriction includes those that make no sound (or just buzz, which is a
wing-thing) and are either breathless, tiny (eg ants), headless or water
natives.  Searching monst.c, this appeared to provide a reasonable set of
restrictions.  There are a couple cases one might quibble about if someone
feels like refining this further.

doc/fixes35.0
src/apply.c

index dfb15131fc1549ae5af61d217fc74ab2039dd40f..42098bd68a58f8957c66277b42dc26ce2585cba9 100644 (file)
@@ -55,6 +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
 
 
 Platform- and/or Interface-Specific Fixes
index 8143a8a260412131c11ca2fdd1c63c9704fbdaf6..ee2252337f2f866b545bc3f9810a8c899a0bdf8b 100644 (file)
@@ -389,7 +389,11 @@ STATIC_OVL void
 use_whistle(obj)
 struct obj *obj;
 {
-       if(Underwater) {
+       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)) {
+           You("are incapable of using the whistle.");
+       } else if(Underwater) {
            You("blow bubbles through %s.", yname(obj));
        } else {
            You(whistle_str, obj->cursed ? "shrill" : "high");
@@ -403,13 +407,17 @@ struct obj *obj;
 {
        register struct monst *mtmp, *nextmon;
 
-       /* it's magic!  it works underwater too (at a higher pitch) */
-       if(obj->cursed && !rn2(2)) {
+       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)) {
+               You("are incapable of using the whistle.");
+       } else if (obj->cursed && !rn2(2)) {
                You("produce a %shigh-pitched humming noise.",
                    Underwater ? "very " : "");
                wake_nearby();
        } else {
                int pet_cnt = 0;
+               /* it's magic!  it works underwater too (at a higher pitch) */
                You(whistle_str, Hallucination ? "normal" :
                    Underwater ? "strange, high-pitched" : "strange");
                for(mtmp = fmon; mtmp; mtmp = nextmon) {