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

Function disintegrate_arm

src/do_wear.c:3200–3256  ·  view source on GitHub ↗

hit by destroy armor scroll/black dragon breath */

Source from the content-addressed store, hash-verified

3198
3199/* hit by destroy armor scroll/black dragon breath */
3200int
3201disintegrate_arm(struct obj *atmp)
3202{
3203 struct obj *otmp = (struct obj *) 0;
3204 boolean losing_gloves = FALSE, resisted = FALSE,
3205 resistedc = FALSE, resistedsuit = FALSE;
3206 /*
3207 * Note: if the cloak resisted, then the suit or shirt underneath
3208 * wouldn't be impacted either. Likewise, if the suit resisted, the
3209 * shirt underneath wouldn't be impacted. Since there are no artifact
3210 * cloaks or suits right now, this is unlikely to come into effect,
3211 * but it should behave appropriately if/when the situation changes.
3212 */
3213
3214 if ((otmp = maybe_destroy_armor(uarmc, atmp, &resistedc)) != 0) {
3215 urgent_pline("Your %s crumbles and turns to dust!",
3216 /* cloak/robe/apron/smock (ID'd apron)/wrapping */
3217 cloak_simple_name(otmp));
3218 } else if (!resistedc
3219 && (otmp = maybe_destroy_armor(uarm, atmp, &resistedsuit)) != 0) {
3220 const char *suit = suit_simple_name(otmp);
3221
3222 /* for gold DSM, we don't want Armor_gone() to report that it
3223 stops shining _after_ we've been told that it is destroyed */
3224 if (otmp->lamplit)
3225 end_burn(otmp, FALSE);
3226 urgent_pline("Your %s %s to dust and %s to the %s!",
3227 /* suit might be "dragon scales" so vtense() is needed */
3228 suit, vtense(suit, "turn"), vtense(suit, "fall"),
3229 surface(u.ux, u.uy));
3230 } else if (!resistedc && !resistedsuit
3231 && (otmp = maybe_destroy_armor(uarmu, atmp, &resisted)) != 0) {
3232 urgent_pline("Your %s crumbles into tiny threads and falls apart!",
3233 shirt_simple_name(otmp)); /* always "shirt" */
3234 } else if ((otmp = maybe_destroy_armor(uarmh, atmp, &resisted)) != 0) {
3235 urgent_pline("Your %s turns to dust and is blown away!",
3236 helm_simple_name(otmp)); /* "helm" or "hat" */
3237 } else if ((otmp = maybe_destroy_armor(uarmg, atmp, &resisted)) != 0) {
3238 urgent_pline("Your %s vanish!", gloves_simple_name(otmp));
3239 losing_gloves = TRUE;
3240 } else if ((otmp = maybe_destroy_armor(uarmf, atmp, &resisted)) != 0) {
3241 urgent_pline("Your %s disintegrate!", boots_simple_name(otmp));
3242 } else if ((otmp = maybe_destroy_armor(uarms, atmp, &resisted)) != 0) {
3243 urgent_pline("Your %s crumbles away!", shield_simple_name(otmp));
3244 } else {
3245 return 0; /* could not destroy anything */
3246 }
3247
3248 /* cancel_don() if applicable, Cloak_off()/Armor_off()/&c, and useup() */
3249 wornarm_destroyed(otmp);
3250 /* glove loss means wielded weapon will be touched */
3251 if (losing_gloves)
3252 selftouch("You");
3253
3254 stop_occupation();
3255 return 1;
3256}
3257

Callers 4

god_zaps_youFunction · 0.85
zhituFunction · 0.85
seffect_destroy_armorFunction · 0.85

Calls 15

maybe_destroy_armorFunction · 0.85
urgent_plineFunction · 0.85
cloak_simple_nameFunction · 0.85
suit_simple_nameFunction · 0.85
end_burnFunction · 0.85
vtenseFunction · 0.85
surfaceFunction · 0.85
shirt_simple_nameFunction · 0.85
helm_simple_nameFunction · 0.85
gloves_simple_nameFunction · 0.85
boots_simple_nameFunction · 0.85
shield_simple_nameFunction · 0.85

Tested by

no test coverage detected