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


actor PowerKorax : PowerMorph
{
powerup.duration 99999999999999
PowerMorph.PlayerClass "KoraxPlayer"
}

ACTOR KoraxPlayer : PlayerPawn
{
  Health 1000
  Radius 65
  Height 115
  Speed 0.8
  mass 2000
  Player.ColorRange 0, 0
  Player.JumpZ 9
  Player.MaxHealth 24000
  Player.DisplayName "Korax"
  Player.SoundClass "Korax"
  Player.MorphWeapon "KoraxWeapon0"
  Player.StartItem "Mana", 100
  PainChance 64
  Player.ViewHeight 90
  Scale 1.0
  limitedtoteam 1
  Species "Korax"
  damagefactor "boss", 0
	bloodcolor green
	+THRUSPECIES
	+NOSKIN
	-PICKUP
  states
{
  Spawn:
    KORX A 5
    Loop
  See:
    KORX AA 3 SetPlayerProperty(0, 1, 1)
    KORX AABBBB 3
    KORX C 0 A_PlaySound("Korax/Step")
	MOLO B 0 A_SpawnItemEx("UniversalStomp")
    KORX CCCCDDDD 3
    KORX A 0 A_PlaySound("Korax/Step")
	MOLO B 0 A_SpawnItemEx("UniversalStomp")
    Loop
  Pain:
    KORX H 2 A_Pain
    KORX H 2
    Goto Spawn
  Missile:
    KORX E 4 Bright 
    KORX F 8 Bright
    KORX E 8 Bright
    Goto Spawn
  Commanding:
    KORX WWWWW 1 Bright A_JumpIf(Health<=0,"Death")
	KORX GGGGG 1 Bright A_JumpIf(Health<=0,"Death")
    Goto Spawn
  Death:
	TNT1 A 0 a_givetotarget("BOSSKILLEDSTAT", 1)
	TNT1 A 0 a_givetotarget("reward", 1)
    KORX IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 1 A_SpawnItemEx ("ChexExplosionEffect",0,0,0,random(-10,10),random(-10,10),random(5,10),0,128)
	KORX J 5 A_FaceTarget
	KORX K 5 A_Scream
	KORX LMNOP 5
	KORX Q 10
	KORX RRRRRRRRRR 0 A_CustomMissile("KoraxWraiths",0,0,random(180,-180))
	KORX RRRRRRRRRRRRRRRRRRRR 1 A_SpawnItemEx ("ChexExplosionEffect", 0, 0,0,random(-9,9),random(-9,9),random(5,9), 48, 128)
	KORX S 5 A_NoBlocking
	KORX TU 5
	KORX V -1 A_BossDeath
	Stop
   }
}

ACTOR KoraxWeapon0 : Weapon 
{
 Weapon.SelectionOrder 800
 Obituary "%o was engulfed in flames 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("KoraxWeapon")
       TNT1 A 0 A_SelectWeapon("KoraxWeapon")
       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 Koraxattackmode1 : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 1
  States
  {
  Spawn:
    TNT1 A -1
    Stop
  }
}

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

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

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

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

