ACTOR ArachnoShredderMorpher : PowerupGiver 
{
Scale 2
radius 48
height 128
powerup.type ArachnoShredder
inventory.pickupmessage ""
powerup.duration 99999999999999
states
{
Spawn:
TNT1 A 6
loop
 }
 }


actor PowerArachnoShredder : PowerMorph
{
powerup.duration 99999999999999
PowerMorph.PlayerClass "ArachnoShredderPlayer"
}

ACTOR ArachnoShredderPlayer : PlayerPawn
{
  Health 1000
  Radius 64
  Height 64
  Speed 1.0
  mass 2000
  Player.ColorRange 0, 0
  Player.JumpZ 6
  Player.MaxHealth 16000
  Player.DisplayName "Arachno Shredder"
  Player.SoundClass "ArachnoShredder"
  Player.MorphWeapon "ArachnoShredderWeapon0"
  Player.StartItem "Mana", 100
  Painchance 64
  limitedtoteam 1
  damagefactor "boss", 0
  SeeSound "baby/sight"
  PainSound "baby/pain"
  DeathSound "baby/death"
  ActiveSound "baby/active"
	bloodcolor Red
	+NOSKIN
	-PICKUP
  states
{
	Spawn:
		ARSH AB 10 SetPlayerProperty(0, 1, 1)
        Loop
	See:
	    ARSH A 0 SetPlayerProperty(0, 1, 1)
		ARSH A 3 A_Playsound ("baby/walk")
    	ARSH ABBCC 3  
    	ARSH D 3 A_Playsound ("baby/walk")
    	ARSH DEEFF 3
    	Loop
	Melee:
	Missile:
	    ARSH G 0 A_JumpIfInventory("UsingRockets", 1, "Rocket")
		ARSH G 3 Bright 
		ARSH H 3 Bright
		Goto Spawn
	Rocket:
        ARSH K 12 Bright
		Goto Spawn
	Pain:
	    ARSH B 1
        ARSH B 1 A_Pain
        Goto See+1
	Death:
		TNT1 A 0 a_givetotarget("BOSSKILLEDSTAT", 1)
		TNT1 A 0 a_givetotarget("reward", 1)
		ARSH M 20 A_Scream
    	ARSH N 7 A_NoBlocking
    	ARSH OPQ 7
		ARSH R 7
    	ARSH S -1 
    	Stop
}
}

ACTOR ArachnoShredderWeapon0 : Weapon 
{
 Weapon.SelectionOrder 800
 Obituary "%o was engulfed in Plasmas by %k"
 Inventory.PickupMessage ""
 Inventory.PickupSound "misc/pk_up"
 Weapon.AmmoUse 5
 Weapon.AmmoGive 0
 Weapon.AmmoType "Mana"
 +WEAPON.NOAUTOAIM
  States
 {
  Spawn:
       TNT1 A -1
       Loop
  Ready:
       TNT1 A 1 A_WeaponReady
       goto AltFire
  Fire:
  TNT1 A 1
  goto AltFire
  Deselect:
       TNT1 A 1 A_Lower
       Loop
  Select:
       TNT1 A 0 A_Raise
       Loop
  AltFire:
       TNT1 A 0 A_GiveInventory("ArachnoShredderWeapon")
       TNT1 A 0 A_SelectWeapon("ArachnoShredderWeapon")
       TNT1 A 0 
       goto deselect
  Flash:
       SNIF F 3 Bright A_Light2
       SNIF F 3 Bright A_Light1
       SNIF F 0 Bright A_Light0
       Goto LightDone     
       }
}


actor ArachnoShredderattackmode1 : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  }
}

actor ArachnoShredderattackmode2 : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  }
}

actor ArachnoShredderattackmode3 : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  }
}

actor ArachnoShredderattackmode4 : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  }
}

Actor UsingRockets : Inventory
{
	inventory.maxamount 1
}

