Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 21 additions & 27 deletions src/mhitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
static const char brief_feeling[] =
"have a %s feeling for a moment, then it passes.";

static void noises(struct monst *, struct attack *);
static void pre_mm_attack(struct monst *, struct monst *);
static void missmm(struct monst *, struct monst *, struct attack *);
static int hitmm(struct monst *, struct monst *, struct attack *,
struct obj *, int);
static int gazemm(struct monst *, struct monst *, struct attack *);
Expand All @@ -17,14 +20,11 @@ static int explmm(struct monst *, struct monst *, struct attack *);
static int mdamagem(struct monst *, struct monst *, struct attack *,
struct obj *, int);
static void mswingsm(struct monst *, struct monst *, struct obj *);
static void noises(struct monst *, struct attack *);
static void pre_mm_attack(struct monst *, struct monst *);
static void missmm(struct monst *, struct monst *, struct attack *);
static int passivemm(struct monst *, struct monst *, boolean, int,
struct obj *);

static void
noises(register struct monst *magr, register struct attack *mattk)
noises(struct monst *magr, struct attack *mattk)
{
boolean farq = (mdistu(magr) > 15);

Expand Down Expand Up @@ -71,30 +71,26 @@ pre_mm_attack(struct monst *magr, struct monst *mdef)
}
}

DISABLE_WARNING_FORMAT_NONLITERAL

/* feedback for when a monster-vs-monster attack misses */
static
void
missmm(register struct monst *magr, register struct monst *mdef,
struct attack *mattk)
missmm(
struct monst *magr, /* attacker */
struct monst *mdef, /* defender */
struct attack *mattk) /* attack and damage types */
{
const char *fmt;
char buf[BUFSZ];

pre_mm_attack(magr, mdef);

if (gv.vis) {
fmt = (could_seduce(magr, mdef, mattk) && !magr->mcan)
? "%s pretends to be friendly to"
: "%s misses";
Sprintf(buf, fmt, Monnam(magr));
pline("%s %s.", buf, mon_nam_too(mdef, magr));
} else
pline("%s %s %s.", Monnam(magr),
(magr->mcan || !could_seduce(magr, mdef, mattk)) ? "misses"
: "pretends to be friendly to",
mon_nam_too(mdef, magr));
} else {
noises(magr, mattk);
}
}

RESTORE_WARNING_FORMAT_NONLITERAL

/*
* fightm() -- fight some other monster
*
Expand Down Expand Up @@ -632,7 +628,7 @@ hitmm(
Strcat(mdef_name, " flesh");
}

pline("%s %s sears %s!", magr_name, /*s_suffix(magr_name), */
pline("%s %s sears %s!", magr_name, /* s_suffix(magr_name), */
simpleonames(mwep), mdef_name);
}
}
Expand Down Expand Up @@ -758,19 +754,17 @@ gulpmm(
{
coordxy ax, ay, dx, dy;
int status;
char buf[BUFSZ];
struct obj *obj;

if (!engulf_target(magr, mdef))
return MM_MISS;

if (gv.vis) {
/* [this two-part formatting dates back to when only one x_monnam
result could be included in an expression because the next one
would overwrite first's result -- that's no longer the case] */
Sprintf(buf, "%s %s", Monnam(magr),
digests(magr->data) ? "swallows" : "engulfs");
pline("%s %s.", buf, mon_nam(mdef));
pline("%s %s %s.", Monnam(magr),
digests(magr->data) ? "swallows"
: enfolds(magr->data) ? "encloses"
: "engulfs",
mon_nam(mdef));
}
if (!flaming(magr->data)) {
for (obj = mdef->minvent; obj; obj = obj->nobj)
Expand Down
3 changes: 2 additions & 1 deletion src/mhitu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,14 +1203,15 @@ gulpmu(struct monst *mtmp, struct attack *mattk)
} else {
urgent_pline("%s %s!", Monnam(mtmp),
digests(mtmp->data) ? "swallows you whole"
: enfolds(mtmp->data) ? "folds itself around you"
: "engulfs you");
}
stop_occupation();
reset_occupations(); /* behave as if you had moved */

if (u.utrap) {
You("are released from the %s!",
u.utraptype == TT_WEB ? "web" : "trap");
(u.utraptype == TT_WEB) ? "web" : "trap");
reset_utrap(FALSE);
}

Expand Down
26 changes: 17 additions & 9 deletions src/uhitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4577,15 +4577,17 @@ explum(struct monst *mdef, struct attack *mattk)
static void
start_engulf(struct monst *mdef)
{
boolean u_digest = digests(gy.youmonst.data),
u_enfold = enfolds(gy.youmonst.data);

if (!Invisible) {
map_location(u.ux, u.uy, TRUE);
tmp_at(DISP_ALWAYS, mon_to_glyph(&gy.youmonst, rn2_on_display_rng));
tmp_at(mdef->mx, mdef->my);
}
if (digests(gy.youmonst.data))
You("swallow %s whole!", mon_nam(mdef));
else
You("engulf %s!", mon_nam(mdef));
You("%s %s%s!",
u_digest ? "swallow" : u_enfold ? "enclose" : "engulf",
mon_nam(mdef), u_digest ? " whole" : "");
delay_output();
delay_output();
}
Expand All @@ -4605,12 +4607,14 @@ gulpum(struct monst *mdef, struct attack *mattk)
static char msgbuf[BUFSZ]; /* for gn.nomovemsg */
register int tmp;
register int dam = d((int) mattk->damn, (int) mattk->damd);
boolean fatal_gulp, u_digest = digests(gy.youmonst.data);
boolean fatal_gulp,
u_digest = digests(gy.youmonst.data),
u_enfold = enfolds(gy.youmonst.data);
struct obj *otmp;
struct permonst *pd = mdef->data;
const char *expel_verb = u_digest ? "regurgitate"
: enfolds(gy.youmonst.data) ? "release"
: "expel";
: u_enfold ? "release"
: "expel";

/* Not totally the same as for real monsters. Specifically, these
* don't take multiple moves. (It's just too hard, for too little
Expand All @@ -4633,7 +4637,8 @@ gulpum(struct monst *mdef, struct attack *mattk)
vampire form now instead of dealing with that when it dies */
if (is_vampshifter(mdef)
&& newcham(mdef, &mons[mdef->cham], NO_NC_FLAGS)) {
You("%s it, then %s it.", u_digest ? "swallow" : "engulf",
You("%s it, then %s it.",
u_digest ? "swallow" : u_enfold ? "enclose" : "engulf",
expel_verb);
if (canspotmon(mdef)) {
/* Avoiding a_monnam here: if the target is named, it gives us
Expand Down Expand Up @@ -4665,7 +4670,10 @@ gulpum(struct monst *mdef, struct attack *mattk)
if (!type_is_pname(pd))
mnam = an(mnam);
You("%s %s.", u_digest ? "englut" : "engulf", mon_nam(mdef));
Sprintf(kbuf, "%s %s%s", u_digest ? "swallowing" : "engulfing",
Sprintf(kbuf, "%s %s%s",
u_digest ? "swallowing"
: u_enfold ? "enclosing"
: "engulfing",
mnam, u_digest ? " whole" : "");
instapetrify(kbuf);
} else {
Expand Down