ACTOR GhostFist : SFortFist
{
  Inventory.RestrictedTo "GhostPlayer"
  Weapon.AmmoType2 "Cell"
  Weapon.AmmoUse2 0
  Weapon.AmmoGive2 0
  +WEAPON.ALT_AMMO_OPTIONAL
  States
  {
  Select:
    TNT1 A 0 A_Raise
    PUNG A 1 A_Raise
    Loop
  Fire:
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth8",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth7",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth6",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth5",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth4",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth3",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth2",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth1",1,"CheckInvis")
  DelInvis:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
    Goto FireNormal
  CheckInvis:
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_5)
	Goto DelInvis
  AltFire:
	TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
    // Flag check
/*	TNT1 A 0 A_JumpIfInventory("BlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldFlag",1,"AltDenied")*/
	// OdaFlag check
	TNT1 A 0 A_JumpIfInventory("OdaBlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaRedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGoldFlag",1,"AltDenied")
	// Skull check
	TNT1 A 0 A_JumpIfInventory("BlueSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"AltFireOn")
	//PUNG A 20 A_PlaySound("misc/ghostactivate",CHAN_AUTO)
	TNT1 A 0 A_GiveInventory("GhostStealthItem",1)
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_WEAPON)
  Stealth1:
	PUNG A 5 A_GiveInventory("PowerGhostStealth1",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth2")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	Goto Ready
  Stealth2:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth3")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	Goto Ready
  Stealth3:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth4")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	Goto Ready
  Stealth4:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth5")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	Goto Ready
  Stealth5:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth6")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	Goto Ready
  Stealth6:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth7")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	Goto Ready
  Stealth7:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth8")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	Goto Ready
  Stealth8:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth9")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	Goto Ready
  Stealth9:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	PUNG A 5 A_GiveInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("GhostStealthItem",1)
	Goto Ready
  AltFireOn:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisInfo")
	Goto Ready
  AltDenied:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisTeamItem")
	PUNG A 7 A_WeaponReady(WRF_NOSECONDARY|WRF_NOSWITCH)
	Goto Ready
  Reload:
	TNT1 A 0 A_Print("$INFO_GHOST",0.0625)
    Goto Ready
  }
}

ACTOR GhostPistol : SFortPistol
{
  Tag "Silenced Pistol"
  Obituary "%o was assassinated by %k's silenced pistol."
  AttackSound "weapons/spistol"
  Inventory.RestrictedTo "GhostPlayer"
  Weapon.AmmoType2 "Cell"
  Weapon.AmmoUse2 0
  Weapon.AmmoGive2 0
  +WEAPON.ALT_AMMO_OPTIONAL
  States
  {
  Ready:
    SPIL A 1 A_WeaponReady(WRF_ALLOWRELOAD)
	Loop
  Deselect:
    SPIL A 0 A_Lower
    Loop
  Select:
    TNT1 A 0 A_Raise
    SPIL A 1 A_Raise
    Loop
  Fire:
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth8",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth7",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth6",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth5",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth4",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth3",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth2",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth1",1,"CheckInvis")
  DelInvis:
	//TNT1 A 0 A_TakeInventory("GhostStealthSlower",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
  FireNormal:
	TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
	TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Quad")
    SPIL B 1 A_FireBullets(2.1,1.75,-1,15,"SFortBulletPuff",FBF_NOFLASH|FBF_NORANDOM|FBF_USEAMMO)
    SPIL C 1
    SPIL D 1
    SPIL B 1 A_FireBullets(2.1,1.75,-1,15,"SFortBulletPuff",FBF_NOFLASH|FBF_NORANDOM|FBF_USEAMMO)
    SPIL C 1
    SPIL D 1
    SPIL B 1 A_FireBullets(2.1,1.75,-1,15,"SFortBulletPuff",FBF_NOFLASH|FBF_NORANDOM|FBF_USEAMMO)
    SPIL C 3
    SPIL D 3
	SPIL A 5
    SPIL A 3 A_ReFire
    Goto Ready
  Quad:
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
    SPIL B 1 A_FireBullets(2.1,1.75,-1,15,"SFortBulletPuff",FBF_NOFLASH|FBF_NORANDOM|FBF_USEAMMO)
    SPIL C 1
    SPIL D 1
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
    SPIL B 1 A_FireBullets(2.1,1.75,-1,15,"SFortBulletPuff",FBF_NOFLASH|FBF_NORANDOM|FBF_USEAMMO)
    SPIL C 1
    SPIL D 1
    TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_7)
    SPIL B 1 A_FireBullets(2.1,1.75,-1,15,"SFortBulletPuff",FBF_NOFLASH|FBF_NORANDOM|FBF_USEAMMO)
	Goto FireNormal+9
  CheckInvis:
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_5)
	Goto DelInvis
  AltFire:
	TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
    // Flag check
