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

CF: various patches for various spells




    I just did a diff -cr to pull out all the various changes I've been
trying out.  I think some of them are ready to be published here, for
further testing and decisions on whether to include them.  Comments on
the changes I've made are marked with my initials, D.A.M.N.

This one makes a couple things level dependent that used to be fixed:
1) time it takes Word of Recall to take effect
2) amount of energy transferred by Transferrence spell
3) percentage of energy drained by Magic Drain spell

Also, the following effects have been modified:
1) Followers of a cult that considers undead enemies have a penalty to
Command Undead.
2) Magic Drain gives back to the caster a small portion of the energy
drained from the victim.

And a bug was fixed:
1) SP_level_dam_adjust used and SP_level_strength_adjust used the
player's level, where they should have used the caster's level.

-- 
            -Dave Noelle,                 dave@Straylight.org
            -the Villa Straylight,  http://www.straylight.org

diff -cr crossfire-0.95.4/include/sproto.h crossfire-0.95.4-mod/include/sproto.h
*** crossfire-0.95.4/include/sproto.h	Tue Jul 13 00:42:16 1999
--- crossfire-0.95.4-mod/include/sproto.h	Thu Jul 29 14:31:35 1999
***************
*** 508,514 ****
  extern int probe ( object *op, int dir );
  extern int cast_invisible ( object *op, object *caster, int spell_type );
  extern int cast_earth2dust ( object *op, object *caster );
! extern int cast_wor ( object *op );
  extern int cast_wow ( object *op, int dir, int ability, SpellTypeFrom item );
  extern int perceive_self ( object *op );
  extern int cast_destruction ( object *op, object *caster, int dam, int attacktype );
--- 508,514 ----
  extern int probe ( object *op, int dir );
  extern int cast_invisible ( object *op, object *caster, int spell_type );
  extern int cast_earth2dust ( object *op, object *caster );
! extern int cast_wor ( object *op, object *caster );
  extern int cast_wow ( object *op, int dir, int ability, SpellTypeFrom item );
  extern int perceive_self ( object *op );
  extern int cast_destruction ( object *op, object *caster, int dam, int attacktype );
diff -cr crossfire-0.95.4/lib/spell_params crossfire-0.95.4-mod/lib/spell_params
*** crossfire-0.95.4/lib/spell_params	Tue Jul 13 00:42:17 1999
--- crossfire-0.95.4-mod/lib/spell_params	Thu Aug  5 21:27:03 1999
***************
*** 35,38 ****
--- 35,44 ----
  sunspear
  6 8  8 8 3 9  30
  dark vision
  5 10  0 4 0 5  30
+ word of recall
+ 10 40 0 5 0 1 40
+ transference
+ 5 10 8 0 2 0 2
+ magic drain
+ 12 20 75 30 4 2 10
diff -cr crossfire-0.95.4/server/spell_effect.c crossfire-0.95.4-mod/server/spell_effect.c
*** crossfire-0.95.4/server/spell_effect.c	Tue Jul 13 00:42:16 1999
--- crossfire-0.95.4-mod/server/spell_effect.c	Thu Aug  5 23:50:06 1999
***************
*** 662,668 ****
  }
  
  /* puts a 'WORD_OF_RECALL_' object in player */
! int cast_wor(object *op) {
    object *dummy;
  
    if(op->type!=PLAYER)
--- 662,669 ----
  }
  
  /* puts a 'WORD_OF_RECALL_' object in player */
! /* modified to work faster for higher level casters -- DAMN		*/
! int cast_wor(object *op, object *caster) {
    object *dummy;
  
    if(op->type!=PLAYER)
***************
*** 678,690 ****
      return 0;
    }
    if(op->owner) op=op->owner; /* better insert the spell in the player */
!   dummy->speed = 0.01;
    update_ob_speed(dummy);
    dummy->speed_left= -1;
    dummy->type=WORD_OF_RECALL;
    EXIT_PATH(dummy)=add_string(first_map_path);
    (void) insert_ob_in_ob(dummy,op);
    new_draw_info(NDI_UNIQUE, 0,op,"You feel a force starting to build up inside you.");
    return 1;
  }
  
--- 679,696 ----
      return 0;
    }
    if(op->owner) op=op->owner; /* better insert the spell in the player */
!   dummy->speed = 0.002 * ((float)(SP_PARAMETERS[SP_WOR].bdur
! 				 + SP_level_strength_adjust(op,caster,SP_WOR)));
    update_ob_speed(dummy);
    dummy->speed_left= -1;
    dummy->type=WORD_OF_RECALL;
    EXIT_PATH(dummy)=add_string(first_map_path);
    (void) insert_ob_in_ob(dummy,op);
    new_draw_info(NDI_UNIQUE, 0,op,"You feel a force starting to build up inside you.");
