int d = DEREF_P_CHAR(pc_defender);
static void NpcSpellAttack(P_CHAR pc_attacker, P_CHAR pc_defender, unsigned int currenttime, int los){	if (pc_attacker->spatimer<=currenttime)	{		int d = DEREF_P_CHAR(pc_defender);		int spattacks = numbitsset( pc_attacker->spattack );		if (!pc_defender->dead && chardist(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender))<server_data.attack_distance && spattacks > 0 )		{			if (los)			{																					int spattackbit=rand()%(spattacks) + 1;				switch(whichbit(pc_attacker->spattack, spattackbit))				{				case 1:					if (pc_attacker->mn>=4)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->MagicArrow(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; 				case 2:					if (pc_attacker->mn>=6)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->HarmSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //lb				case 3:					if (pc_attacker->mn>=4)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->ClumsySpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));															}					break; //LB				case 4:					if (pc_attacker->mn>=4)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->FeebleMindSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //LB				case 5:					if (pc_attacker->mn>=4)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->WeakenSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //LB				case 6:					if (pc_attacker->mn>=9)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->FireballSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //LB				case 7:					if (pc_attacker->mn>=11)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->CurseSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //LB				case 8:					if (pc_attacker->mn>=11)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->NPCLightningTarget(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //lb				case 9:					if (pc_attacker->mn>=14)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->ParalyzeSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break; //lb				case 10:					if (pc_attacker->mn>=14)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->MindBlastSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break;				case 11:					if (pc_attacker->mn>=20)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->NPCEBoltTarget(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break;				case 12:					if (pc_attacker->mn>=20)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->ExplosionSpell(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break;				case 13:					if (pc_attacker->mn>=40)					{						npcaction(DEREF_P_CHAR(pc_attacker), 6);						Magic->NPCFlameStrikeTarget(DEREF_P_CHAR(pc_attacker),DEREF_P_CHAR(pc_defender));					}					break;				case 14:					npcaction(DEREF_P_CHAR(pc_attacker), 6);					Magic->PFireballTarget(DEREF_P_CHAR(pc_attacker), DEREF_P_CHAR(pc_defender), 10);					break;				case 15:					npcaction(DEREF_P_CHAR(pc_attacker), 6);					Magic->PFireballTarget(DEREF_P_CHAR(pc_attacker), DEREF_P_CHAR(pc_defender), 20);					break;				case 16:					npcaction(DEREF_P_CHAR(pc_attacker), 6);					Magic->PFireballTarget(DEREF_P_CHAR(pc_attacker), DEREF_P_CHAR(pc_defender), 40);					break;				}			}					}		pc_attacker->spatimer=currenttime+(pc_attacker->spadelay*MY_CLOCKS_PER_SEC); //LB bugkilling	}}				