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

@@ -153,6 +153,8 @@ stone to flesh on a statue with contents would lose the contents if a
monster was on the same location as the statue
steed movement would use your speed if walking step by step
kicking a known, unseen monster would sometimes leave behind an extra I symbol
applying a lance against a long worm could cause an impossible
a knight applying a lance did not do a caitiff check
Platform- and/or Interface-Specific Fixes

View File

@@ -1983,6 +1983,7 @@ E void NDECL(u_init);
E void FDECL(hurtmarmor,(struct monst *,int));
E boolean FDECL(attack_checks, (struct monst *,struct obj *));
E void FDECL(check_caitiff, (struct monst *));
E schar FDECL(find_roll_to_hit, (struct monst *));
E boolean FDECL(attack, (struct monst *));
E boolean FDECL(hmon, (struct monst *,struct obj *,int));

View File

@@ -2367,6 +2367,8 @@ use_pole (obj)
if ((mtmp = m_at(cc.x, cc.y)) != (struct monst *)0) {
int oldhp = mtmp->mhp;
bhitpos = cc;
check_caitiff(mtmp);
(void) thitmonst(mtmp, uwep);
/* check the monster's HP because thitmonst() doesn't return
* an indication of whether it hit. Not perfect (what if it's a

View File

@@ -61,14 +61,7 @@ register boolean clumsy;
if(mon->m_ap_type) seemimic(mon);
/* it is unchivalrous to attack the defenseless or from behind */
if (Role_if(PM_KNIGHT) &&
u.ualign.type == A_LAWFUL && u.ualign.record > -10 &&
(!mon->mcanmove || mon->msleeping ||
(mon->mflee && !mon->mavenge))) {
You_feel("like a caitiff!");
adjalign(-1);
}
check_caitiff(mon);
/* squeeze some guilt feelings... */
if(mon->mtame) {

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 &&