+   LOG(llevDebug,"Word of Recall for %s in %f ticks.\n", op->name,
+       ((-dummy->speed_left)/(dummy->speed==0?0.0001:dummy->speed)));
+   LOG(llevDebug,"Word of Recall for player level %d, caster level %d: 0.002 * %d + %d\n",
+       SK_level(op), SK_level(caster), SP_PARAMETERS[SP_WOR].bdur, SP_level_strength_adjust(op,caster,SP_WOR));
    return 1;
  }
  
***************
*** 2290,2297 ****
  		break;
  
      if(plyr) {
  	int maxsp=plyr->stats.maxsp;
! 	int sp=(plyr->stats.sp+=8);
  
  	new_draw_info(NDI_UNIQUE, 0,plyr,"You feel energy course through you.");
  	if(sp>=maxsp*2) {
--- 2296,2305 ----
  		break;
  
      if(plyr) {
+       /* DAMN: added spell strength adjust; higher level casters transfer mana faster */
  	int maxsp=plyr->stats.maxsp;
! 	int sp=(plyr->stats.sp += SP_PARAMETERS[SP_TRANSFER].bdam
! 		+ SP_level_dam_adjust(op,op,SP_TRANSFER));
  
  	new_draw_info(NDI_UNIQUE, 0,plyr,"You feel energy course through you.");
  	if(sp>=maxsp*2) {
***************
*** 2320,2345 ****
  /*  drain_magic:  peterm  */
  /*  drains all the magic out of the victim.  */
  int drain_magic(object *op,int dir) {
!      object *tmp=NULL;
  
!    if (!out_of_map(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) {
!      for(tmp=get_map_ob(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir]);
!          tmp!=NULL;
!          tmp=tmp->above)
!         if(QUERY_FLAG(tmp, FLAG_ALIVE))
! 		break;
       /*  If we did not find a player in the specified direction, transfer
  	to anyone on top of us. */
!    }
  
!     if(tmp==NULL)
!          for(tmp=get_map_ob(op->map,op->x,op->y); tmp!=NULL; tmp=tmp->above)
! 	if(QUERY_FLAG(tmp, FLAG_ALIVE))
          break;
  
! 
!       if(tmp&&op!=tmp) { tmp->stats.sp*=0.1; return 1; }
!       else return 0;
  }
       
  /*  counterspell:  peterm  */
--- 2328,2370 ----
  /*  drain_magic:  peterm  */
  /*  drains all the magic out of the victim.  */
  int drain_magic(object *op,int dir) {
!   object *tmp=NULL;
!   double mana, rate;
  
!   if (!out_of_map(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir])) {
!     for(tmp=get_map_ob(op->map,op->x+freearr_x[dir],op->y+freearr_y[dir]);
! 	tmp!=NULL;
! 	tmp=tmp->above)
!       if(QUERY_FLAG(tmp, FLAG_ALIVE))
! 	break;
       /*  If we did not find a player in the specified direction, transfer
  	to anyone on top of us. */
!   }
  
!   if(tmp==NULL)
!     for(tmp=get_map_ob(op->map,op->x,op->y); tmp!=NULL; tmp=tmp->above)
!       if(QUERY_FLAG(tmp, FLAG_ALIVE))
          break;
  
!   /* DAMN: Percent spell point loss determined by caster level
!      Caster gains percent of drained mana, also determined by caster level */
!   if(tmp&&op!=tmp) {
!     rate = (double)(SP_PARAMETERS[SP_MAGIC_DRAIN].bdam
!       + 5* SP_level_dam_adjust(op,op,SP_MAGIC_DRAIN)) / 100.0;
!     if(rate > 0.95) rate = 0.95;
!     mana = tmp->stats.sp * rate;
!     tmp->stats.sp -= mana;
!     if(QUERY_FLAG(op, FLAG_ALIVE)) {
!       rate = (double)(SP_PARAMETERS[SP_MAGIC_DRAIN].bdam
! 	+ 5* SP_level_strength_adjust(op,op,SP_MAGIC_DRAIN)) / 100.0;
!       if(rate > 0.95) rate = 0.95;
!       mana = mana * rate;
!       op->stats.sp += mana;
!     }
!     return 1;
!   } else {
!     return 0;
!   }
  }
       
  /*  counterspell:  peterm  */
***************
*** 2456,2464 ****
  }
  
  int cast_charm_undead(object *op, object *caster,archetype *arch,int spellnum) {
!   int i,bonus=QUERY_FLAG(caster,FLAG_UNDEAD)?5:-1; /* the undead command themselves better */ 
    object *tmp,*effect;
   
    for(i=1;i<MIN(9+SP_level_strength_adjust(op,caster,spellnum),SIZEOFFREE);i++) {
  	if (out_of_map(op->map,op->x+freearr_x[i],op->y+freearr_y[i]))
  	    continue;
--- 2481,2496 ----
  }
  
  int cast_charm_undead(object *op, object *caster,archetype *arch,int spellnum) {
!   int i,bonus;
    object *tmp,*effect;
   
+   if (QUERY_FLAG(caster,FLAG_UNDEAD) || strstr(find_god(determine_god(op))->race,undead_name)!=NULL) {
+     bonus = 5;
+   } else if (strstr(find_god(determine_god(op))->slaying,undead_name)!=NULL) {
+     bonus = -5;
+   } else {
+     bonus = -1;
+   }
    for(i=1;i<MIN(9+SP_level_strength_adjust(op,caster,spellnum),SIZEOFFREE);i++) {
  	if (out_of_map(op->map,op->x+freearr_x[i],op->y+freearr_y[i]))
  	    continue;
diff -cr crossfire-0.95.4/server/spell_util.c crossfire-0.95.4-mod/server/spell_util.c
*** crossfire-0.95.4/server/spell_util.c	Tue Jul 13 00:42:16 1999
--- crossfire-0.95.4-mod/server/spell_util.c	Tue Aug  3 06:44:36 1999
***************
*** 111,118 ****
  
   if (op->path_denied & s->path)
    return -100;				/* shouldn't get here, but ... */
!  val = ((op->path_repelled & s->path)!=0) * -5 +
! 	((op->path_attuned & s->path)!=0) * 5;
   if (op->level - val < 1)
    return op->level-1;
   else
--- 111,118 ----
  
   if (op->path_denied & s->path)
    return -100;				/* shouldn't get here, but ... */
!  val = (op->path_repelled & s->path) ? -5 : 0
!    +   (op->path_attuned & s->path) ? 5 : 0;
   if (op->level - val < 1)
    return op->level-1;
   else
***************
*** 468,474 ****
      success = perceive_self(op);
      break;
    case SP_WOR:
!     success = cast_wor(op);
      break;
    case SP_INVIS:
    case SP_INVIS_UNDEAD:
--- 468,474 ----
      success = perceive_self(op);
      break;
    case SP_WOR:
!     success = cast_wor(op,caster);
      break;
    case SP_INVIS:
    case SP_INVIS_UNDEAD:
***************
*** 1659,1671 ****
   * the casters level (op->level) with the skill level (SK_level(op)) 
   * instead for when we have compiled with ALLOW_SKILLS - b.t. 
   */
  
  int SP_level_dam_adjust(object *op, object *caster, int spell_type)
  {  int adj;
  #ifdef ALLOW_SKILLS
!    int level=SK_level(op)+path_level_mod(caster, spell_type);
  #else
!    int level=op->level+path_level_mod(caster, spell_type);
  #endif
  
      adj=(level-spells[spell_type].level);
--- 1659,1673 ----
   * the casters level (op->level) with the skill level (SK_level(op)) 
   * instead for when we have compiled with ALLOW_SKILLS - b.t. 
   */
+ /* now based on caster's level instead of on op's level and caster's	*
+  * path modifiers. 	--DAMN						*/
  
  int SP_level_dam_adjust(object *op, object *caster, int spell_type)
  {  int adj;
  #ifdef ALLOW_SKILLS
!    int level=SK_level(caster)+path_level_mod(caster, spell_type);
  #else
!    int level=caster->level+path_level_mod(caster, spell_type);
  #endif
  
      adj=(level-spells[spell_type].level);
***************
*** 1677,1689 ****
  }
  
  /* July 1995 - changed slightly (SK_level) for ALLOW_SKILLS - b.t. */
! 
  int SP_level_strength_adjust(object *op, object *caster, int spell_type)
  {  int adj;
  #ifdef ALLOW_SKILLS
!    int level=SK_level(op)+path_level_mod(caster, spell_type);
  #else
!    int level=op->level+path_level_mod(caster, spell_type);
  #endif
      adj= (level-spells[spell_type].level);
      if(adj < 0) adj=0;
--- 1679,1692 ----
  }
  
  /* July 1995 - changed slightly (SK_level) for ALLOW_SKILLS - b.t. */
! /* now based on caster's level instead of on op's level and caster's	*
!  * path modifiers. 	--DAMN						*/
  int SP_level_strength_adjust(object *op, object *caster, int spell_type)
  {  int adj;
  #ifdef ALLOW_SKILLS
!    int level=SK_level(caster)+path_level_mod(caster, spell_type);
  #else
!    int level=caster->level+path_level_mod(caster, spell_type);
  #endif
      adj= (level-spells[spell_type].level);
      if(adj < 0) adj=0;
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]