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

CF: regeneration, sp recovery, hungry patch



Mannen Akihiro sent out a patch that corrects a problem with the code not
changing regeneration, magic (mana recovery), sustenance, or grace recovery
when equiping or removing an item.  His patch is correct, but his patch uses
these attributes from the saved player file which may not be accurate any
more.

The following patch searches the applied items for these attributes and
sets them accordingly.  Thus, these fields will be correct even if they
are not correctly saved in the player file.  Since the applied items 
(fix_player function) are now checked as part equipping or removing items
that can change abilities (change_abil function), either Mr Mannen Akihiro's
patch or the following patch should be used.  If both are used then
temporarily (until fix_player is called) the affected attribute will be
wrong.

*** oldcommon/living.c	Wed Oct  2 04:12:53 1996
--- common/living.c	Sat Oct  5 06:46:36 1996
***************
*** 867,872 ****
--- 867,876 ----
         op->chosen_skill->level=op->chosen_skill->exp_obj->level;
  #endif
      op->attacktype=0;    
+ 	op->contr->digestion = 0;
+ 	op->contr->gen_hp = 0;
+ 	op->contr->gen_sp = 0;
+ 	op->contr->gen_grace = 0;
    }
    if(op->slaying!=NULL) {
      free_string(op->slaying);
***************
*** 909,917 ****
  		     * inappropriate to allow these applied objects to change stats */ 
             && tmp->type!=EXPERIENCE 
  #endif
!       )
          for(i=0;i<7;i++)
            change_attr_value(&(op->stats),i,get_attr_value(&(tmp->stats),i));
        op->protected|=tmp->protected;
        op->vulnerable|=tmp->vulnerable;
        op->attacktype|=tmp->attacktype;
--- 913,936 ----
  		     * inappropriate to allow these applied objects to change stats */ 
             && tmp->type!=EXPERIENCE 
  #endif
!       ) {
          for(i=0;i<7;i++)
            change_attr_value(&(op->stats),i,get_attr_value(&(tmp->stats),i));
+ 		/* these are the items that currently can change digestion, regeneration,
+ 		 * spell point recovery and mana point recovery.  Seems sort of an arbitary
+ 		 * list, but other items store other info into stats array. */
+ 		if ( (tmp->type == EXPERIENCE) || (tmp->type == WEAPON)
+ 		  || (tmp->type == ARMOUR) || (tmp->type == HELMET)
+ 		  || (tmp->type == SHIELD) || (tmp->type == RING)
+ 		  || (tmp->type == BOOTS) || (tmp->type == GLOVES)
+ 		  || (tmp->type == AMULET ) || (tmp->type == GIRDLE)
+ 		  || (tmp->type == BRACERS ) || (tmp->type == CLOAK)){
+ 			op->contr->digestion += tmp->stats.food;
+ 			op->contr->gen_hp += tmp->stats.hp;
+ 			op->contr->gen_sp += tmp->stats.sp;
+ 			op->contr->gen_grace += tmp->stats.grace;
+ 		}
+ 	  }
        op->protected|=tmp->protected;
        op->vulnerable|=tmp->vulnerable;
        op->attacktype|=tmp->attacktype;