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

Script "Cyborgclass_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("CyborgCells")) == (GetAmmoCapacity("CyborgCells"))) { terminate; }
	   GiveInventory("CyborgCells", 1*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Battery Charge +", i:((1*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 2: //Shell
   if((CheckInventory("CyborgCells")) == (GetAmmoCapacity("CyborgCells"))) { terminate; }
	   GiveInventory("CyborgCells", 2*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Battery Charge +", i:((2*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 3: //Rocket
   if((CheckInventory("CyborgCells")) == (GetAmmoCapacity("CyborgCells"))) { terminate; }
	   GiveInventory("CyborgCells", 5*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Battery Charge +", i:((5*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 4: //Cell 
   if((CheckInventory("CyborgCells")) == (GetAmmoCapacity("CyborgCells"))) { terminate; }
	   GiveInventory("CyborgCells", 10*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Battery Charge +", i:((10*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   }
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "AMMO", 4);
   ACS_NamedExecuteWithResult("PostLog", 0, 0, 0, 0);
}

Script "CyborgClass_PistolStart" (void)
{ 
	TakeInventory("CyborgCyberNanoedge", 1);
	TakeInventory("CyborgCyberShotGun", 1);
	TakeInventory("CyborgCyberScatterGun",1);
	SetInventory("CyborgCells", 150);
	SetInventory("HealingToken", 10);
	TakeInventory("CyborgCyberSprayer", 1);
	TakeInventory("CyborgCyberPlasmaCannon", 1);
	TakeInventory("CyborgCyberRailRifle", 1);
	TakeInventory("CyborgCyberPCD999", 1);
}

Script "CyborgClass_PickupSystem" (void)
{ 
   
   int plr = PlayerNumber();
   
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "DSWPNUP", 4);
   
     switch(weaponnumbersave[plr])
  {
   case 1: GiveInventory("CyborgCyberNanoedge", 1);  print(s:"\cfNanoedge Chainsaw Acquired: Combat Initiated!"); ; SetInventory("HasChainsaw", 1); break;
   case 2: GiveInventory("CyborgCyberShotGun", 1);  print(s:"\cfEnergy Distribution Channeler Acquired: Close Range Protocol engaged!"); SetInventory("HasShotgun", 1); break;
   case 3: GiveInventory("CyborgCyberScatterGun",1); print(s:"\cfEnergy Distribution Channeler Prototype Acquired: Hit and Run Protocol Initiated!");  SetInventory("HasSuperShotgun", 1); break;
   case 4: GiveInventory("CyborgCyberSprayer",1);  print(s:"\cfPlasmatic Ionized Gas Sprayer Acquired: Enemy Suppression Protocol engaged!"); SetInventory("HasChaingun", 1); break;
   case 5: GiveInventory("CyborgCyberPlasmaCannon", 1);  print(s:"\cfPlasmatic High Yield Fire Cannon Acquired: Long Range Bombardment Protocol engaged!"); SetInventory("HasRocketLauncher", 1); break;
   case 6: GiveInventory("CyborgCyberRailRifle", 1); print(s:"\cfIonized Lazer Rifle Module Acquired: Sniper Protocol initiated!"); SetInventory("HasPlasmaRifle", 1); break;
   case 7: GiveInventory("CyborgCyberPCD999", 1); print(s:"\cfPlasmatic Channeling Disruptor 999 Acquired: Large Scale Enemy Deletion Protocol engaged!"); SetInventory("HasBFG9000", 1); break;
   }
   
}

Script "CyborgClass_MiscPickupSystem" (void)
{  
  int plr = PlayerNumber();
  SetInventory("PickedUp", 0);
  switch(miscnumbersave[plr])
  {
  case 1: 
  if(GetActorProperty(0, APROP_HEALTH) >= (GetActorProperty(0, APROP_SpawnHealth)+100)) { terminate; }
  HealThing(1, GetActorProperty(0, APROP_SpawnHealth)+100); PlaySound(0, "HELTH1", 4);
  message[plr] = strparam(s:"Health +1");
  break;
  case 2: 
  if(GetActorProperty(0, APROP_HEALTH) >= GetActorProperty(0, APROP_SpawnHealth)) { terminate; }
  HealThing(3, GetActorProperty(0, APROP_SpawnHealth)); PlaySound(0, "HELTH2", 4);
  message[plr] = strparam(s:"Health +3");
  break;
  case 3: 
  if(GetActorProperty(0, APROP_HEALTH) >= GetActorProperty(0, APROP_SpawnHealth)) { terminate; }
  HealThing(5, GetActorProperty(0, APROP_SpawnHealth)); PlaySound(0, "HELTH3", 4);
  message[plr] = strparam(s:"Health +5");
  break;
  case 4: 
  if(GetActorProperty(0, APROP_HEALTH) >= (GetActorProperty(0, APROP_SpawnHealth)+100)) { terminate; }
  HealThing(20, GetActorProperty(0, APROP_SpawnHealth)+100); 
//   PlaySound(0, "SPHERE", 4);
  PlaySound(0, "misc/gwonamsphere/squadala", 4);
  message[plr] = strparam(s:"Health +20");
  break;
  case 5: 
  if(CheckInventory("BasicArmor") >= 200) { terminate; }
  GiveInventory("ArmorBonus", 1); PlaySound(0, "ARMR1", 4);
  message[plr] = strparam(s:"Standard Hull +1 (33% damage reduction)");
  break;
  case 6: 
  if(CheckInventory("BasicArmor") >= 100) { terminate; }
  GiveInventory("GreenArmor", 1); PlaySound(0, "ARMR2", 4);
  message[plr] = strparam(s:"Standard Hull +100 (33% damage reduction)");
  break;
  case 7: 
  if(CheckInventory("BasicArmor") >= 200) { terminate; }
  GiveInventory("BlueArmor", 1); PlaySound(0, "ARMR2", 4);
  message[plr] = strparam(s:"Reinforced Hull +200 (50% damage reduction)");
  break;
  case 8: 
  GiveInventory("HealINGToken", 60);;
  GiveInventory("CyborgSupremeHullArmor", 1); 
  PlaySound(0, "misc/harksphere/dinnerHD", 4);
//   PlaySound(0, "SPHERE", 4);
  message[plr] = strparam(s:"Max Stim Charges & Supreme Hull +250 (90% Damage reduction)");
  break;
  case 9: 
  GiveInventory("Allmap", 1); PlaySound(0, "POWERUP", 4);
  message[plr] = strparam(s:"The Entire Map!");
  break;
  case 10: 
  GiveInventory("HealINGToken", 5); PlaySound(0, "QUADDAMG", 4);
  message[plr] = strparam(s:"Stim Charges + 5");
  break;
  case 11: 
  GiveInventory("BlurSphere", 1); PlaySound(0, "POWERUP", 4);
  message[plr] = strparam(s:"Partial Invisibility!");
  break;
  case 12: 
  GiveInventory("Infrared", 1); PlaySound(0, "POWERUP", 4);
  message[plr] = strparam(s:"Light Amplification Visor!");
  break;
  case 13: 
  GiveInventory("NewInvulnerabilitySphere", 1); 
  PlaySound(0, "POWERUP", 4);
  message[plr] = strparam(s:"INVULNERABILITY!");
  break;
  case 14: 
  GiveInventory("RadSuit", 1); PlaySound(0, "POWERUP", 4);
  message[plr] = strparam(s:"Radiation Shielding Suit!");
  break;
  }
  GiveInventory("PickupBlend", 1);
  ACS_NamedExecuteWithResult("PostLog", 0, 0, 0, 0);
}