ACTOR KoraxWeapon : Weapon 
{
 Weapon.SelectionOrder 800
 Obituary "%o was engulfed in flames 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 1 A_WeaponReady
       goto ready
  Deselect:
       CLA2 A 1 A_Lower
       Loop
  Select:
       CLA2 A 0 A_Raise
       Loop
  Fire:
       CLA2 A 0 A_jumpIfinventory("Koraxattackmode1", 1, "WrathAttackcheck")
       CLA2 A 0 A_jumpIfinventory("Koraxattackmode2", 1, "CallAttackcheck")
       CLA2 A 0 A_jumpIfinventory("Koraxattackmode3", 1, "WraithvergeAttackcheck")
	   CLA2 A 0 A_jumpIfinventory("Koraxattackmode4", 1, "CrossAttackcheck")
	   CLA2 A 0 A_jumpIfinventory("Koraxattackmode5", 1, "TeleportAttackcheck")
	   Goto ready
  AltFire:
  	   CLA2 A 1 ACS_execute(812)
       CLA2 A 1
       CLA2 A 13
       goto ready
  WrathAttack: 
       CLA2 A 0 A_Takeinventory("mana", 5)
       CLA2 AA 1 A_Jump(256,"Wrath1","Wrath2","Wrath3","Wrath4","Wrath5","Wrath6")
	   Goto Wrath1
  Wrath1:
       CLA2 A 0 A_GunFlash
	   CLA2 A 1 A_RearrangePointers(AAPTR_NULL)
	   CLA2 A 1 ACS_NamedExecuteAlways("KoraxTarget", 0, 0)
	   CLA2 A 0 A_PlaySound("bormereth/missile2fired",CHAN_WEAPON,1.0)
	   CLA2 A 0 A_CustomMissile ("KoraxWraithProjectile", 55, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxWraithProjectile", 55, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxWraithProjectile", 82, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxWraithProjectile", 82, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxWraithProjectile", 110, -35, 0, 0, 0)
	   CLA2 F 0 A_CustomMissile ("KoraxWraithProjectile", 110, 35, 0, 0, 0)
       CLA2 BA 6
       Goto Ready
  Wrath2:
       CLA2 A 0 A_GunFlash
	   CLA2 A 1 A_RearrangePointers(AAPTR_NULL)
	   CLA2 A 1 ACS_NamedExecuteAlways("KoraxTarget", 0, 0)
	   CLA2 A 0 A_PlaySound("Lottor/Fire_Spawn",CHAN_WEAPON,1.0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentFireProjectile", 55, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentFireProjectile", 55, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentFireProjectile", 82, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentFireProjectile", 82, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentFireProjectile", 110, -35, 0, 0, 0)
	   CLA2 F 0 A_CustomMissile ("KoraxSerpentFireProjectile", 110, 35, 0, 0, 0)
       CLA2 BA 6
       Goto Ready
  Wrath3:
       CLA2 A 0 A_GunFlash
	   CLA2 A 1 A_RearrangePointers(AAPTR_NULL)
	   CLA2 A 1 ACS_NamedExecuteAlways("KoraxTarget", 0, 0)
	   CLA2 A 0 A_PlaySound("dragonattack",CHAN_WEAPON,1.0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentGreenFire", 55, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentGreenFire", 55, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentGreenFire", 82, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentGreenFire", 82, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentGreenFire", 110, -35, 0, 0, 0)
	   CLA2 F 0 A_CustomMissile ("KoraxSerpentGreenFire", 110, 35, 0, 0, 0)
       CLA2 BA 6
       Goto Ready
  Wrath4:
       CLA2 A 0 A_GunFlash
	   CLA2 A 1 A_RearrangePointers(AAPTR_NULL)
	   CLA2 A 1 ACS_NamedExecuteAlways("KoraxTarget", 0, 0)
	   CLA2 A 0 A_PlaySound("Lottor/Fire_Spawn",CHAN_WEAPON,1.0)
	   CLA2 A 0 A_CustomMissile ("KoraxAfritMissile", 55, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxAfritMissile", 55, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxAfritMissile", 82, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxAfritMissile", 82, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxAfritMissile", 110, -35, 0, 0, 0)
	   CLA2 F 0 A_CustomMissile ("KoraxAfritMissile", 110, 35, 0, 0, 0)
       CLA2 BA 6
       Goto Ready 
  Wrath5:
       CLA2 A 0 A_GunFlash
	   CLA2 A 1 A_RearrangePointers(AAPTR_NULL)
	   CLA2 A 1 ACS_NamedExecuteAlways("KoraxTarget", 0, 0)
	   CLA2 A 0 A_PlaySound("Centaur/Blast",CHAN_WEAPON,1.0)
	   CLA2 A 0 A_CustomMissile ("KoraxCentaurBlast", 55, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxCentaurBlast", 55, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxCentaurBlast", 82, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxCentaurBlast", 82, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxCentaurBlast", 110, -35, 0, 0, 0)
	   CLA2 F 0 A_CustomMissile ("KoraxCentaurBlast", 110, 35, 0, 0, 0)
       CLA2 BA 6
       Goto Ready
  Wrath6:
       CLA2 A 0 A_GunFlash
	   CLA2 A 1 A_RearrangePointers(AAPTR_NULL)
	   CLA2 A 1 ACS_NamedExecuteAlways("KoraxTarget", 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentMissile", 55, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentMissile", 55, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentMissile", 82, -52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentMissile", 82, 52, 0, 0, 0)
	   CLA2 A 0 A_CustomMissile ("KoraxSerpentMissile", 110, -35, 0, 0, 0)
	   CLA2 F 0 A_CustomMissile ("KoraxSerpentMissile", 110, 35, 0, 0, 0)
       CLA2 BA 6
       Goto Ready
	   
  CallAttack:
       CLA2 A 10 A_Takeinventory("mana", 40)
       CLA2 A 0 A_GunFlash
	   CLA2 AA 0 A_FireCustomMissile("KoraxSpikeSpawner",random(-10,10),0,0,0)
	   CLA2 A 0 A_FireCustomMissile("KoraxSpikeSpawner",0,0,0,0)
       CLA2 B 10
       Goto Ready
  WraithvergeAttack:
       CLA2 A 10 A_Takeinventory("mana", 50)
       CLA2 A 0 A_GunFlash
	   CLA2 AAAAA 0 A_FireCustomMissile("KoraxWraiths",random(-90,90),0,0,0)
       CLA2 BA 5
       Goto Ready
  CrossAttack:
       TNT1 A 0 ACS_NamedExecuteAlways("True Sprite",0,Korax_Command)
	   TNT1 A 0 A_PlaySound("Korax/Command",CHAN_6,1.0,FALSE,ATTN_NONE)
	   TNT1 A 0 A_PlaySound("Korax/Command",CHAN_7,1.0,FALSE,ATTN_NONE)
       CLA2 A 2 A_Takeinventory("mana", 50)
       CLA2 A 0 A_GunFlash
	   CLA2 A 0 A_FireCustomMissile("KoraxMeteorSpawner",0,0,0,0)
       CLA2 BA 4
       Goto Ready
  TeleportAttack:
       TNT1 A 0 ACS_NamedExecuteAlways("True Sprite",0,Korax_Command)
	   TNT1 A 0 A_PlaySound("Korax/Command",CHAN_6,1.0,FALSE,ATTN_NONE)
	   TNT1 A 0 A_PlaySound("Korax/Command",CHAN_7,1.0,FALSE,ATTN_NONE)
       CLA2 A 2 A_Giveinventory("KoraxFadeCooldown",1)
	   CLA3 D 0 A_FireCustomMissile ("TeleportFog",0,0,0,0,0,0)
	   TNT1 A 0 ACS_NamedExecuteAlways("KoraxFade", 0)
	   CLA2 BA 4
       Goto ready
  WrathAttackcheck:
       TNT1 A 0 A_jumpIfinventory("mana", 5, "WrathAttack")
  goto ready
  CallAttackcheck:
       TNT1 A 0 A_jumpIfinventory("mana", 40, "CallAttack")  
  goto ready
  WraithvergeAttackcheck:
       TNT1 A 0 A_jumpIfinventory("mana", 50, "WraithvergeAttack")  
  goto ready
  CrossAttackcheck: 
       TNT1 A 0 A_jumpIfinventory("mana", 50, "CrossAttack")  
  goto ready
  TeleportAttackcheck:
	   TNT1 A 0 A_jumpIfinventory("KoraxFadeCooldown", 1, "Ready")
	   Goto TeleportCheck
  TeleportCheck:
       TNT1 A 0 A_jumpIfinventory("mana", 60, "TeleportAttack")  
  goto ready
  Flash:
       SNIF F 3 Bright A_Light2
       SNIF F 3 Bright A_Light1
       SNIF F 0 Bright A_Light0
       Goto LightDone     
       }
}

Actor KoraxWraithProjectile : WraithFX1
{
	Damage 12
	Scale 1.1
	Speed 30
    +SPAWNSOUNDSOURCE
	SeeSound "bormereth/missile2fired"
	DeathSound "bormereth/missile2death"
	Decal DoomImpScorch
	States
	{
  Spawn:
		TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
		WRBL A 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		WRBL A 1 Bright
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		WRBL A 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
		WRBL B 1 Bright
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		WRBL B 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		WRBL B 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		TNT1 AAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
		WRBL C 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		WRBL C 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		WRBL C 1 Bright 
		TNT1 A 0 A_SpawnItemEx("PEFBTrail",0,0,0,0,0,0,0,128)
		Loop
	Death:
		TNT1 A 0 A_CustomMissile("PEFBExplo",0,0,0)
		TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("WraithFX23",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
		TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),128)
		WRBL DEF 3 Bright
		WRBL GHI 3
		Stop
     }
}	

