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

CF: invoke patch




	Hi,

	Well, I think this is one piece (at least) of the magic 
	experience problem. Apparently, for characters invoking
	spells, command_cast_spell() fctn was failing to check 
	check_skill_to_fire() which would set the appropriate 
	skill (either spellcasting or praying).  In some cases,
	it was possible to have used a different skill before 
	invoking.. this would then send experience to the wrong
	experience object (which could be exp:none -- so NO exp
	was gained). 

	The patch to input.c follows this message. I would like 
	to add that I think there may be another problem out in
	the code -- I seem to remember casting spells, gaining 
	no experience, *and* having skill:spellcasting set. Oh
	well, one thing at  a time , eh?

					Caio,

					-b.t.

*** input.c.orig	Sun Apr 21 01:07:38 1996
--- input.c	Wed Jun  5 12:07:17 1996
***************
*** 988,1026 ****
      for(i=0;i<numknown;i++){
  	    if (QUERY_FLAG(op, FLAG_WIZ)) spnum = i;
  	    else spnum = op->contr->known_spells[i];
  
  	    if (!strncmp(params, spells[spnum].name, strlen(params))) {
! 		/* matched the spell name. */
! /*		if (spells[spnum].range != 0) {*/
  		    if (castnow) { 
- 			rangetype tmp_rangetype=op->contr->shoottype;
  			int value;
  
! 			/* Need to switch shoottype to range_magic - otherwise
! 			 * cast_spell doesn't check to see if the character
! 			 * has enough spellpoints.
! 			 */
! 			op->contr->shoottype=range_magic;
! #ifdef ALLOW_SKILLS
!       			if(op->type==PLAYER&&!QUERY_FLAG(op,FLAG_WIZ)) 
!             			 if(!check_skill_to_fire(op)) return 0;
! #endif
  			value = cast_spell(op,op,op->facing,spnum,0,spellNormal,cp);
! 			op->contr->shoottype=tmp_rangetype;
  
  			if(spells[spnum].cleric) 
  				op->stats.grace -= value;
  			else 
  				op->stats.sp -= value;
!               	    } else {
!                         op->contr->shoottype=range_magic;
                          op->contr->chosen_spell=spnum;
! 		    }
  		    draw_stats(op);
  		    return 1;
- /*	    	}*/
  /*
  		op->stats.sp -= invoke_spell(op, op->facing, spnum, 0, spellNormal, cp);
  		draw_stats(op);
  		return 1;
  */
--- 990,1030 ----
      for(i=0;i<numknown;i++){
  	    if (QUERY_FLAG(op, FLAG_WIZ)) spnum = i;
  	    else spnum = op->contr->known_spells[i];
  
  	    if (!strncmp(params, spells[spnum].name, strlen(params))) {
! 		    rangetype orig_rangetype=op->contr->shoottype;
! 		    op->contr->shoottype=range_magic;
! #ifdef ALLOW_SKILLS 
!                     if(op->type==PLAYER&&!QUERY_FLAG(op,FLAG_WIZ)) { 
!                                  if(!check_skill_to_fire(op)) {  
!                                  	op->contr->shoottype=orig_rangetype;
! 					return 0; 
! 				 }
!                     } 
! #endif
  		    if (castnow) { 
  			int value;
  
!                         /* Need to switch shoottype to range_magic - otherwise 
!                          * cast_spell doesn't check to see if the character 
!                          * has enough spellpoints. 
! 			 * Note: now done above this -b.t. */
! 			/* op->contr->shoottype=range_magic; */ 
! 
  			value = cast_spell(op,op,op->facing,spnum,0,spellNormal,cp);
! 			op->contr->shoottype=orig_rangetype;
  
  			if(spells[spnum].cleric) 
  				op->stats.grace -= value;
  			else 
  				op->stats.sp -= value;
!               	    } else 
                          op->contr->chosen_spell=spnum;
! 
  		    draw_stats(op);
  		    return 1;
  /*
  		op->stats.sp -= invoke_spell(op, op->facing, spnum, 0, spellNormal, cp);
  		draw_stats(op);
  		return 1;
  */