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

CF: invisibility patch...





	I found that items (like scrolls) could not impart invisibility
	to the user. THis was from improper handling of the "casting object".

	I made a patch so that invisibilty will now work from scrolls, etc
	as well as from spell casting.

							-bt.

ps apply patch below to spell_effect.c.

*** ../../tarfiles/crossfire-0.92.3/server/spell_effect.c	Thu Mar  7 03:38:25 1996
--- ./spell_effect.c	Tue Apr 23 05:18:42 1996
***************
*** 445,482 ****
    new_draw_info(NDI_UNIQUE, 0,op,"You detect nothing.");
    return 1;
  }
  
  int cast_invisible(object *op, int spell_type) {
!   object *tmp;
  
    if(op->invisible>1000) {
      new_draw_info(NDI_UNIQUE, 0,op,"You are already as invisible as you can get.");
      return 0;
    }
    switch(spell_type) {
    case SP_INVIS:
      CLEAR_FLAG(op, FLAG_UNDEAD);
-     op->invisible+=SP_PARAMETERS[spell_type].bdur;  /* set the base */
-     op->invisible+=SP_PARAMETERS[spell_type].ldam *
-                   SP_level_strength_adjust(op,spell_type);  /*  set the level bonus */
-     if(op->type==PLAYER)
-       op->contr->tmp_invis=1;
      break;
    case SP_INVIS_UNDEAD:
      SET_FLAG(op, FLAG_UNDEAD);
-     op->invisible+=SP_PARAMETERS[spell_type].bdur;  /* set the base */
-     op->invisible+=SP_PARAMETERS[spell_type].ldam *
-                   SP_level_strength_adjust(op,spell_type);  /*  set the level bonus */
- 
-     if(op->type==PLAYER)
-       op->contr->tmp_invis=1;
      break;
    case SP_IMPROVED_INVIS:
!     op->invisible+=SP_PARAMETERS[spell_type].bdur;  /* set the base */
!     op->invisible+=SP_PARAMETERS[spell_type].ldam *
!                   SP_level_strength_adjust(op,spell_type);  /*  set the level bonus */
      break;
    }
    new_draw_info(NDI_UNIQUE, 0,op,"You can't see your hands!");
    update_object(op);
    for (tmp = objects; tmp != NULL; tmp = tmp->next)
--- 452,485 ----
    new_draw_info(NDI_UNIQUE, 0,op,"You detect nothing.");
    return 1;
  }
  
  int cast_invisible(object *op, int spell_type) {
!   object *tmp,*caster=get_owner(op);
!   int strength=SP_level_strength_adjust(op,spell_type);  /*  set the level bonus */
  
+   if(caster) op=caster; /* so invis can be used from scrolls/potions! */
+ 
    if(op->invisible>1000) {
      new_draw_info(NDI_UNIQUE, 0,op,"You are already as invisible as you can get.");
      return 0;
    }
+ 
+   op->invisible+=SP_PARAMETERS[spell_type].bdur;  /* set the base */
+   op->invisible+=SP_PARAMETERS[spell_type].ldam * strength;
+   if(op->type==PLAYER) 
+ 	op->contr->tmp_invis=1;
+ 
    switch(spell_type) {
    case SP_INVIS:
      CLEAR_FLAG(op, FLAG_UNDEAD);
      break;
    case SP_INVIS_UNDEAD:
      SET_FLAG(op, FLAG_UNDEAD);
      break;
    case SP_IMPROVED_INVIS:
!     op->contr->tmp_invis=0;
      break;
    }
    new_draw_info(NDI_UNIQUE, 0,op,"You can't see your hands!");
    update_object(op);
    for (tmp = objects; tmp != NULL; tmp = tmp->next)