ACTOR KoraxSerpentFireProjectile : LottorFX
{
	Speed 25
	RenderStyle Add
	+SPAWNSOUNDSOURCE
	States
	{
	}
}

ACTOR KoraxSerpentGreenFire : AurelionFireball
{
   Speed 25
   +SPAWNSOUNDSOURCE
   Translation "0:255=%[0.00,0.00,0.00]:[1.01,2.00,0.00]"
   States
   {
   Death:
      TNT1 A 0 A_CustomMissile("PEFBExplo",0,0,0)
	  TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("WraithFX23",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION)
	  TNT1 AAAAAAAAAAAAAAA 0 A_SpawnItemEx("WraithFX22",0,0,0,random(-5,5),random(-5,5),random(-5,5),random(1,360),SXF_TRANSFERTRANSLATION | SXF_NOCHECKPOSITION)
	  WRBL DEF 3 Bright
	  WRBL GHI 3
	  Stop
   }
}

ACTOR KoraxAfritMissile : FastProjectile
{
  Speed 55
  Radius 10
  Height 6
  Mass 5
  Damage 7
  DamageType "Boss"
  Projectile
  RenderStyle Add
  +SPAWNSOUNDSOURCE
  SeeSound "Lottor/Fire_Spawn"
  DeathSound "weapons/firex2"
  States
  {
  Spawn:
    FDMB A 2 Bright A_SpawnItemEx("KoraxAfritMissileParticle",frandom(-4,4),frandom(-4,4),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(-1,1),random(1,360),128)
    Loop
  Death:
    FDMB BCDE 5 Bright
    Stop
  }
}