/*	TNT1 A 0 A_JumpIfInventory("BlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldFlag",1,"AltDenied")*/
	// OdaFlag check
	TNT1 A 0 A_JumpIfInventory("OdaBlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaRedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGoldFlag",1,"AltDenied")
	// Skull check
	TNT1 A 0 A_JumpIfInventory("BlueSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"AltFireOn")
	//SPIL A 20 A_PlaySound("misc/ghostactivate",CHAN_AUTO)
	TNT1 A 0 A_GiveInventory("GhostStealthItem",1)
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_WEAPON)
  Stealth1:
	SPIL A 5 A_GiveInventory("PowerGhostStealth1",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth2")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	Goto Ready
  Stealth2:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth3")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	Goto Ready
  Stealth3:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth4")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	Goto Ready
  Stealth4:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth5")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	Goto Ready
  Stealth5:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth6")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	Goto Ready
  Stealth6:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth7")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	Goto Ready
  Stealth7:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth8")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	Goto Ready
  Stealth8:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth9")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	Goto Ready
  Stealth9:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	SPIL A 5 A_GiveInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("GhostStealthItem",1)
	Goto Ready
  AltFireOn:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisInfo")
	Goto Ready
  AltDenied:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisTeamItem")
	SPIL A 7 A_WeaponReady(WRF_NOSECONDARY|WRF_NOSWITCH)
	Goto Ready
  Reload:
	TNT1 A 0 A_Print("$INFO_GHOST",0.0625)
    Goto Ready
  }
}

ACTOR GhostScatterPistol : SFortScatterPistol
{
  Inventory.RestrictedTo "GhostPlayer"
  Weapon.AmmoType2 "Cell"
  Weapon.AmmoUse2 0
  Weapon.AmmoGive2 0
  +WEAPON.ALT_AMMO_OPTIONAL
  States
  {
  Fire:
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth8",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth7",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth6",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth5",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth4",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth3",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth2",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth1",1,"CheckInvis")
  DelInvis:
	//TNT1 A 0 A_TakeInventory("GhostStealthSlower",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
    Goto FireNormal
  CheckInvis:
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_5)
	Goto DelInvis
  AltFire:
	TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
    // Flag check
/*	TNT1 A 0 A_JumpIfInventory("BlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldFlag",1,"AltDenied")*/
	// OdaFlag check
	TNT1 A 0 A_JumpIfInventory("OdaBlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaRedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGoldFlag",1,"AltDenied")
	// Skull check
	TNT1 A 0 A_JumpIfInventory("BlueSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"AltFireOn")
	//SPRP A 20 A_PlaySound("misc/ghostactivate",CHAN_AUTO)
	TNT1 A 0 A_GiveInventory("GhostStealthItem",1)
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_WEAPON)
  Stealth1:
	SPRP A 5 A_GiveInventory("PowerGhostStealth1",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth2")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	Goto Ready
  Stealth2:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth3")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	Goto Ready
  Stealth3:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth4")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	Goto Ready
  Stealth4:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth5")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	Goto Ready
  Stealth5:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth6")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	Goto Ready
  Stealth6:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth7")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	Goto Ready
  Stealth7:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth8")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	Goto Ready
  Stealth8:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth9")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	Goto Ready
  Stealth9:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	SPRP A 5 A_GiveInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("GhostStealthItem",1)
	Goto Ready
  AltFireOn:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisInfo")
	Goto Ready
  AltDenied:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisTeamItem")
	SPRP A 7 A_WeaponReady(WRF_NOSECONDARY|WRF_NOSWITCH)
	Goto Ready
  Reload:
	TNT1 A 0 A_Print("$INFO_GHOST",0.0625)
    Goto Ready
  }
}

