R919 - applying lances

Fixes 2 bugs:
1) an impossible() could occur if you applied a lance against a long worm
because the code uses thitmonst to do the hitting, but didn't set bhitpos,
which is required before calling thitmonst.
Add the missing assignment.
2) applying a lance would never mark a knight as a caitiff.  Added a new
check_caitiff function and called it from the 2 existing checks and in
the lance code.
This commit is contained in:
cohrs
2002-07-11 05:16:27 +00:00
parent c0bcc8d292
commit 35914ed186
5 changed files with 23 additions and 16 deletions

View File

@@ -205,6 +205,22 @@ struct obj *wep; /* uwep for attack(), null for kick_monster() */
return(FALSE);
}
/*
* It is unchivalrous for a knight to attack the defenseless or from behind.
*/
void
check_caitiff(mtmp)
struct monst *mtmp;
{
if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL &&
(!mtmp->mcanmove || mtmp->msleeping ||
(mtmp->mflee && !mtmp->mavenge)) &&
u.ualign.record > -10) {
You("caitiff!");
adjalign(-1);
}
}
schar
find_roll_to_hit(mtmp)
register struct monst *mtmp;
@@ -215,14 +231,7 @@ register struct monst *mtmp;
tmp = 1 + Luck + abon() + find_mac(mtmp) + u.uhitinc +
maybe_polyd(youmonst.data->mlevel, u.ulevel);
/* it is unchivalrous to attack the defenseless or from behind */
if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL &&
(!mtmp->mcanmove || mtmp->msleeping ||
(mtmp->mflee && !mtmp->mavenge)) &&
u.ualign.record > -10) {
You("caitiff!");
adjalign(-1);
}
check_caitiff(mtmp);
/* attacking peaceful creatures is bad for the samurai's giri */
if (Role_if(PM_SAMURAI) && mtmp->mpeaceful &&