Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: patch for hiding spam msg




	Here's that promised patch for version 0.93.3; a 
	prior hiding patch created a potental spam problem. -b.t.

*** ./crossfire-0.93.3/server/monster.c	Fri Apr 25 02:52:08 1997
--- ../crossfire-0.93.3/server/monster.c	Wed May  7 05:27:55 1997
***************
*** 1379,1388 ****
--- 1379,1390 ----
    /* opponent is unseen? */
    if(!can_see_enemy(op,enemy)) {
      object *part = get_nearest_part(op,enemy);
      int radius = MIN_MON_RADIUS;
      int x_dist = abs(part->x-enemy->x), y_dist = abs(part->y-enemy->y);
+     /* This is percentage change of being discovered while standing
+      * *adjacent* to the monster */
      int hide_discovery = enemy->hide?op->stats.Int/5:-1;
  
  
      /* detect non-hidden (eg dark/invis enemy) */
      if(!enemy->hide)  
***************
*** 1406,1421 ****
  
      /* the stealth adjustment. Only if you are stealthy 
       * will you be able to sneak up closer to creatures */ 
      if(QUERY_FLAG(enemy,FLAG_STEALTH)) 
        radius = radius/2, hide_discovery = hide_discovery/3;
- #if 0
-     /* this makes it too hard on hiding */
-     else /* never less than minimum radii */ 
-       radius=radius<MIN_MON_RADIUS?MIN_MON_RADIUS:radius;
- #endif
- 
  
      /* sanity check if the enemy is visible */
      if(!enemy->invisible) {
         /* on dark maps body heat can help indicate location with infravision */
         if(QUERY_FLAG(op,FLAG_SEE_IN_DARK)&&op->map->darkness>0
--- 1408,1417 ----
***************
*** 1426,1458 ****
  	* the monster should see you. */
  	if(radius<MIN_MON_RADIUS&&op->map->darkness<5) 
  	  radius = MIN_MON_RADIUS;
      }
  
!     /* now check if enemy detected/found. Either the enemy
       * will get too close OR if *hidden*, there is a small
!      * chance each time we check this function that monster
       * can detect the enemy. This means the longer you hide
!      * near something, the greater the chance you are discovered. */
      if((x_dist<radius&&y_dist<radius)
        ||(enemy->hide&&(x_dist<=1||y_dist<=1)
          &&RANDOM()%100<=(hide_discovery>0?hide_discovery:0))
      ) {
! 	if(enemy->hide) { /* make hidden enemy visible */
  	   make_visible(enemy);
  	   /* inform players of new status */
  	   if(enemy->type==PLAYER) 
  	     new_draw_info(NDI_UNIQUE,0, enemy,"You are discovered!");
          }
!     } else {
!        /* ok, didnt find them, but warn player IF they are gettting
!         * close to being discovered */
!        if(enemy->type==PLAYER && (x_dist==radius||y_dist==radius))  
! 	  new_draw_info_format(NDI_UNIQUE,0, enemy,"%s looks near your hidden spot.",
!             query_name(op));
         return 0;
-     }
    }
    return 1;
  } 
  
  /* determine if op stands in a lighted square. This is not a very
--- 1422,1488 ----
  	* the monster should see you. */
  	if(radius<MIN_MON_RADIUS&&op->map->darkness<5) 
  	  radius = MIN_MON_RADIUS;
      }
  
!     /* Lets not worry about monsters that have incredible detection
!      * radii, we only need to worry here about things the player can 
!      * see. */
!     if(radius>6) radius = 6;
! 
!     /* Now check if the enemy is detected/found. Either the enemy
       * will get too close OR if *hidden*, there is a small
!      * chance each time we check this function that the monster
       * can detect the enemy. This means the longer you hide
!      * near something, the greater the chance you have of
!      * being discovered. */
      if((x_dist<radius&&y_dist<radius)
        ||(enemy->hide&&(x_dist<=1||y_dist<=1)
          &&RANDOM()%100<=(hide_discovery>0?hide_discovery:0))
      ) {
!         /* make hidden/tmp invisible (player) enemies visible */
! 	if(enemy->invisible && (enemy->hide || !QUERY_FLAG(enemy,FLAG_MAKE_INVIS))) 
! 	{ 
  	   make_visible(enemy);
  	   /* inform players of new status */
  	   if(enemy->type==PLAYER) 
  	     new_draw_info(NDI_UNIQUE,0, enemy,"You are discovered!");
          }
!         return 1; /* detected enemy */ 
! 
!     } else if(enemy->hide 	/* Nearby Hidden enemies */
! 	&& (x_dist==radius||y_dist==radius)
!     ) { 
!        /* Since the enemy is nearby we excellerate the time of 
!         * becoming unhidden (ie as finding the enemy is easier)
!  	* In order to leave actual discovery (hide==0 state) to
! 	* be handled above (not here) we only decrement so that 
! 	* enemy->invisible>1 is preserved. */
!        if((enemy->invisible-=RANDOM()%(op->stats.Int+2))<1) enemy->invisible=1;
! 
!        /* MESSAGING: If we didnt find them, we may warn a hidden 
! 	* player that the monster is getting close to discoverng them. 
!   	*
!         * We only warn the player if: 
! 	*   1) the player/monster level criteria are met
! 	*   2) random value based on player Int value
!    	* This is done primarily to cut down on the messaging 
!  	* and to promote greater care from the player in sneaking 
! 	* up on monsters.
!    	*/
!        if(enemy->type==PLAYER 
! 	   && ((SK_level(enemy)>op->level? RANDOM()%5 : RANDOM()%3) > 1) 
! 	   && (RANDOM()%(enemy->stats.Int+10)> 15)
!        ) { 
!          char buf[MAX_BUF];
!          sprintf(buf,"%s looks near your hidden spot.", query_name(op));
! 	 new_draw_info(NDI_UNIQUE,0, enemy, buf);
!        }
!        return enemy->hide?0:1;
! 
!     } else /* Enemy is invisible/hidden far away and NOT found, return 0 */ 
         return 0;
    }
    return 1;
  } 
  
  /* determine if op stands in a lighted square. This is not a very
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]