ACTOR GhostNailPistol : SFortNailPistol
{
  Inventory.RestrictedTo "GhostPlayer"
  Weapon.AmmoType2 "Cell"
  Weapon.AmmoUse2 0
  Weapon.AmmoGive2 0
  +WEAPON.ALT_AMMO_OPTIONAL
  States
  {
  Fire:
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth8",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth7",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth6",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth5",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth4",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth3",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth2",1,"CheckInvis")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth1",1,"CheckInvis")
  DelInvis:
	//TNT1 A 0 A_TakeInventory("GhostStealthSlower",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
    Goto FireNormal
  CheckInvis:
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_5)
	Goto DelInvis
  AltFire:
	TNT1 A 0 A_TakeInventory("PowerInvulnerable",1)
    // Flag check
/*	TNT1 A 0 A_JumpIfInventory("BlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldFlag",1,"AltDenied")*/
	// OdaFlag check
	TNT1 A 0 A_JumpIfInventory("OdaBlueFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaRedFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGreenFlag",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("OdaGoldFlag",1,"AltDenied")
	// Skull check
	TNT1 A 0 A_JumpIfInventory("BlueSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("RedSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GreenSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("GoldSkullST",1,"AltDenied")
	TNT1 A 0 A_JumpIfInventory("PowerGhostStealth9",1,"AltFireOn")
	//NPIS A 20 A_PlaySound("misc/ghostactivate",CHAN_AUTO)
	TNT1 A 0 A_GiveInventory("GhostStealthItem",1)
	TNT1 A 0 A_PlaySound("misc/ghoststealth",CHAN_WEAPON)
  Stealth1:
	NPIS A 5 A_GiveInventory("PowerGhostStealth1",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth2")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	Goto Ready
  Stealth2:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth1",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth2",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth3")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	Goto Ready
  Stealth3:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth2",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth3",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth4")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	Goto Ready
  Stealth4:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth3",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth4",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth5")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	Goto Ready
  Stealth5:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth4",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth5",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth6")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	Goto Ready
  Stealth6:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth5",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth6",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth7")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	Goto Ready
  Stealth7:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth6",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth7",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth8")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	Goto Ready
  Stealth8:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth7",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth8",1)
	TNT1 A 0 A_JumpIfInventory("GhostStealthItem",1,"Stealth9")
	TNT1 A 0 A_StopSound(CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	Goto Ready
  Stealth9:
	TNT1 A 0 A_TakeInventory("PowerGhostStealth8",1)
	NPIS A 5 A_GiveInventory("PowerGhostStealth9",1)
	TNT1 A 0 A_TakeInventory("GhostStealthItem",1)
	Goto Ready
  AltFireOn:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisInfo")
	Goto Ready
  AltDenied:
    TNT1 A 0 ACS_NamedExecuteAlways("GhostInvisTeamItem")
	NPIS A 7 A_WeaponReady(WRF_NOSECONDARY|WRF_NOSWITCH)
	Goto Ready
  Reload:
	TNT1 A 0 A_Print("$INFO_GHOST",0.0625)
    Goto Ready
  }
}

ACTOR GhostStealthItem : Inventory
{
	Inventory.MaxAmount 1
}

ACTOR PowerGhostStealth1 : PowerInvisibility
{
	Powerup.Duration 0x7FFFFFFF
	Powerup.Mode "Translucent"
	Powerup.Strength 20
	Powerup.Color "White", 0.02
}

ACTOR PowerGhostStealth2 : PowerGhostStealth1
{
	Powerup.Strength 30
	Powerup.Color "White", 0.03
}

ACTOR PowerGhostStealth3 : PowerGhostStealth1
{
	Powerup.Strength 40
	Powerup.Color "White", 0.04
}

ACTOR PowerGhostStealth4 : PowerGhostStealth1
{
	Powerup.Strength 50
	Powerup.Color "White", 0.05
}

ACTOR PowerGhostStealth5 : PowerGhostStealth1
{
	Powerup.Strength 60
	Powerup.Color "White", 0.06
}

ACTOR PowerGhostStealth6 : PowerGhostStealth1
{
	Powerup.Strength 70
	Powerup.Color "White", 0.07
}

ACTOR PowerGhostStealth7 : PowerGhostStealth1
{
	Powerup.Strength 80
	Powerup.Color "White", 0.08
}

ACTOR PowerGhostStealth8 : PowerGhostStealth1
{
	Powerup.Strength 90
	Powerup.Color "White", 0.09
}

ACTOR PowerGhostStealth9 : PowerGhostStealth1
{
	Powerup.Strength 100
	Powerup.Color "White", 0.1
}