getting knocked off flying steed
I was trying to reproduce the reported "no monster to remove" warning from remove_monster() when a mounted hero was knocked off jabberwocky steed but so far haven't been able to. While trying, I came across a more minor bug. The hero got knocked off a flying steed and got feedback of "you fly off" rather than "you fall off". Flying capability came from the steed and dismount feedback is aware of that but calls u_locomotion() which isn't. This commit fixes that. This adds some groundwork (DISMOUNT_KNOCKED) for better dismount control. With a map fragment of |.... |.Du. |.... I got knocked off my steed by the attacking dragon and ended up with |..@. |.Du. |.... It would be better to prefer spot 1, then the 2s, then 3s, then 4s (not sure about farther spots if none of those are available) |.432 |.D@1 |.432 when forced to dismount by knockback. This does _not_ implement that.
This commit is contained in:
18
src/steed.c
18
src/steed.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 steed.c $NHDT-Date: 1646171628 2022/03/01 21:53:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.95 $ */
|
||||
/* NetHack 3.7 steed.c $NHDT-Date: 1664837604 2022/10/03 22:53:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.100 $ */
|
||||
/* Copyright (c) Kevin Hugo, 1998-1999. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -445,6 +445,13 @@ landing_spot(
|
||||
boolean found = FALSE;
|
||||
struct trap *t;
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* for reason==DISMOUNT_KNOCKED, prefer the spot directly behind
|
||||
* current position relative to the attacker; first need to figure
|
||||
* how to obtain attacker information...
|
||||
*/
|
||||
|
||||
/* avoid known traps (i == 0) and boulders, but allow them as a backup */
|
||||
if (reason != DISMOUNT_BYCHOICE || Stunned || Confusion || Fumbling)
|
||||
i = 1;
|
||||
@@ -498,18 +505,21 @@ dismount_steed(
|
||||
/* Sanity check */
|
||||
if (!mtmp) /* Just return silently */
|
||||
return;
|
||||
u.usteed = 0; /* affects Fly test; could hypothetically affect Lev */
|
||||
u.usteed = 0; /* affects Fly test; could hypothetically affect Lev;
|
||||
* also affects u_locomotion() */
|
||||
ufly = Flying ? TRUE : FALSE;
|
||||
ulev = Levitation ? TRUE : FALSE;
|
||||
verb = u_locomotion("fall"); /* only used for _FELL and _KNOCKED */
|
||||
u.usteed = mtmp;
|
||||
|
||||
/* Check the reason for dismounting */
|
||||
otmp = which_armor(mtmp, W_SADDLE);
|
||||
switch (reason) {
|
||||
case DISMOUNT_THROWN:
|
||||
verb = "are thrown";
|
||||
/*FALLTHRU*/
|
||||
case DISMOUNT_KNOCKED:
|
||||
case DISMOUNT_FELL:
|
||||
verb = (reason == DISMOUNT_THROWN) ? "are thrown"
|
||||
: u_locomotion("fall");
|
||||
You("%s off of %s!", verb, mon_nam(mtmp));
|
||||
if (!have_spot)
|
||||
have_spot = landing_spot(&cc, reason, 1);
|
||||
|
||||
Reference in New Issue
Block a user