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

CF: small patch for skill_util.c




	I discovered that items casting spells dont do so at the level
	of the item! Undercurrent code its 1! I checked this out, and it
	appears that cast_cone, fire_arch, etc reference SK_level(item)
	to determine the item's level. Unfortunately, the "item" object
	passed along is not strictly the item object itself (as I had 
	assumed long ago!). It is a "casting object" built by cast_spell,
	and that object shares attributes of both the item casting the 
	spell *and* the player using it!!. 

	One effect is that when SK_level is called, the code thinks its 
	referencing a *player's* level, which under skills, is the level
	of the experience object being used. Since this object is 
	USE_MAGIC_ITEM, the level is 0 (but SK_level safety flips that to
	"1"). So, no spells cast by items are more powerfull than 1 (usually).

	I prepared a patch to fix this, and its small. However, the ramifications
	are a bit bigger. Under my patch, the item level will be used *if*
	the skill required to use the item is a *miscellaneous* skill. That
	is to say, you cant get exp from using the item. *If* on the other
	hand, you have changed your skill_params file to allow some xp from 
	using devices, then *your* level will be returned by SK_level() and
	effectively the wand/etc will be used at your level, *not* the device
	level.

	This seems a bit of a change from the previous play. How do people 
	feel about this? I can prepare a different (more complex) patch if
	the old playstyle is to be preserved (when you allow devices to give xp).

							-b.t.

*** ../../tarfiles/crossfire-0.92.3/server/skill_util.c	Thu Mar  7 03:38:24 1996
--- ./skill_util.c	Sat Apr 20 02:52:42 1996
***************
*** 1390,1401 ****
  
  int SK_level(object *op) {  
    int level = op->level;
  
  #ifdef ALLOW_SKILLS
!   if(op->chosen_skill && op->type==PLAYER) 
! 	level = op->chosen_skill->level;
  #endif
    if(level<=0) level = 1;	 /* safety */
  
    return level;
  }
--- 1393,1404 ----
  
  int SK_level(object *op) {  
    int level = op->level;
  
  #ifdef ALLOW_SKILLS
!   if(op->chosen_skill && op->chosen_skill->level!=0 && op->type==PLAYER)
! 		level=op->chosen_skill->level;
  #endif
    if(level<=0) level = 1;	 /* safety */
  
    return level;
  }