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

CF: spell level fixes II



server/player.c, fire():
Always call check_skill_to_fire(), even if wiz mode.  Dungeon masters
should not cast spells without associated skill and experience object.

server/spell_util.c():
Fix for my previous patch: Use the caster's level and not the owner's
level for calculating the casting level.

fire_swarm():
New argument to specify the caster, needed by the call to
casting_level().

fire_arch_from_position():
New argument to specify a casting level, needed by move_swarm_spell().

include/spellist.h:
meteor swarm spell is now PATH_MISSILE (same path as comet spell).
fire_swarm() uses the spell type of the fired spell and not that of the
swarm spell for calculating the casting level, but IMHO it shouldn't
make a difference anyway.

-- 
Jan
diff -rc orig/crossfire-0.95.5-patch5/include/spellist.h crossfire-0.95.5/include/spellist.h
*** orig/crossfire-0.95.5-patch5/include/spellist.h	Wed Mar 22 08:56:49 2000
--- crossfire-0.95.5/include/spellist.h	Thu Apr 13 03:16:54 2000
***************
*** 209,215 ****
  {"ball lightning",               9,10, 30, 30, 1, 9,  0,  1, 0, 0, 0,
   PATH_ELEC, "ball_lightning",},
  {"meteor swarm",                12,30,  0, 30, 0, 0,  0,  1, 0, 0, 0,
!  PATH_FIRE, "meteor",},
  {"comet",                        8,15,  0, 20, 0, 0,  0,  1, 0, 0, 0,
   PATH_MISSILE, NULL,},							/* 90 */
  {"mystic fist",                  5,10,  0, 15, 0, 0,  1,  1, 0, 0, 0,
--- 209,215 ----
  {"ball lightning",               9,10, 30, 30, 1, 9,  0,  1, 0, 0, 0,
   PATH_ELEC, "ball_lightning",},
  {"meteor swarm",                12,30,  0, 30, 0, 0,  0,  1, 0, 0, 0,
!  PATH_MISSILE, "meteor",},
  {"comet",                        8,15,  0, 20, 0, 0,  0,  1, 0, 0, 0,
   PATH_MISSILE, NULL,},							/* 90 */
  {"mystic fist",                  5,10,  0, 15, 0, 0,  1,  1, 0, 0, 0,
diff -rc orig/crossfire-0.95.5-patch5/include/sproto.h crossfire-0.95.5/include/sproto.h
*** orig/crossfire-0.95.5-patch5/include/sproto.h	Thu Apr 13 03:23:54 2000
--- crossfire-0.95.5/include/sproto.h	Thu Apr 13 03:17:55 2000
***************
*** 563,569 ****
  extern int cast_create_obj ( object *op, object *caster, object *new_op, int dir );
  extern int summon_monster ( object *op, object *caster, int dir, archetype *at, int spellnum );
  extern int fire_bolt ( object *op, object *caster, int dir, int type, int magic );
! extern int fire_arch_from_position ( object *op, object *caster, sint16 x, sint16 y, int dir, archetype *at, int type, int magic );
  extern int fire_arch ( object *op, object *caster, int dir, archetype *at, int type, int magic );
  extern int cast_cone ( object *op, object *caster, int dir, int strength, int spell_type, archetype *spell_arch, int magic );
  extern void move_cone ( object *op );
--- 563,569 ----
  extern int cast_create_obj ( object *op, object *caster, object *new_op, int dir );
  extern int summon_monster ( object *op, object *caster, int dir, archetype *at, int spellnum );
  extern int fire_bolt ( object *op, object *caster, int dir, int type, int magic );
! extern int fire_arch_from_position ( object *op, object *caster, sint16 x, sint16 y, int dir, archetype *at, int type, int magic, int fixed_level );
  extern int fire_arch ( object *op, object *caster, int dir, archetype *at, int type, int magic );
  extern int cast_cone ( object *op, object *caster, int dir, int strength, int spell_type, archetype *spell_arch, int magic );
  extern void move_cone ( object *op );
***************
*** 587,593 ****
  extern int SP_level_strength_adjust ( object *op, object *caster, int spell_type );
  extern int SP_level_spellpoint_cost ( object *op, object *caster, int spell_type );
  extern void move_swarm_spell ( object *op );
! extern void fire_swarm ( object *op, int dir, archetype *swarm_type, int spell_type, int n, int magic );
  extern int look_up_spell_by_name ( object *op, char *spname );
  extern void put_a_monster ( object *op, char *monstername );
  extern void shuffle_attack ( object *op, int change_face );
--- 587,593 ----
  extern int SP_level_strength_adjust ( object *op, object *caster, int spell_type );
  extern int SP_level_spellpoint_cost ( object *op, object *caster, int spell_type );
  extern void move_swarm_spell ( object *op );
! extern void fire_swarm ( object *op, object *caster, int dir, archetype *swarm_type, int spell_type, int n, int magic );
  extern int look_up_spell_by_name ( object *op, char *spname );
  extern void put_a_monster ( object *op, char *monstername );
  extern void shuffle_attack ( object *op, int change_face );
diff -rc orig/crossfire-0.95.5-patch5/server/player.c crossfire-0.95.5/server/player.c
*** orig/crossfire-0.95.5-patch5/server/player.c	Wed Mar 22 08:56:48 2000
--- crossfire-0.95.5/server/player.c	Thu Apr 13 02:54:17 2000
***************
*** 987,993 ****
      * -b.t. 
      */ 
  #ifdef ALLOW_SKILLS 
!   if(op->type==PLAYER&&!QUERY_FLAG(op,FLAG_WIZ)) 
  	if(!check_skill_to_fire(op)) return;
  #endif
  
--- 987,993 ----
      * -b.t. 
      */ 
  #ifdef ALLOW_SKILLS 
!   if(op->type==PLAYER) 
  	if(!check_skill_to_fire(op)) return;
  #endif
  
diff -rc orig/crossfire-0.95.5-patch5/server/spell_util.c crossfire-0.95.5/server/spell_util.c
*** orig/crossfire-0.95.5-patch5/server/spell_util.c	Thu Apr 13 03:23:54 2000
--- crossfire-0.95.5/server/spell_util.c	Thu Apr 13 03:16:35 2000
***************
*** 584,590 ****
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,dir,spellarch[type],SP_METEOR,n,0);
      break;
    }
    case SP_BULLET_SWARM: {
--- 584,590 ----
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,caster,dir,spellarch[type],SP_METEOR,n,0);
      break;
    }
    case SP_BULLET_SWARM: {
***************
*** 592,598 ****
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,dir,spellarch[type],SP_BULLET,n,1);
      break;
    }
    case SP_BULLET_STORM: {
--- 592,598 ----
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,caster,dir,spellarch[type],SP_BULLET,n,1);
      break;
    }
    case SP_BULLET_STORM: {
***************
*** 600,606 ****
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,dir,spellarch[type],SP_LARGE_BULLET,n,1);
      break;
    }
    case SP_CAUSE_MANY: {
--- 600,606 ----
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,caster,dir,spellarch[type],SP_LARGE_BULLET,n,1);
      break;
    }
    case SP_CAUSE_MANY: {
***************
*** 608,614 ****
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,dir,spellarch[type],SP_CAUSE_HEAVY,n,1);
      break;
    }
    case SP_METEOR:
