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

Function dismount_steed

src/steed.c:575–822  ·  view source on GitHub ↗

Stop riding the current steed */

Source from the content-addressed store, hash-verified

573
574/* Stop riding the current steed */
575void
576dismount_steed(
577 int reason) /* Player was thrown off etc. */
578{
579 struct monst *mtmp;
580 struct obj *otmp;
581 const char *verb;
582 coord cc, steedcc;
583 unsigned save_utrap = u.utrap;
584 boolean ulev, ufly,
585 repair_leg_damage = (Wounded_legs != 0L),
586 have_spot = landing_spot(&cc, reason, 0);
587
588 mtmp = u.usteed; /* make a copy of steed pointer */
589 /* Sanity check */
590 if (!mtmp) /* Just return silently */
591 return;
592 u.usteed = 0; /* affects Fly test; could hypothetically affect Lev;
593 * also affects u_locomotion() */
594 ufly = Flying ? TRUE : FALSE;
595 ulev = Levitation ? TRUE : FALSE;
596 verb = u_locomotion("fall"); /* only used for _FELL and _KNOCKED */
597 u.usteed = mtmp;
598
599 /* Check the reason for dismounting */
600 otmp = which_armor(mtmp, W_SADDLE);
601 switch (reason) {
602 case DISMOUNT_THROWN:
603 verb = "are thrown";
604 FALLTHROUGH;
605 /*FALLTHRU*/
606 case DISMOUNT_KNOCKED:
607 case DISMOUNT_FELL:
608 You("%s off of %s!", verb, mon_nam(mtmp));
609 if (!have_spot)
610 have_spot = landing_spot(&cc, reason, 1);
611 if (!ulev && !ufly) {
612 losehp(Maybe_Half_Phys(rn1(10, 10)), "riding accident",
613 KILLED_BY_AN);
614 set_wounded_legs(BOTH_SIDES, (int) HWounded_legs + rn1(5, 5));
615 repair_leg_damage = FALSE;
616 }
617 break;
618 case DISMOUNT_POLY:
619 You("can no longer ride %s.", mon_nam(u.usteed));
620 if (!have_spot)
621 have_spot = landing_spot(&cc, reason, 1);
622 break;
623 case DISMOUNT_ENGULFED:
624 /* caller displays message */
625 break;
626 case DISMOUNT_BONES:
627 /* hero has just died... */
628 break;
629 case DISMOUNT_GENERIC:
630 /* no messages, just make it so */
631 break;
632 case DISMOUNT_BYCHOICE:

Callers 15

savebonesFunction · 0.85
mhitm_ad_seduFunction · 0.85
mhitm_knockbackFunction · 0.85
dorideFunction · 0.85
kick_steedFunction · 0.85
poly_steedFunction · 0.85
goto_levelFunction · 0.85
retouch_equipmentFunction · 0.85
pooleffectsFunction · 0.85
slip_or_tripFunction · 0.85
update_mon_extrinsicsFunction · 0.85
mon_break_armorFunction · 0.85

Calls 15

landing_spotFunction · 0.85
u_locomotionFunction · 0.85
which_armorFunction · 0.85
YouFunction · 0.85
mon_namFunction · 0.85
losehpFunction · 0.85
set_wounded_legsFunction · 0.85
anFunction · 0.85
pmnameFunction · 0.85
MgenderFunction · 0.85
heal_legsFunction · 0.85
steed_vs_stealthFunction · 0.85

Tested by

no test coverage detected