refine #K4060 fix - affect of riding on stealth
Hide some of the details about new Stealth. Streamline mon_break_armor(). Move replicated bypass handling into m_lose_armor(). Also, eliminate a 'goto'.
This commit is contained in:
56
src/worn.c
56
src/worn.c
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static void m_lose_armor(struct monst *, struct obj *);
|
||||
static void m_lose_armor(struct monst *, struct obj *, boolean);
|
||||
static void clear_bypass(struct obj *);
|
||||
static void m_dowear_type(struct monst *, long, boolean, boolean);
|
||||
static int extra_pref(struct monst *, struct obj *);
|
||||
@@ -802,10 +802,15 @@ which_armor(struct monst *mon, long flag)
|
||||
|
||||
/* remove an item of armor and then drop it */
|
||||
static void
|
||||
m_lose_armor(struct monst *mon, struct obj *obj)
|
||||
m_lose_armor(
|
||||
struct monst *mon,
|
||||
struct obj *obj,
|
||||
boolean polyspot)
|
||||
{
|
||||
extract_from_minvent(mon, obj, TRUE, FALSE);
|
||||
place_object(obj, mon->mx, mon->my);
|
||||
if (polyspot)
|
||||
bypass_obj(obj);
|
||||
/* call stackobj() if we ever drop anything that can merge */
|
||||
newsym(mon->mx, mon->my);
|
||||
}
|
||||
@@ -937,8 +942,9 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
{
|
||||
register struct obj *otmp;
|
||||
struct permonst *mdat = mon->data;
|
||||
boolean vis = cansee(mon->mx, mon->my);
|
||||
boolean handless_or_tiny = (nohands(mdat) || verysmall(mdat));
|
||||
boolean vis = cansee(mon->mx, mon->my),
|
||||
handless_or_tiny = (nohands(mdat) || verysmall(mdat)),
|
||||
noride = FALSE;
|
||||
const char *pronoun = mhim(mon), *ppronoun = mhis(mon);
|
||||
|
||||
if (breakarm(mdat)) {
|
||||
@@ -964,9 +970,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
if (vis)
|
||||
pline("%s %s falls off!", s_suffix(Monnam(mon)),
|
||||
cloak_simple_name(otmp));
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
} else {
|
||||
Soundeffect(se_ripping_sound, 100);
|
||||
if (vis)
|
||||
@@ -995,9 +999,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
pronoun);
|
||||
else
|
||||
You_hear("a thud.");
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
if ((otmp = which_armor(mon, W_ARMC)) != 0
|
||||
/* mummy wrapping adapts to small and very big sizes */
|
||||
@@ -1010,9 +1012,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
pline("%s shrinks out of %s %s!", Monnam(mon), ppronoun,
|
||||
cloak_simple_name(otmp));
|
||||
}
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
if ((otmp = which_armor(mon, W_ARMU)) != 0) {
|
||||
if (vis) {
|
||||
@@ -1023,9 +1023,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
pline("%s becomes much too small for %s shirt!",
|
||||
Monnam(mon), ppronoun);
|
||||
}
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
}
|
||||
if (handless_or_tiny) {
|
||||
@@ -1034,9 +1032,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
if (vis)
|
||||
pline("%s drops %s gloves%s!", Monnam(mon), ppronoun,
|
||||
MON_WEP(mon) ? " and weapon" : "");
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
if ((otmp = which_armor(mon, W_ARMS)) != 0) {
|
||||
Soundeffect(se_clank, 50);
|
||||
@@ -1045,9 +1041,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
ppronoun);
|
||||
else
|
||||
You_hear("a clank.");
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
}
|
||||
if (handless_or_tiny || has_horns(mdat)) {
|
||||
@@ -1059,9 +1053,7 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
surface(mon->mx, mon->my));
|
||||
else
|
||||
You_hear("a clank.");
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
}
|
||||
if (handless_or_tiny || slithy(mdat) || mdat->mlet == S_CENTAUR) {
|
||||
@@ -1073,23 +1065,19 @@ mon_break_armor(struct monst *mon, boolean polyspot)
|
||||
pline("%s boots %s off %s feet!", s_suffix(Monnam(mon)),
|
||||
verysmall(mdat) ? "slide" : "are pushed", ppronoun);
|
||||
}
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
}
|
||||
}
|
||||
if (!can_saddle(mon)) {
|
||||
if ((otmp = which_armor(mon, W_SADDLE)) != 0) {
|
||||
if (polyspot)
|
||||
bypass_obj(otmp);
|
||||
m_lose_armor(mon, otmp);
|
||||
m_lose_armor(mon, otmp, polyspot);
|
||||
if (vis)
|
||||
pline("%s saddle falls off.", s_suffix(Monnam(mon)));
|
||||
}
|
||||
if (mon == u.usteed)
|
||||
goto noride;
|
||||
} else if (mon == u.usteed && !can_ride(mon)) {
|
||||
noride:
|
||||
noride = TRUE;
|
||||
}
|
||||
if (noride || (mon == u.usteed && !can_ride(mon))) {
|
||||
You("can no longer ride %s.", mon_nam(mon));
|
||||
if (touch_petrifies(u.usteed->data) && !Stone_resistance && rnl(3)) {
|
||||
char buf[BUFSZ];
|
||||
|
||||
Reference in New Issue
Block a user