MCPcopy Index your code
hub / github.com/NetHack/NetHack / gulpmm

Function gulpmm

src/mhitm.c:848–967  ·  view source on GitHub ↗

Returns the same values as mattackm(). */

Source from the content-addressed store, hash-verified

846
847/* Returns the same values as mattackm(). */
848staticfn int
849gulpmm(
850 struct monst *magr,
851 struct monst *mdef,
852 struct attack *mattk)
853{
854 coordxy ax, ay, dx, dy;
855 int status;
856 struct obj *obj;
857
858 if (!engulf_target(magr, mdef))
859 return M_ATTK_MISS;
860
861 if (gv.vis) {
862 pline("%s %s %s.", Monnam(magr),
863 digests(magr->data) ? "swallows"
864 : enfolds(magr->data) ? "encloses"
865 : "engulfs",
866 mon_nam(mdef));
867 }
868 if (!flaming(magr->data)) {
869 for (obj = mdef->minvent; obj; obj = obj->nobj)
870 (void) snuff_lit(obj);
871 }
872
873 if (is_vampshifter(mdef)
874 && newcham(mdef, &mons[mdef->cham], NO_NC_FLAGS)) {
875 if (gv.vis) {
876 /* 'it' -- previous form is no longer available and
877 using that would be excessively verbose */
878 pline("%s expels %s.", Monnam(magr),
879 canspotmon(mdef) ? "it" : something);
880 if (canspotmon(mdef)) {
881 pline("It turns into %s.",
882 x_monnam(mdef, ARTICLE_A, (char *) 0,
883 (SUPPRESS_NAME | SUPPRESS_IT
884 | SUPPRESS_INVISIBLE), FALSE));
885 }
886 }
887 return M_ATTK_HIT; /* bypass mdamagem() */
888 }
889
890 /*
891 * All of this manipulation is needed to keep the display correct.
892 * There is a flush at the next pline().
893 */
894 ax = magr->mx;
895 ay = magr->my;
896 dx = mdef->mx;
897 dy = mdef->my;
898 /*
899 * Leave the defender in the monster chain at its current position,
900 * but don't leave it on the screen. Move the aggressor to the
901 * defender's position.
902 */
903 remove_monster(dx, dy);
904 remove_monster(ax, ay);
905 place_monster(magr, dx, dy);

Callers 1

mattackmFunction · 0.85

Calls 13

engulf_targetFunction · 0.85
MonnamFunction · 0.85
mon_namFunction · 0.85
snuff_litFunction · 0.85
newchamFunction · 0.85
place_monsterFunction · 0.85
newsymFunction · 0.85
mdamagemFunction · 0.85
goodposFunction · 0.85
minliquidFunction · 0.85
t_atFunction · 0.85
mintrapFunction · 0.85

Tested by

no test coverage detected