ACTOR ArachnoShredderWeapon : Weapon 
{
 Weapon.SelectionOrder 800
 Obituary "%o was engulfed in Plasmas by %k"
 Inventory.PickupMessage ""
 Inventory.PickupSound "misc/pk_up"
 Weapon.AmmoUse 0
 Weapon.AmmoGive 0
 Weapon.AmmoType "Mana"
 +WEAPON.NOAUTOAIM
 +INVENTORY.UNDROPPABLE
  States
 {
  Spawn:
       TNT1 A -1
       Loop
  Ready:
       CLA2 A 0 A_Takeinventory("UsingRockets", 1)
       CLA2 A 1 A_WeaponReady(WRF_ALLOWRELOAD)
       goto ready
  Deselect:
       CLA2 A 1 A_Lower
       Loop
  Select:
       CLA2 A 0 A_Raise
       Loop
  Fire:
       CLA2 A 0 A_jumpIfinventory("ArachnoShredderattackmode1", 1, "PlasmaAttackcheck")
       CLA2 A 0 A_jumpIfinventory("ArachnoShredderattackmode2", 1, "LaserAttackcheck")
       CLA2 A 0 A_jumpIfinventory("ArachnoShredderattackmode3", 1, "RocketAttackcheck")
	   CLA2 A 0 A_jumpIfinventory("ArachnoShredderattackmode4", 1, "CommanderAttackcheck")
	   Goto ready
  AltFire:
  	   CLA2 A 1 ACS_execute(812)
       CLA2 A 9
       goto ready
  PlasmaAttack:
       CLA2 A 0 A_Takeinventory("mana", 3)
       CLA2 A 0 A_GunFlash
	   CLA2 A 0 A_FireCustomMissile ("ArachnoShredderPlasma",random(-10,10),1,0,0,0)
	   CLA2 A 2 A_FireCustomMissile ("ArachnoShredderPlasma",0,1,0,0,0)
       CLA2 B 2
       goto ready
  LaserAttack:
       CLA2 A 0 A_Takeinventory("mana", 40)
       CLA2 A 0 A_GunFlash
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",0,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",-3,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",-6,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",-9,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",-12,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",-15,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",3,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",6,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",9,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",12,1,0,0,0)
	   CLA2 A 0 Bright A_FireCustomMissile("ArachnotronShredderLaser",15,1,0,0,0)
       CLA2 B 15
       goto ready
  RocketAttack:
       CLA2 A 0 A_Giveinventory("UsingRockets", 1)
       CLA2 A 0 A_Takeinventory("mana", 30)
       CLA2 A 0 A_GunFlash
	   CLA2 B 0 A_FireCustomMissile ("ArachnoShredderHomingRocket",random(-5,5),1,-5,0,0)
	   CLA2 B 0 A_FireCustomMissile ("ArachnoShredderHomingRocket",random(-5,5),1,5,0,0)
	   CLA2 B 0 A_FireCustomMissile ("ArachnoShredderHomingRocket",random(-5,5),1,0,5,0)
       CLA2 B 8 A_FireCustomMissile ("ArachnoShredderHomingRocket",random(-5,5),1,0,-5,0)
       goto ready
  CommanderAttack:
       CLA2 A 0 A_Takeinventory("mana", 40)
	   CLA2 A 0 A_GiveInventory("ArachnotronCooldown", 1)
       CLA2 A 0 A_GunFlash
	   CLA2 B 5
	   TNT1 A 0 A_SpawnItemEx("TeleportFog", 192, 0, 32)
       TNT1 A 0 A_SpawnItemEx("AracnoShredderArachnotron", 192, 0, 32)
	   CLA2 B 30
	   Goto Ready
  PlasmaAttackcheck:
       TNT1 A 0 A_jumpIfinventory("mana", 4, "PlasmaAttack")
  goto ready
  LaserAttackcheck:
       TNT1 A 0 A_jumpIfinventory("mana", 40, "LaserAttack")  
  goto ready
  RocketAttackcheck:
       TNT1 A 0 A_jumpIfinventory("mana", 25, "RocketAttack")  
  goto ready
  CommanderAttackcheck:
	   TNT1 A 0 A_JumpIfInventory("ArachnotronCooldown", 1, 2)
       TNT1 A 0 A_jumpIfinventory("mana", 60, "CommanderAttack")  
  goto ready
       CLA2 A 1
       Goto Ready
  Reload:
       CLA2 A 0 A_GunFlash
	   CLA2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1 Bright a_FireCustomMissile("ArachnotronPlasmaFusion",random(-90,90),0,0,0,0)
       CLA2 B 105
       goto ready
  Flash:
       SNIF F 3 Bright A_Light2
       SNIF F 3 Bright A_Light1
       SNIF F 0 Bright A_Light0
       Goto LightDone     
       }
}

