knockback knocking riding hero out of saddle

I've implemented targetted dismount such that being knocked out of
the saddle will place the hero opposite the attacker in preference
to a random spot adjacent to the steed.  If that opposite spot
isn't appropriate, the two spots next to it get tried.

In these map fragments, H is knocking mounted hero off of u.  The
digits indicate priority of potential destinations.

|.....   |..21.
|...2.   |..u2.
|.Hu1.   |.H...
|...2.   |.....

If spot 1 isn't acceptable, both of spots 2 (in random order) will
be tried next.  If those aren't acceptable either, it will try the
other 5 spots adjacent to the steed (the one of those with the
attacker will always be unacceptable).  And as before, it none of
those work, it uses enexto() to pick a random spot as close to the
steed as feasible.

Not knockback:  when dismounting due to polymorph, avoid diagonal
adjacent spots if hero's new form can't move diagonally.  (The hero
can't already be in no-diagonal form because riding requires that
the rider be humanoid.  I keep thinking the restriction is "can't
be polymorphed" but that isn't correct.)
This commit is contained in:
PatR
2022-10-27 15:33:49 -07:00
parent 69f62e5872
commit da32b572a6
3 changed files with 106 additions and 40 deletions

View File

@@ -5433,7 +5433,7 @@ void
confdir(boolean force_impairment)
{
if (force_impairment || u_maybe_impaired()) {
register coordxy x = NODIAG(u.umonnum) ? dirs_ord[rn2(4)] : rn2(N_DIRS);
int x = NODIAG(u.umonnum) ? (int) dirs_ord[rn2(4)] : rn2(N_DIRS);
u.dx = xdir[x];
u.dy = ydir[x];