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

Function harmless_missile

src/dothrow.c:1219–1248  ·  view source on GitHub ↗

Will 'obj' cause damage if it falls on hero's head when thrown upward? Not used to handle things which break when they hit. Stone missile hitting hero w/ Passes_walls attribute handled separately. */

Source from the content-addressed store, hash-verified

1217 Not used to handle things which break when they hit.
1218 Stone missile hitting hero w/ Passes_walls attribute handled separately. */
1219boolean
1220harmless_missile(struct obj *obj)
1221{
1222 int otyp = obj->otyp;
1223
1224 /* this list is fairly arbitrary */
1225 switch (otyp) {
1226 case SLING:
1227 case EUCALYPTUS_LEAF:
1228 case KELP_FROND:
1229 case SPRIG_OF_WOLFSBANE:
1230 case FORTUNE_COOKIE:
1231 case PANCAKE:
1232 return TRUE;
1233 case RUBBER_HOSE:
1234 case BAG_OF_TRICKS:
1235 return (obj->spe < 1);
1236 case SACK:
1237 case OILSKIN_SACK:
1238 case BAG_OF_HOLDING:
1239 return !Has_contents(obj);
1240 default:
1241 if (obj->oclass == SCROLL_CLASS) /* scrolls but not all paper objs */
1242 return TRUE;
1243 if (objects[otyp].oc_material == CLOTH)
1244 return TRUE;
1245 break;
1246 }
1247 return FALSE;
1248}
1249
1250/*
1251 * Hero tosses an object upwards with appropriate consequences.

Callers 2

toss_upFunction · 0.85
hit_barsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected