MCPcopy Create free account
hub / github.com/NetHack/NetHack / muse_unslime

Function muse_unslime

src/muse.c:3103–3242  ·  view source on GitHub ↗

mon uses an item--selected by caller--to burn away incipient slime */

Source from the content-addressed store, hash-verified

3101
3102/* mon uses an item--selected by caller--to burn away incipient slime */
3103staticfn boolean
3104muse_unslime(
3105 struct monst *mon,
3106 struct obj *obj,
3107 struct trap *trap,
3108 boolean by_you) /* true: if mon kills itself, hero gets credit/blame */
3109{ /* [by_you not honored if 'mon' triggers fire trap]. */
3110 struct obj *odummyp;
3111 int otyp = obj->otyp, dmg = 0;
3112 boolean vis = canseemon(mon), res = TRUE;
3113
3114 if (vis)
3115 pline_mon(mon, "%s starts turning %s.", Monnam(mon),
3116 green_mon(mon) ? "into ooze" : hcolor(NH_GREEN));
3117 /* -4 => sliming, causes quiet loss of enhanced speed */
3118 mon_adjust_speed(mon, -4, (struct obj *) 0);
3119
3120 if (trap) {
3121 const char *Mnam = vis ? Monnam(mon) : 0;
3122
3123 if (mon->mx == trap->tx && mon->my == trap->ty) {
3124 if (vis)
3125 pline("%s triggers %s fire trap!", Mnam,
3126 trap->tseen ? "the" : "a");
3127 } else {
3128 remove_monster(mon->mx, mon->my);
3129 newsym(mon->mx, mon->my);
3130 place_monster(mon, trap->tx, trap->ty);
3131 if (mon->wormno) /* won't happen; worms don't MUSE to unslime */
3132 worm_move(mon);
3133 newsym(mon->mx, mon->my);
3134 if (vis)
3135 pline("%s %s %s %s fire trap!", Mnam,
3136 vtense(fakename[0], locomotion(mon->data, "move")),
3137 is_floater(mon->data) ? "over" : "onto",
3138 trap->tseen ? "the" : "a");
3139 }
3140 (void) mintrap(mon, FORCETRAP);
3141 } else if (otyp == STRANGE_OBJECT) {
3142 /* monster is using fire breath on self */
3143 if (vis)
3144 pline_mon(mon, "%s.",
3145 monverbself(mon, Monnam(mon), "breath", "fire on"));
3146 if (!rn2(3))
3147 mon->mspec_used = rn1(10, 5);
3148 /* -21 => monster's fire breath; 1 => # of damage dice */
3149 dmg = zhitm(mon, by_you ? 21 : -21, 1, &odummyp);
3150 } else if (otyp == SCR_FIRE) {
3151 mreadmsg(mon, obj);
3152 if (mon->mconf) {
3153 if (cansee(mon->mx, mon->my))
3154 pline("Oh, what a pretty fire!");
3155 if (vis)
3156 trycall(obj);
3157 m_useup(mon, obj); /* after trycall() */
3158 vis = FALSE; /* skip makeknown() below */
3159 res = FALSE; /* failed to cure sliming */
3160 } else {

Callers 1

munslimeFunction · 0.85

Calls 15

canseemonFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
green_monFunction · 0.85
hcolorFunction · 0.85
mon_adjust_speedFunction · 0.85
newsymFunction · 0.85
place_monsterFunction · 0.85
worm_moveFunction · 0.85
vtenseFunction · 0.85
locomotionFunction · 0.85
mintrapFunction · 0.85

Tested by

no test coverage detected