[net.games.hack] A facilitating bug

kneller@ucsfcgl.UUCP (Don Kneller%Langridge) (03/10/86)

It has occurred to me several times that killer bees just aren't
as much problem with HACK 1.03 as with version 1.01.  In 1.03 you can
run away when you're in trouble.  The bees follow you (sometimes), but
they don't hit.  Previously, they'd follow you (closely) *and* hit.
After some looking at the code to 1.01 I found the problem.  One
section of code was changed to use an additional local variable which
checked to see if the monster was close to you.  However, the variable
was not updated when a multiple-move monster (B,A,k,o among others)
moved closer to you.  Thus these monsters didn't "know" they were
beside you and wouldn't try to hit you.

To make matters even easier for you, when one of these monsters went to move
again, the position you were at was considered inaccessible (because it was
occupied by something), so the monster often moved away!  This made killer
bees appear not to be able to track you even though they were right beside
you.  Needless to say, this made one of the most difficult monsters *much*
easier.

This bug fix restores the potency of killer bees (and other multiple-move
monsters).

*** hack.mon.old.c	Sun Mar  9 22:20:46 1986
--- hack.mon.c	Sun Mar  9 22:20:27 1986
***************
*** 218,223
  		tmp = m_move(mtmp,0);	/* 2: monster died moving */
  		if(tmp == 2 || (tmp && mdat->mmove <= 12))
  			return(tmp == 2);
  	}
  
  	if(!index("Ea", mdat->mlet) && nearby &&

--- 218,227 -----
  		tmp = m_move(mtmp,0);	/* 2: monster died moving */
  		if(tmp == 2 || (tmp && mdat->mmove <= 12))
  			return(tmp == 2);
+ 		/* Without this line, fast monsters don't hit you when they've
+ 		 * caught up to you. -dgk
+ 		 */
+ 		nearby = (dist(mtmp->mx, mtmp->my) < 3); /* bugfix - dgk */
  	}
  
  	if(!index("Ea", mdat->mlet) && nearby &&
-- 
	Don Kneller
UUCP:	...ucbvax!ucsfcgl!kneller
ARPA:	kneller@ucsf-cgl.ARPA
BITNET:	kneller@ucsfcgl.BITNET

kyrimis@tilt.FUN (Kriton Kyrimis) (03/13/86)

In article <786@ucsfcgl.UUCP> kneller@ucsfcgl.UUCP (Don Kneller) writes:
>It has occurred to me several times that killer bees just aren't
>as much problem with HACK 1.03 as with version 1.01.  In 1.03 you can
>run away when you're in trouble.  The bees follow you (sometimes), but
>they don't hit.  Previously, they'd follow you (closely) *and* hit.
>After some looking at the code to 1.01 I found the problem.  One
>section of code was changed to use an additional local variable which
>checked to see if the monster was close to you.  However, the variable
>was not updated when a multiple-move monster (B,A,k,o among others)
>moved closer to you.  Thus these monsters didn't "know" they were
>beside you and wouldn't try to hit you.
>
>To make matters even easier for you, when one of these monsters went to move
>again, the position you were at was considered inaccessible (because it was
>occupied by something), so the monster often moved away!  This made killer
>bees appear not to be able to track you even though they were right beside
>you.  Needless to say, this made one of the most difficult monsters *much*
>easier.
>
>This bug fix restores the potency of killer bees (and other multiple-move
>monsters).

Unfortunately, the posted patch makes agile monsters such as  B's
and  A's  ignore  Elbereth (and possibly scare monster scrolls ),
which is not quite right.  As I'm not familiar with the  workings
of  the  hack source I will not venture to offer a bug fix on the
bug fix, but I'll simply caution you against applying this  patch
in its current form.
-- 

	Kriton	(princeton!tilt!kyrimis)
------
"You know, I think it's just a matter of putting two and two together
 to make three..."
------

kneller@ucsfcgl.UUCP (Don Kneller%Langridge) (03/16/86)

In article <394@tilt.FUN> kyrimis@tilt.UUCP (Kriton ) writes:
>In article <786@ucsfcgl.UUCP> kneller@ucsfcgl.UUCP (Don Kneller) writes:
>>It has occurred to me several times that killer bees just aren't
>>as much problem with HACK 1.03 as with version 1.01.  In 1.03 you can
>>run away when you're in trouble.  The bees follow you (sometimes), but
>>they don't hit.  Previously, they'd follow you (closely) *and* hit.
>>
>>This bug fix restores the potency of killer bees (and other multiple-move
>>monsters).
>
>Unfortunately, the posted patch makes agile monsters such as  B's
>and  A's  ignore  Elbereth (and possibly scare monster scrolls ),
>which is not quite right.  As I'm not familiar with the  workings

Oops, I goofed.  I managed to forget to update a second local variable
that determines whether the monster should be scared.  Here is a reworked
version of the fix.

*** hack.mon.old	Sun Mar 16 00:52:19 1986
--- hack.mon.c	Sun Mar 16 00:42:23 1986
***************
*** 152,158
  register struct monst *mtmp;
  {
  	register struct permonst *mdat;
! 	register tmp, nearby, scared;
  
  	if(mtmp->cham && !rn2(6))
  		(void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]);

--- 152,158 -----
  register struct monst *mtmp;
  {
  	register struct permonst *mdat;
! 	register tmp, nearby, scared, onscary;
  
  	if(mtmp->cham && !rn2(6))
  		(void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]);
***************
*** 199,206
  		mtmp->mflee = 0;
  
  	nearby = (dist(mtmp->mx, mtmp->my) < 3);
! 	scared = (nearby && (sengr_at("Elbereth", u.ux, u.uy) ||
! 			sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy)));
  	if(scared && !mtmp->mflee) {
  		mtmp->mflee = 1;
  		mtmp->mfleetim = (rn2(7) ? rnd(10) : rnd(100));

--- 199,207 -----
  		mtmp->mflee = 0;
  
  	nearby = (dist(mtmp->mx, mtmp->my) < 3);
! 	onscary = (sengr_at("Elbereth", u.ux, u.uy) ||
! 			sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy));
! 	scared = (nearby && onscary);
  	if(scared && !mtmp->mflee) {
  		mtmp->mflee = 1;
  		mtmp->mfleetim = (rn2(7) ? rnd(10) : rnd(100));
***************
*** 218,223
  		tmp = m_move(mtmp,0);	/* 2: monster died moving */
  		if(tmp == 2 || (tmp && mdat->mmove <= 12))
  			return(tmp == 2);
  	}
  
  	if(!index("Ea", mdat->mlet) && nearby &&

--- 219,233 -----
  		tmp = m_move(mtmp,0);	/* 2: monster died moving */
  		if(tmp == 2 || (tmp && mdat->mmove <= 12))
  			return(tmp == 2);
+ 		/* The following lines restore the ability of multiple-move
+ 		 * monsters to hit you after having caught up. - dgk
+ 		 */
+ 		nearby = (dist(mtmp->mx, mtmp->my) < 3);
+ 		scared = (nearby && onscary);
+ 		if(scared && !mtmp->mflee) {
+ 			mtmp->mflee = 1;
+ 			mtmp->mfleetim = (rn2(7) ? rnd(10) : rnd(100));
+ 		}
  	}
  
  	if(!index("Ea", mdat->mlet) && nearby &&
-- 
	Don Kneller
UUCP:	...ucbvax!ucsfcgl!kneller
ARPA:	kneller@ucsf-cgl.ARPA
BITNET:	kneller@ucsfcgl.BITNET