ACTOR KoraxAfritMissileParticle
{
    Alpha 1.0
	Scale 0.25
    RenderStyle Add
	+NOINTERACTION
	+CLIENTSIDEONLY
    +NOBLOCKMAP
    +NOGRAVITY
    States
    {
    Spawn:
        FDMB B 1 A_FadeOut(0.05)
		FDMB B 0 A_SetScale(ScaleX*0.95)
        Loop
    }
}

Actor KoraxCentaurBlast
{
	PROJECTILE
	Speed 40
	Radius 8
	Height 12
	Damage 9
	Species "Boss"
	+SPAWNSOUNDSOURCE
	SeeSound "Centaur/Blast"
	DeathSound "WraithMissileExplode"
	Renderstyle Add
	States
	{
		Spawn:
			CTFX A 1 Bright A_SpawnItemEx("KoraxCentaurBlastTrail",0,0,0,0,0,0,0,128)
		    Loop
		Death:
			TNT1 A 0 A_PlaySound("WraithMissileExplode")
			CTFX BCDEF 3 Bright
		    Stop
	}
}

actor KoraxCentaurBlastTrail
{
    Radius 1
    Height 1
    Speed 0
    PROJECTILE
    RENDERSTYLE ADD
    ALPHA 1.0
    +NOCLIP
    States
    {
    Spawn:
     	CTFX A 1 Bright A_FadeOut(0.1)
     	Loop     
    }
}

ACTOR KoraxSerpentMissile : SerpentFX
{
  Speed 15
  Damage 10
  States
  {
  Spawn:
    SSFX A 0
    SSFX A 0 Bright A_PlaySound("SerpentFXContinuous", CHAN_BODY, 1.0,TRUE)
    SSFX AAABBB 1 Bright A_SpawnItemEx("KoraxSerpentMissileTrail",0,0,0,0,0,0,0,128)
    Goto Spawn+1
  Death:
    SSFX C 3 Bright A_StopSoundEx("Body")
    SSFX DEFGH 3 Bright
    Stop
  }
}

Actor KoraxSerpentMissileTrail : KoraxCentaurBlastTrail
{
    Alpha 1.00
	Scale 0.25
    States
    {
    Spawn:
     	SSFX CDEFGH 3 Bright 
		Stop
    }
}

ACTOR KoraxSpikeSpawner
{
	Radius 8
	Height 8
	Speed 30
	Damage 0
	DamageType "Boss"
	+RIPPER
	+FLOORHUGGER
	+BLOODLESSIMPACT
	+THRUACTORS
	DONTHURTSHOOTER
    Obituary "%o's got impaled by the Korax."
	Projectile
	States
	{
	Spawn: 
		TNT1 A 4 Bright A_SpawnItemEx("KoraxSpike",0,0,5,0,0,0,0)
		TNT1 A 0 Bright A_Explode(64, 128)
		Loop
	Death:	
		TNT1 A 6
		Stop
	}
}

Actor KoraxSpike
{
  Radius 16
  Height 128
  -SOLID
  +THRUSPECIES
  Species "Korax"
  DamageType "Boss"
  States
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_PlaySound("Korax/Quake",CHAN_VOICE,1.0)
	SPKD ABCDE 1 A_SpawnItemEx("KoraxSpikeParticle",0,0,2,random(-10,10),random(-10,10),random(0,10),random(1,360))
	TNT1 A 0 Bright A_Explode(64, 128)
	SPKD FGHI 1 A_SpawnItemEx("KoraxSpikeParticle",0,0,2,random(-10,10),random(-10,10),random(0,10),random(1,360))
	TNT1 A 0 A_ChangeFlag("SOLID",1)
	SPKD IIIIIIIIII 35
	TNT1 A 0 A_ChangeFlag("SOLID",0)
	SPKD HGFCEDCBA 1 A_SpawnItemEx("KoraxSpikeParticle",0,0,2,random(-10,10),random(-10,10),random(0,10),random(1,360))
	TNT1 A 1 Thing_Remove(0)
	stop
  }
}

