magic_user spec_proc

From: Graham Gilmore (gilmore@gmgate.vircom.com)
Date: 04/15/96


	Hmm I was just looking at this... correct me if I'm wrong, but if 
a mob of level LESS than 4 has this spec_proc, and does a combat spell 
(ie if (!number(0,4)) after the blindness/sleep/drain stuff), then it 
will be SPELL_FIREBALL by default.  Shouldn't the case start at level 1 
rather than 4...?  Even if it's just to break, and cast no spell, for levels 
less than 4.
	For levels 4-17, I don't see why it wouldn't cast the correct 
spell... though I haven't verified in the game, myself, to see if it 
does.

	Graham Gilmore


** Warning ** 
Basic coding concept explanation following
** Warning **

(btw for whoever asked, the switch drops through the cases until it hits 
a break; so if it says:
	case 4:
	case 5: cast magic missile
		break;
	case 6:
	...

	then for 4 and 5, it will cast magic missile, case 6 will drop 
down to the next one, etc...  You could even have the following scenario:
	case 6: cast magic missile;
	case 5: 
	case 4: cast magic missile;
		break;
	...

	If the switch argument was 4 or 5, it would cast magic missile.  
If it was 6, it would execute the first casting, and then continue on 
(not encountering any break statement) and execute the second casting.  
Also notice that the order of the cases does not necessarily have any 
relation with the values of the switch argument itself; they are ordered 
according to how you want control to flow, and also for clarity's sake 
(ie :   case 4:			instead of 	case 6:
	case 5:					case 4:
	case 6:					case 7:
	case 7: foo(bar);			case 5: foo(bar);
		break;					break; )

Any C book describing switch statements would tell you this info, 
you should invest in one if you haven't.. and if you have, use it.  
:)

	



This archive was generated by hypermail 2b30 : 12/18/00 PST