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

minor spell_effect.c fixes



Here are some fixes to spell_effect.c:

* in create food: by specifying an archetype name, one could get a 
food item that was higher than one's  maximum food value.  Fixed.

* in create missile: missile plus was not properly adjusting missile 
weight.  Fixed.

* in consecrate: more of an enhancement, really... get the new face 
and name of the altar from the archetype for the new god's altar.  
Updating the altar's face when it's consecrated both makes it more 
obvious when someone's reconsecrated that altar you've been using, and 
looks neat. :-)


*** spell_effect.c	2000/05/22 10:27:48	1.1.1.2
--- spell_effect.c	2000/06/04 22:49:19
***************
*** 523,532 ****
--- 523,533 ----
  	 * We don't use flesh types because the weight values of those need
  	 * to be altered from the donor.
  	 */
  
  	/* We assume the food items don't have multiple parts */
+ 	at=NULL;
  	for (at_tmp=first_archetype; at_tmp!=NULL; at_tmp=at_tmp->next) {
  	    if (at_tmp->clone.type==FOOD || at_tmp->clone.type==DRINK) {
  		/* Basically, if the food value is something that is creatable
  		 * under the limits of the spell and it is higher than
  		 * the item we have now, take it instead.
***************
*** 1682,1691 ****
--- 1683,1693 ----
      missile->nrof=1;
  
    missile->magic = missile_plus;
    missile->value=0; /* it would be too easy to get money by creating
  			arrows +4 and selling them, even with value = 1 */
+   missile->weight=(missile->weight * (10 - missile_plus)) / 10;
  
    SET_FLAG(missile, FLAG_IDENTIFIED);
    if (!cast_create_obj(op,caster,missile,dir) && op->type==PLAYER) {
      tmp= get_owner(op);
      if (!tmp)
***************
*** 2889,2898 ****
--- 2891,2901 ----
      char buf[MAX_BUF];
      int success=0;
  
  #ifdef MULTIPLE_GODS
      object *tmp, *god=find_god(determine_god(op));
+     archetype *at;
  
      if(!god) {
  	new_draw_info(NDI_UNIQUE, 0,op,
  		      "You can't consecrate anything if you don't worship a god!");
          return 0;
***************
*** 2909,2922 ****
  		new_draw_info_format(NDI_UNIQUE, 0,op,
  		    "You are not poweful enough to reconsecrate the altar of %s", tmp->title);
  	    } else {
  	    /* If we got here, we are consecrating an altar */
  		if(tmp->name)	free_string(tmp->name);
  		sprintf(buf,"%s of %s",tmp->arch->clone.name,god->name);
- 		tmp->name = add_string(buf);
  		tmp->level = SK_level(op);
  		tmp->other_arch = god->arch;
  		if(op->type==PLAYER) esrv_update_item(UPD_NAME, op, tmp);
  		new_draw_info_format(NDI_UNIQUE,0, op,
  				     "You consecrated the altar to %s!",god->name);
  		return 1;
  	    }
--- 2912,2943 ----
  		new_draw_info_format(NDI_UNIQUE, 0,op,
  		    "You are not poweful enough to reconsecrate the altar of %s", tmp->title);
  	    } else {
  	    /* If we got here, we are consecrating an altar */
  		if(tmp->name)	free_string(tmp->name);
+ 
  		sprintf(buf,"%s of %s",tmp->arch->clone.name,god->name);
  		tmp->level = SK_level(op);
  		tmp->other_arch = god->arch;
+ 
+ 		/* dress up the altar appropriately */
+ 		for(at=first_archetype; at; at=at->next) {
+ 		    if(at->clone.type == HOLY_ALTAR &&
+ 		       at->clone.other_arch == tmp->other_arch) {
+ 			tmp->face = at->clone.face;
+ 			strcpy(buf, at->clone.name);
+ 			break;
+ 		    }
+ 		}
+ 
+ 		/* only capitalize high level altars */
+ 		if(tmp->level < 100 && !strncmp(buf, "Altar ", 6))
+ 		    buf[0] = 'a';
+ 
+ 		tmp->name = add_string(buf);
+ 
+ 		update_object(tmp);
  		if(op->type==PLAYER) esrv_update_item(UPD_NAME, op, tmp);
  		new_draw_info_format(NDI_UNIQUE,0, op,
  				     "You consecrated the altar to %s!",god->name);
  		return 1;
  	    }