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

Function steedintrap

src/trap.c:3101–3168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3099}
3100
3101staticfn int
3102steedintrap(struct trap *trap, struct obj *otmp)
3103{
3104 struct monst *steed = u.usteed;
3105 int tt;
3106 boolean trapkilled, steedhit;
3107
3108 if (!steed || !trap)
3109 return Trap_Effect_Finished;
3110 tt = trap->ttyp;
3111 steed->mx = u.ux;
3112 steed->my = u.uy;
3113 trapkilled = steedhit = FALSE;
3114
3115 switch (tt) {
3116 case ARROW_TRAP:
3117 if (!otmp) {
3118 impossible("steed hit by non-existent arrow?");
3119 return Trap_Effect_Finished;
3120 }
3121 trapkilled = thitm(8, steed, otmp, 0, FALSE);
3122 steedhit = TRUE;
3123 break;
3124 case DART_TRAP:
3125 if (!otmp) {
3126 impossible("steed hit by non-existent dart?");
3127 return Trap_Effect_Finished;
3128 }
3129 trapkilled = thitm(7, steed, otmp, 0, FALSE);
3130 steedhit = TRUE;
3131 break;
3132 case SLP_GAS_TRAP:
3133 if (!resists_sleep(steed) && !breathless(steed->data)
3134 && !helpless(steed)) {
3135 if (sleep_monst(steed, rnd(25), -1))
3136 /* no in_sight check here; you can feel it even if blind */
3137 pline("%s suddenly falls asleep!", Monnam(steed));
3138 }
3139 steedhit = TRUE;
3140 break;
3141 case LANDMINE:
3142 trapkilled = thitm(0, steed, (struct obj *) 0, rnd(16), FALSE);
3143 steedhit = TRUE;
3144 break;
3145 case PIT:
3146 case SPIKED_PIT:
3147 trapkilled = (DEADMONSTER(steed)
3148 || thitm(0, steed, (struct obj *) 0,
3149 rnd((tt == PIT) ? 6 : 10), FALSE));
3150 steedhit = TRUE;
3151 break;
3152 case POLY_TRAP:
3153 if (!resists_magm(steed) && !resist(steed, WAND_CLASS, 0, NOTELL)) {
3154 /* newcham() will probably end up calling poly_steed() */
3155 (void) newcham(steed, (struct permonst *) 0, NC_SHOW_MSG);
3156 }
3157 steedhit = TRUE;
3158 break;

Callers 7

trapeffect_arrow_trapFunction · 0.85
trapeffect_dart_trapFunction · 0.85
trapeffect_slp_gas_trapFunction · 0.85
trapeffect_pitFunction · 0.85
trapeffect_magic_trapFunction · 0.85
trapeffect_poly_trapFunction · 0.85
trapeffect_landmineFunction · 0.85

Calls 10

thitmFunction · 0.85
sleep_monstFunction · 0.85
rndFunction · 0.85
MonnamFunction · 0.85
resists_magmFunction · 0.85
resistFunction · 0.85
newchamFunction · 0.85
dismount_steedFunction · 0.85
impossibleFunction · 0.70
plineFunction · 0.70

Tested by

no test coverage detected