Actor NecromancerNecronomicon : Weapon
{
  Inventory.PickupSound "misc/w_pkup"
  Weapon.AmmoGive 10
  Weapon.AmmoType "Darkmana"
  Inventory.PickupMessage "You got the Necronomicon!"
  Inventory.RestrictedTo "NecromancerClass"
  Tag "Necronomicon"
  +FloatBob
  States
  {
  Spawn:
    NCRO A -1
    Loop

  Ready:
    NECR A 1 A_WeaponReady(Wrf_AllowReload|Wrf_AllowZoom)
    Loop

  Deselect:
    NECR A 1 A_Lower
    TNT1 A 0 A_Lower
    TNT1 A 0 A_Lower
    Loop

  Select:
    NECR A 1 A_Raise
    TNT1 A 0 A_Raise
    TNT1 A 0 A_Raise
    Loop

  // ===== Primary Fire =====
  Fire:
    TNT1 A 0 A_JumpIfInventory("Darkmana", 5, "FireDo")
    Goto Ready

  FireDo:
    NECR A 30 A_PlaySound("Weapons/Incant")
    NECR B 10
    NECR C 8
    NECR D 2
    NECR E 16 A_FireCustomMissile("NecronomiconGhostEgg_Shotgunner", 0, 1, 0, 0)
    TNT1 A 0 A_TakeInventory("Darkmana", 5)
    NECR D 4
    NECR C 4
    NECR B 4
    NECR A 4
    Goto Ready

  // ===== Alt Fire =====
  AltFire:
    TNT1 A 0 A_JumpIfInventory("Darkmana", 10, "AltFireDo")
    Goto Ready

  AltFireDo:
    NECR A 30 A_PlaySound("Weapons/Incant")
    NECR B 10
    NECR C 8
    NECR D 2
    NECR E 16 A_FireCustomMissile("NecronomiconGhostEgg_HellKnight", 0, 1, 0, 0)
    TNT1 A 0 A_TakeInventory("Darkmana", 10)
    NECR D 4
    NECR C 4
    NECR B 4
    NECR A 4
    Goto Ready
	
  // ===== Reload (Mancubus Summon) =====
  Reload:
    TNT1 A 0 A_JumpIfInventory("Darkmana", 15, "ReloadDo")
    Goto Ready

  ReloadDo:
    TNT1 A 0 A_TakeInventory("Darkmana", 15)
    NECR A 30 A_PlaySound("Weapons/Incant")
    NECR B 10
    NECR C 8
    NECR D 2
    NECR E 16 A_FireCustomMissile("NecronomiconGhostEgg_Mancubs", 0, 1, 0, 0)
    NECR D 4
    NECR C 4
    NECR B 4
    NECR A 4
    Goto Ready

  // ===== Zoom (Arachnotron Summon) =====
  Zoom:
    TNT1 A 0 A_JumpIfInventory("Darkmana", 20, "ZoomDo")

    Goto Ready

  ZoomDo:
    TNT1 A 0 A_TakeInventory("Darkmana", 20)
    NECR A 30 A_PlaySound("Weapons/Incant")
    NECR B 10
    NECR C 8
    NECR D 2
    NECR E 16 A_FireCustomMissile("NecronomiconGhostEgg_Arachnotron", 0, 1, 0, 0)
    NECR D 4
    NECR C 4
    NECR B 4
    NECR A 4
    Goto Ready
  }
}


// ===== Summon Projectiles =====
Actor NecronomiconGhostEgg_Shotgunner
{
  Radius 13
  Height 8
  Speed 25
  Damage 0
  SeeSound "Weapons/Spirit1"
  Projectile
  States
  {
  Spawn:
    TNT1 A 5
    Goto Death
  Death:
    TNT1 A 0 A_SpawnItem("FriendlyShotgunGuy", 32, 0, 0)
    Stop
  }
}

Actor NecronomiconGhostEgg_HellKnight : NecronomiconGhostEgg_Shotgunner
{
  States
  {
  Spawn:
    TNT1 A 7
    Goto Death
  Death:
    TNT1 A 0 A_SpawnItem("FriendlyHellKnight", 32, 0, 0)
    Stop
  }
}

Actor NecronomiconGhostEgg_Mancubs : NecronomiconGhostEgg_Shotgunner
{
  States
  {
  Spawn:
    TNT1 A 7
    Goto Death
  Death:
    TNT1 A 0 A_SpawnItem("FriendlyMancubus", 32, 0, 0)
    Stop
  }
}

Actor NecronomiconGhostEgg_Arachnotron : NecronomiconGhostEgg_Shotgunner
{
  States
  {
  Spawn:
    TNT1 A 7
    Goto Death
  Death:
    TNT1 A 0 A_SpawnItem("FriendlyArachnotron", 32, 0, 0)
    Stop
  }
}