Actor KoraxSpikeParticle
{
	Projectile
	Damage 0
	+NOBLOCKMAP
	+BLOODLESSIMPACT
	+CLIENTSIDEONLY 
    -BLOODSPLATTER
    +DontSplash
    +FORCEXYBILLBOARD
	-NOGRAVITY
	Speed 0
	Radius 1
	Height 1
	Scale 0.5
	Gravity 0.9
	States
	{
  Spawn:
    KORE A 1 Bright
    Loop
  Death:
    KORE A 1 Bright A_FadeOut(0.04)
    Loop
	}
}

ACTOR KoraxMissileTarget
{
  +NOBLOCKMAP
  +PUFFGETSOWNER
  +PUFFONACTORS
  +ALWAYSPUFF
  +NOGRAVITY
  +SHOOTABLE
  Mass 1
  States
  { 
  Spawn:
    TNT1 A 1 NoDelay A_TransferPointer(aaptr_default,aaptr_target,aaptr_default,aaptr_target)
	TNT1 A 0
	TNT1 A 10
    Stop
  }
}

Actor KoraxWraiths
{
	Speed 20
	Damage (10*Random(1,5))
	radius 6
	height 12
	RENDERSTYLE Translucent
	Alpha 0.9
	PROJECTILE
	+SEEKERMISSILE
	+LOOKALLAROUND
	+HITTRACER
	seesound "monster/spratk"
	deathsound "moloch/wraithdie"
	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:
        WRAI AABB 2 A_SeekerMissile(25,10)
		Loop
	Death:
	    TNT1 A 0
	    TNT1 A 0 A_RadiusGive("KoraxFrostCheck",160,RGF_PLAYERS)
		WRAI EEEEEFFFFFGGGGGHHHHHIIIIIJJJJJ 1 Bright A_FadeOut(0.04)
		Stop
	}
}

Actor KoraxFrostCheck : CustomInventory 
{
  Inventory.Amount 1
  Inventory.MaxAmount 5
  Inventory.InterHubAmount 1
  +INVENTORY.QUIET
  +INVENTORY.AUTOACTIVATE
  States
  {
  Spawn:
    TNT1 A 1
    Stop
  Pickup:
    TNT1 A 0 A_JumpIfInventory("KoraxWeapon", 1, "Succeed")
	TNT1 A 0 A_GiveInventory("BelfegartFrost", 1)
    Stop
  Succeed:
    TNT1 A 0
    Stop
  }
}

Actor KoraxMeteorSpawner
{
  Radius 1
  Height 1
  -SOLID
  +THRUSPECIES
  Species "Korax"
  DamageType "Boss"
  ReactionTime 10
  States
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_CustomMissile("KoraxMeteorMissile",32,0,90,2)
	TNT1 A 0 A_CustomMissile("KoraxMeteorMissile",32,0,-90,2)
	TNT1 A 0 A_CustomMissile("KoraxMeteorMissile",32,0,180,2)
	TNT1 A 55 A_CustomMissile("KoraxMeteorMissile",32,0,0,2)
	TNT1 A 0 A_Countdown
	Loop
  Adios:
    TNT1 A 1
	Stop
  }
}

Actor KoraxMeteorMissile
{
  Radius 0
  Height 0
  Speed 30
  Projectile
  +FloorClip
  +Ripper
  +CeilingHugger
  +DontHurtSpecies
  damagetype "boss"
  States
  {
  Spawn:
    TNT1 AAAAAAAAAAAAAAAAAAAA 3 A_CustomMissile("KoraxFallingComet",ceilingz-z-16,0,0,2,0)
	Stop
  }
}

Actor KoraxFallingComet
{
  Radius 6
  Height 8
  Speed 0
  Damage 10
  Projectile
  SeeSound "bormereth/missile2fired"
  DeathSound "bormereth/missile2death"
  -NoGravity
  -Float
  +FloorClip
  +DontHurtSpecies 
  +SpawnCeiling
  Gravity 1
  damagetype "boss"
  States
  {
  Spawn:
		WRBL ABC 3 Bright 
		Loop
	Death:
		TNT1 A 0 A_CustomMissile("PEFBExplo",0,0,0)
		TNT1 A 0 A_Explode(64,128)
		WRBL DEF 3 Bright
		WRBL GHI 3
		Stop
  }
}

Actor KoraxFadeCooldown : PowerDamage
{
	DamageFactor "Nothing", 1.0
	PowerUp.Duration -30
}