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

CF: throwing patch




	In CF0.92.7 monsters decide what to throw based on their
	INT, unfortunately, only the "head" portion of the monster
	seems to contain the INT information. Therefore, in some
	cases (now that monsters take a shot from more than just the
	head), the monster reverts to the "no INT" case (ie it will
	throw ANYTHING). 

	This patch also prevents ANY monster from throwing the 
	SPECIAL_KEY type (which are often used to construct the 
	quest logic of a map). 

							-b.t.

*** ../../tarfiles/crossfire-0.92.7/server/monster.c	Mon Sep 30 01:53:56 1996
--- ./monster.c	Fri Oct  4 06:22:39 1996
***************
*** 1243,1253 ****
  
  /* find_mon_throw_ob() - modeled on find_throw_ob */
  
  object *find_mon_throw_ob( object *op ) {
    object *tmp = NULL, *heaviest = NULL;
!   int stupid = op->stats.Int<6?1:0,dumb=op->stats.Int<10?1:0;
     
    if(!op) { /* safety */
      LOG(llevError,"find_mon_throw_ob(): confused! have a NULL thrower!\n");
      return (object *) NULL;
    }
--- 1243,1257 ----
  
  /* find_mon_throw_ob() - modeled on find_throw_ob */
  
  object *find_mon_throw_ob( object *op ) {
    object *tmp = NULL, *heaviest = NULL;
!   int stupid,dumb;
! 
!   if(op->head) tmp=op->head; else tmp=op;  
!   stupid = tmp->stats.Int<6?1:0;
!   dumb=tmp->stats.Int<10?1:0;
     
    if(!op) { /* safety */
      LOG(llevError,"find_mon_throw_ob(): confused! have a NULL thrower!\n");
      return (object *) NULL;
    }
***************
*** 1256,1267 ****
     * thrown weapons first, followed by heaviest objects. */
  
    for(tmp=op->inv;tmp;tmp=tmp->below) {
      if(!tmp) break;
       /* no throwing your arms,hands, head, etc. or invisible 
!       * items like skills */
!     if(tmp->invisible||tmp->type==FLESH) continue;
       /* this should prevent us from throwing away
        * cursed items, worn armour, etc. */
      if(QUERY_FLAG(tmp,FLAG_APPLIED)&&
  	(QUERY_FLAG(tmp,FLAG_CURSED)||QUERY_FLAG(tmp,FLAG_DAMNED)))
   	  continue;
--- 1260,1271 ----
     * thrown weapons first, followed by heaviest objects. */
  
    for(tmp=op->inv;tmp;tmp=tmp->below) {
      if(!tmp) break;
       /* no throwing your arms,hands, head, etc. or invisible 
!       * items like skills. No throwing special keys either! */
!     if(tmp->invisible||tmp->type==FLESH||tmp->type==SPECIAL_KEY) continue;
       /* this should prevent us from throwing away
        * cursed items, worn armour, etc. */
      if(QUERY_FLAG(tmp,FLAG_APPLIED)&&
  	(QUERY_FLAG(tmp,FLAG_CURSED)||QUERY_FLAG(tmp,FLAG_DAMNED)))
   	  continue;
***************
*** 1278,1288 ****
  	&&!spells[tmp->stats.sp].onself) break;
        if(QUERY_FLAG(tmp,FLAG_APPLIED)) continue;
        else if(tmp->type==BOW||tmp->type==ARROW||tmp->type==SCROLL
  	||tmp->type==BOOK||tmp->type==SPELLBOOK||tmp->type==AMULET
  	||tmp->type==MONEY||tmp->type==GEM||tmp->type==SKILL
! 	||(tmp->type==CONTAINER&&tmp->inv)
          ||tmp->magic>0||tmp->value>(10*SK_level(op))) 
  	  continue;
         /* 'throw' away 'trash'--spent wands and cursed items*/ 
        if((tmp->type==WAND&&tmp->stats.food==0)||QUERY_FLAG(tmp,FLAG_CURSED)
  	||QUERY_FLAG(tmp,FLAG_DAMNED))
--- 1282,1293 ----
  	&&!spells[tmp->stats.sp].onself) break;
        if(QUERY_FLAG(tmp,FLAG_APPLIED)) continue;
        else if(tmp->type==BOW||tmp->type==ARROW||tmp->type==SCROLL
  	||tmp->type==BOOK||tmp->type==SPELLBOOK||tmp->type==AMULET
  	||tmp->type==MONEY||tmp->type==GEM||tmp->type==SKILL
! 	||tmp->type==KEY||(tmp->type==CONTAINER&&tmp->inv)
! 	||(tmp->glow_radius>0&&!QUERY_FLAG(op->head?op->head:op,FLAG_SEE_IN_DARK)) 
          ||tmp->magic>0||tmp->value>(10*SK_level(op))) 
  	  continue;
         /* 'throw' away 'trash'--spent wands and cursed items*/ 
        if((tmp->type==WAND&&tmp->stats.food==0)||QUERY_FLAG(tmp,FLAG_CURSED)
  	||QUERY_FLAG(tmp,FLAG_DAMNED))