// ===== Allied Monsters =====
Actor FriendlyShotgunGuy : ShotgunGuy
{
  Health 500
  Speed 20
  TAG "Allied Shotgunner"
  MaxStepHeight 9999
  +MissileEvenMore
  +MissileMore
  +FRIENDLY
  +THRUSPECIES
  +FloorClip
  -COUNTKILL
  -SOLID
  +DROPOFF
  AttackSound "shotguy/attack"
  Species "Player"
    States
  {
	Spawn:
		SPOS AB 10 A_Look
		Goto See
	See:
		SPOS AABBCCDD 3 A_Chase
		Loop
  Missile:
		SPOS E 5 A_FaceTarget
		SPOS F 5 Bright A_CustomBulletAttack (5, 4, 12, 8, "FriendlyZombiePuff", 0)
		SPOS E 5
		Goto See
  }
}

// ----- Projectiles -----
actor FriendlyBaronBall : BaronBall
{
	+MTHRUSPECIES
    +THRUSPECIES
	Damage 75
    Species "Player"
}

actor FriendlyFatShot : FatShot
{
	+MTHRUSPECIES
    +THRUSPECIES
	Damage 50
    Species "Player"
}

actor FriendlyPlasmaBall : ArachnotronPlasma
{
	+MTHRUSPECIES
    +THRUSPECIES
	Damage 25
    Species "Player"
}

Actor FriendlyZombiePuff : BulletPuff
{
	+MTHRUSPECIES
	+ThruSpecies
	Species "Player"
}

// ----- Friendly HellKnight -----
actor FriendlyHellKnight : HellKnight
{
    Health 1000
    Speed 14 // original 10
    Tag "Allied HellKnight"
	MaxStepHeight 9999
    +MISSILEMORE
    +MISSILEEVENMORE
    +FRIENDLY
    +THRUSPECIES
    +FLOORCLIP
    -COUNTKILL
    -SOLID
	+DROPOFF
    Species "Player"
    ReactionTime 0
    States
    {
	 Spawn:
		BOS2 AB 10 A_Look
		Goto See
	Missile:
        BOS2 E 4 A_FaceTarget
        BOS2 F 4 A_FaceTarget
        BOS2 G 4 Bright A_CustomMissile("FriendlyBaronBall", 32, 0)
        Goto See
	 Death:
		BOS2 I 8
		BOS2 J 8 A_Scream
		BOS2 K 8
		BOS2 L 8 A_NoBlocking
		BOS2 MN 8
		BOS2 O -1
    Stop
    }
}

// ----- Friendly Mancubus -----
actor FriendlyMancubus : Fatso
{
    Health 1200
    Speed 10 // original 8
    Tag "Allied Mancubus"
	MaxStepHeight 9999
    +MISSILEMORE
    +MISSILEEVENMORE
    +FRIENDLY
    +THRUSPECIES
    +FLOORCLIP
    -COUNTKILL
    -SOLID
	+DROPOFF
    Species "Player"
	States
    {
		Spawn:
			FATT AB 15 A_Look
			Goto See
		Missile:
			FATT G 4 A_FaceTarget // faster raise
			FATT H 4 Bright A_CustomMissile("FriendlyFatShot", 32, 0)
			FATT I 2 A_FaceTarget
			FATT G 2
			FATT H 4 Bright A_CustomMissile("FriendlyFatShot", 32, 0, 0, 16)
			FATT I 2 A_FaceTarget
			FATT G 2
			FATT H 4 Bright A_CustomMissile("FriendlyFatShot", 32, 0, 0, -16)
			FATT I 4 A_FaceTarget
			Goto See
		Death:
			FATT K 6
			FATT L 6 A_Scream
			FATT M 6 A_NoBlocking
			FATT NOPQRS 6
			FATT T -1
			Stop
    }
}

// ----- Friendly Arachnotron -----
actor FriendlyArachnotron : Arachnotron
{
    Health 1000
    Speed 14 // original 10
    Tag "Allied Arachnotron"
	MaxStepHeight 9999
    +MISSILEMORE
    +MISSILEEVENMORE
    +FRIENDLY
    +THRUSPECIES
    +FLOORCLIP
    -COUNTKILL
    -SOLID
	+DROPOFF
    Species "Player"

        States
    {
	Spawn:
    BSPI AB 10 A_Look
    Goto See
	Missile:
        BSPI A 7 Bright A_FaceTarget // shortened from 20
        BSPI G 2 Bright A_CustomMissile("FriendlyPlasmaBall", 32, 0)
        BSPI H 2 Bright
        BSPI H 1 Bright A_SpidRefire
        Goto Missile+1
	Death:
		BSPI J 20 A_Scream
		BSPI K 7 A_NoBlocking
		BSPI LMNO 7
		BSPI P -1
    Stop
    }
}