Stop riding the current steed */
| 573 | |
| 574 | /* Stop riding the current steed */ |
| 575 | void |
| 576 | dismount_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: |
no test coverage detected