#library "NecromancerScripts.acs"
#include "zcommon.acs"
#import "CustomFunctions.acs"
#import "PickupScripts.acs"

Script "Necromancerclass_AmmoPickupSystem" (void)
{  
   int plr = PlayerNumber();

  SetInventory("PickedUp", 0);
 
  int multiplyammo;
  multiplyammo = 1;
  if((GameSkill() == 4) || (GetCVAR("sv_doubleammo") == 1))
  multiplyammo = 2;

  
     switch(ammonumbersave[plr])
  {
  
   case 1: //Clip
   if((CheckInventory("NecroticBullets")) == (GetAmmoCapacity("NecroticBullets")) && (CheckInventory("RifleBullets")) == (GetAmmoCapacity("RifleBullets"))) { terminate; }
	   GiveInventory("NecroticBullets", 10*ammomultiplysave[plr]/ammodividesave[plr]);
	   	   GiveInventory("RifleBullets", 2*ammomultiplysave[plr]/ammodividesave[plr]);
 message[plr] = strparam(s:"Necrotic Bullets +", i:((10*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo), s:" & Rifle Rounds +", i:((2*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 2: //Shell
   if((CheckInventory("Shell")) == (GetAmmoCapacity("Shell")) && (CheckInventory("000Buckshot")) == (GetAmmoCapacity("000Buckshot"))) { terminate; }
   GiveInventory("Shell", 2*ammomultiplysave[plr]/ammodividesave[plr]);
   GiveInventory("000Buckshot", 2*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Shells +", i:((2*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo), s:" & 000 Buckshot +", i:((2*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 3: //Rocket
   if((CheckInventory("RocketAmmo")) == (GetAmmoCapacity("RocketAmmo"))) { terminate; }
	   GiveInventory("RocketAmmo", 2*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Devastator Rockets +", i:((2*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 4: //Cell 
   if((CheckInventory("Darkmana")) == (GetAmmoCapacity("Darkmana"))) { terminate; }
	   GiveInventory("Darkmana", 5*ammomultiplysave[plr]/ammodividesave[plr]);
  message[plr] = strparam(s:"Dark Mana +", i:((5*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   }
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "AMMO", 4);
   ACS_NamedExecuteWithResult("PostLog", 0, 0, 0, 0);
}

Script "NecromancerClass_PistolStart" (void)
{ 
	TakeInventory("NecromancerLeech", 1);
	TakeInventory("NecromancerModel1887", 1);
	TakeInventory("NecromancerCoachgun",1);
	TakeInventory("000Buckshot", 0);
	TakeInventory("NecromancerRifle", 1);
	TakeInventory("RifleBullets",0);
	TakeInventory("NecromancerDevastator", 1);
	TakeInventory("NecromancerNecronomicon", 1);
	TakeInventory("NecromancerVilestaff", 1);
	TakeInventory("Darkmana", 0);
}

Script "NecromancerClass_PickupSystem" (void)
{ 
   
   int plr = PlayerNumber();
   
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "DSWPNUP", 4);
   
     switch(weaponnumbersave[plr])
  {
   case 1: GiveInventory("NecromancerLeech", 1);  print(s:"\cfYou reunited with your leech! Alt-Fire to fire a necrotic projectile at the cost of health!"); ; SetInventory("HasChainsaw", 1); break;
   case 2: GiveInventory("NecromancerModel1887", 1);  print(s:"\cfGot the Model 1887! Use Alt-Fire for a Giga Shotgun Blast!"); SetInventory("HasShotgun", 1); break;
   case 3: GiveInventory("NecromancerCoachgun",1); print(s:"\cfGot the Coachgun! Use Alt-Fire to unleash a powerful blast!");  SetInventory("HasSuperShotgun", 1); break;
   case 4: GiveInventory("NecromancerBoltRifle",1);  print(s:"\cfGot the Bolt Rifle! Use Alt-Fire to fire a denser round!"); SetInventory("HasChaingun", 1); break;
   case 5: GiveInventory("NecromancerDevastator", 1);  print(s:"\cfGot the Devastator Seeker Missile Launcher! Use Alt-Fire to fire a Giga Missile!"); SetInventory("HasRocketLauncher", 1); break;
   case 6: GiveInventory("NecromancerNecronomicon", 1); print(s:"\cfTier 1 Summons acquired! Fire: AutoShotgunner. Alt-Fire: Hellknight. Reload: Mancubus. Zoom: Arachnotron."); SetInventory("HasPlasmaRifle", 1); break;
   case 7: GiveInventory("NecromancerVilestaff", 1); print(s:"\cfT2 Summons acquired! Fire: Minigunner. Alt-Fire: Baron of Hell. Reload: Spider Mastermind. Zoom: Cyberdemon."); SetInventory("HasBFG9000", 1); break;
   }
   
}