general musical instrument use while polymorphed
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 *));
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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?");
|
||||
|
||||
Reference in New Issue
Block a user