actor ArachnoShredderHomingRocket
{
 
  Radius 11
  Height 8
  Speed 15
  Damage 7
  Projectile
  +SEEKERMISSILE
  +LOOKALLAROUND
  +RANDOMIZE
  DamageType "Boss"
  scale 0.75
  SeeSound "PoisonGrenades/Fire"
  DeathSound "weapons/rocklx"
  Obituary "$OB_MPROCKET" // "%o rode %k's rocket."
  States
  {
  Spawn:
        TNT1 A 0
        TNT1 A 0 A_RearrangePointers(AAPTR_NULL,AAPTR_TARGET,AAPTR_TRACER)
        TNT1 A 0 A_LookEx(0,0,0,0,0,"Acquired")
        TNT1 A 0 A_RearrangePointers(AAPTR_MASTER,AAPTR_MASTER,AAPTR_TRACER)
        Goto Idle
    Acquired:
        TNT1 A 0 A_RearrangePointers(AAPTR_MASTER,AAPTR_MASTER,AAPTR_TARGET)
        Goto Idle
	Idle:
		MICR A 1 Bright A_SeekerMissile(15,10)
		TNT1 A 0 A_SpawnItem("ExplosiveSmoke", 0, 0)
		Loop
Death:
		MISL B 3 Bright A_Explode(32,96)
        MIS9 CD 3 Bright
		MIS9 EFG 3 Bright
        Stop
  }
}

ACTOR ArachnotronShredderLaser
{
  Radius 13
  Height 8
  Speed 25
  Damage 12
  Projectile
  +RANDOMIZE
  RenderStyle translucent
  scale 0.55
  Alpha 0.75
  SeeSound "weapons/plasmaf"
  DeathSound "weapons/plasmax"
  Obituary  "%o was melted by %k's laser."
  translation "192:207=175:191" , "80:111=168:191"
  States
  {
  Spawn:
    LASB A 1 Bright A_SpawnItem("ArachnotronShredderLaserParticle")
    Loop
  Death:
    PLSE ABCDE 4 Bright
    Stop
  }
}
ACTOR ArachnotronShredderLaserparticle
{
  Radius 13
  Height 8
  Speed 0
  Damage 0
  Projectile
  +RANDOMIZE
  +noclip
  RenderStyle translucent
  scale 0.55
  Alpha 0.75
  SeeSound "weapons/plasmaf"
  DeathSound "weapons/plasmax"
  Obituary  "%o was melted by %k's laser."
  translation "192:207=175:191" , "80:111=168:191"
  States
  {
  Spawn:
    LASB G 1 Bright A_FadeOut(0.1)
    Loop
  
  }
}
ACTOR ArachnoShredderPlasma
{

  Radius 13
  Height 8
  Speed 25
  Damage 3
  DamageType "Boss"
  Projectile
  +RANDOMIZE
  +HEXENBOUNCE
  BounceCount 3
  RenderStyle Add 
  Alpha 0.75
  SeeSound "baby/attack"
  DeathSound "baby/shotx"
  States
  {
  Spawn:
    APLS AB 5 Bright
    Loop
  Death:
    APBX ABCDE 5 Bright
    Stop
  }
}

ACTOR ArachnotronPlasmaFusion
{

  Radius 13
  Height 8
  Speed 6
  Damage 5
  Projectile
  +RANDOMIZE
  RenderStyle Add 
  Alpha 0.75
  SeeSound "baby/attack"
  DeathSound "baby/shotx"
  States
  {
  Spawn:
    APLS AB 5 Bright
    Loop
  Death:
    APBX ABCDE 5 Bright
    Stop
  }
}

ACTOR AracnoShredderArachnotron : Arachnotron
{
  DamageType "Boss"
  DamageFactor "Boss", 0.0
  +NOTARGET
  +LOOKALLAROUND
  +NOINFIGHTING
  +DONTHURTSPECIES
  States
  {
  Spawn:
    BSPI AA 0 A_ChangeFlag("FRIENDLY",0)
    BSPI AB 10 A_Look
    Loop
  Missile:
    TNT1 A 0 A_JumpIfInTargetInventory("ArachnoShredderWeapon", 1, "Clear")
    BSPI A 20 Bright A_FaceTarget
    BSPI G 4 Bright A_BspiAttack
    BSPI H 4 Bright
    BSPI H 1 Bright A_SpidRefire
    Goto Missile+2
  Clear:
	TNT1 A 0 A_ClearTarget
    BSPI A 0 A_Playsound ("baby/walk")
    BSPI AABBCC 3 A_Wander
    BSPI D 0 A_Playsound ("baby/walk")
    BSPI DDEEFF 3 A_Wander
    Goto See
  }
}

Actor ArachnotronCooldown : PowerProtection
{
	powerup.duration -15
	damagefactor "normal", 1.0
}