--- 608,614 ----
      n=RANDOM()%3 + RANDOM()%3 + RANDOM()%3 +3 +
        SP_level_strength_adjust(op,caster, type);
      success = 1;
!     fire_swarm(op,caster,dir,spellarch[type],SP_CAUSE_HEAVY,n,1);
      break;
    }
    case SP_METEOR:
***************
*** 983,993 ****
  	int magic)
  {
  	return fire_arch_from_position (op, caster, op->x, op->y, dir, at,
! 	                                type, magic);
  }
  
  int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y,
! 	int dir, archetype *at, int type, int magic)
  {
    object *tmp, *env;
   
--- 983,997 ----
  	int magic)
  {
  	return fire_arch_from_position (op, caster, op->x, op->y, dir, at,
! 	                                type, magic, 0);
  }
  
+ /*
+  * fixed_level: use this level if not zero instead of calculating the
+  * casting level from caster's level and attuned/repelled paths.
+  */
  int fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y,
! 	int dir, archetype *at, int type, int magic, int fixed_level)
  {
    object *tmp, *env;
   
***************
*** 1005,1011 ****
    tmp->x=x, tmp->y=y;
    tmp->direction=dir;
    set_owner(tmp,op);
!   tmp->level = casting_level (op, type);
  #ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */
    if(tmp->attacktype&AT_HOLYWORD||tmp->attacktype&AT_GODPOWER) {
  	      if(!tailor_god_spell(tmp,op)) return 0; 
--- 1009,1015 ----
    tmp->x=x, tmp->y=y;
    tmp->direction=dir;
    set_owner(tmp,op);
!   tmp->level = fixed_level ? fixed_level : casting_level (caster, type);
  #ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */
    if(tmp->attacktype&AT_HOLYWORD||tmp->attacktype&AT_GODPOWER) {
  	      if(!tailor_god_spell(tmp,op)) return 0; 
***************
*** 1056,1062 ****
      success=1;
      tmp=arch_to_object(spell_arch);
      set_owner(tmp,op);
!     tmp->level = casting_level (op, spell_type);
      tmp->x=x,tmp->y=y;
  #ifdef MULTIPLE_GODS /* holy word stuff */                
      if((tmp->attacktype&AT_HOLYWORD)||(tmp->attacktype&AT_GODPOWER)) {
--- 1060,1066 ----
      success=1;
      tmp=arch_to_object(spell_arch);
      set_owner(tmp,op);
!     tmp->level = casting_level (caster, spell_type);
      tmp->x=x,tmp->y=y;
  #ifdef MULTIPLE_GODS /* holy word stuff */                
      if((tmp->attacktype&AT_HOLYWORD)||(tmp->attacktype&AT_GODPOWER)) {
***************
*** 1794,1800 ****
     /*  that's stored in op->stats.sp  by fire_swarm  */
     if ( ! wall (op->map, x, y))
         fire_arch_from_position (owner, op, x, y, op->direction, op->other_arch,
!                                 op->stats.sp, op->magic);
  }
  
  
--- 1798,1804 ----
     /*  that's stored in op->stats.sp  by fire_swarm  */
     if ( ! wall (op->map, x, y))
         fire_arch_from_position (owner, op, x, y, op->direction, op->other_arch,
!                                 op->stats.sp, op->magic, op->level);
  }
  
  
***************
*** 1805,1811 ****
      the parts of the swarm.  
  
    Interface:
!     op:  the caster
      dir: the direction everything will be fired in
      swarm_type:  the archetype that will be fired
      spell_type:  the spell type of the archetype that's fired
--- 1809,1816 ----
      the parts of the swarm.  
  
    Interface:
!     op:  the owner
!     caster: the caster (owner, wand, rod, scroll)
      dir: the direction everything will be fired in
      swarm_type:  the archetype that will be fired
      spell_type:  the spell type of the archetype that's fired
***************
*** 1813,1827 ****
  */
      
  
! void fire_swarm (object *op, int dir, archetype *swarm_type, int spell_type,
! 	int n, int magic)
  {
    object *tmp;
    tmp=arch_to_object(find_archetype("swarm_spell"));
    tmp->x=op->x;
    tmp->y=op->y;	    
    set_owner(tmp,op);       /* needed so that if swarm elements kill, caster gets xp.*/
!   tmp->level=op->level;   /*needed later, to get level dep. right.*/
    tmp->stats.sp=spell_type;  /* needed later, see move_swarm_spell */
    tmp->magic = magic;
    tmp->stats.hp=n;	    /* n in swarm*/
--- 1818,1832 ----
  */
      
  
! void fire_swarm (object *op, object *caster, int dir, archetype *swarm_type,
! 	int spell_type, int n, int magic)
  {
    object *tmp;
    tmp=arch_to_object(find_archetype("swarm_spell"));
    tmp->x=op->x;
    tmp->y=op->y;	    
    set_owner(tmp,op);       /* needed so that if swarm elements kill, caster gets xp.*/
!   tmp->level=casting_level(caster, spell_type);   /*needed later, to get level dep. right.*/
    tmp->stats.sp=spell_type;  /* needed later, see move_swarm_spell */
    tmp->magic = magic;
    tmp->stats.hp=n;	    /* n in swarm*/
***************
*** 2156,2162 ****
        return 0;
  
    /* tailor the effect by priest level and worshipped God */
!    effect->level = casting_level (op, type);
  #ifdef MULTIPLE_GODS
     if(effect->attacktype&AT_HOLYWORD||effect->attacktype&AT_GODPOWER) {
          if(tailor_god_spell(effect,op))
--- 2161,2167 ----
        return 0;
  
    /* tailor the effect by priest level and worshipped God */
!    effect->level = casting_level (caster, type);
  #ifdef MULTIPLE_GODS
     if(effect->attacktype&AT_HOLYWORD||effect->attacktype&AT_GODPOWER) {
          if(tailor_god_spell(effect,op))