//===========================================================================
//
//  Priest
//
//===========================================================================

ACTOR "Priest" : PlayerPawn
{
	Speed 1
	Health 100
	Radius 16
	Height 56
	Mass 100
	PainChance 255
	Player.DisplayName "Priest"
	Player.SoundClass "Priest"
	Player.StartItem "ClassID", 7
	Player.StartItem "PriestToken", 1
	Player.StartItem "LightBringer", 1
	Player.StartItem "Scapular", 3
	Player.StartItem "Morning Star", 1
	Player.StartItem "KXHeavenFaith", 30
    DamageFactor "Player", 0
	Player.ForwardMove 0.95 
	Player.SideMove 0.95
	Scale 0.92
	Player.WeaponSlot 1, "Morning Star"
    Player.WeaponSlot 2, "LightBringer"
	Player.ColorRange 112, 127
	States
	{
	Spawn:
		UNDP A 7 
		Loop
	See:
		UNDP ABCD 4
		Loop
	Missile:
    	UNDP E 12
    	Goto Spawn
    Melee:
    	UNDP F 6 BRIGHT
    	Goto Missile
	Pain:
		UNDP G 3
		UNDP G 3 A_Pain
		Goto Spawn
	Pain.WhirlWind:
        UNDP G 2
        TNT1 A 0 ThrustThing(random(0, 360)*256/360, random(-8, 8), 0, 0)
        TNT1 A 0 ThrustThingZ(0, random(0, 4), random(0,1), 1)
        TNT1 A 0 A_SetAngle(angle+random(-1,1)*random(25,50))
        TNT1 A 0 A_SetBlend("10 10 10", 0.6, 24)
        Goto Pain
    Pain.DeathKnightStun:
        UNDP G 2
        TNT1 A 0 acs_executealways(616, 0, 30)
        Goto Pain
    Pain.DeathKnightAssassinate:
        UNDP G 2
	    TNT1 A 0 acs_terminate(616, 0)
	    TNT1 A 0 a_takeinventory("armor", 250)
        TNT1 A 0 A_ChangeVelocity(0, 0, 0, CVF_REPLACE)
	    TNT1 A 0 SetPlayerProperty(0, 1, 4)
	    TNT1 A 0 A_SetGravity(0.75)
        TNT1 A 0 ThrustThingZ(0, 64, 0, 0)
	    TNT1 A 0 a_spawnitemex("deathknightassassinate2")
        Goto Pain
    Pain.DeathKnightDash:
        UNDP G 2
	    TNT1 A 0 acs_terminate(616, 0)
	    TNT1 A 0 acs_execute(618, 0)
        Goto Pain
	Pain.SlimeSpit:
		UNDP G 0  
		UNDP G 0 A_JumpIfInventory("SlimerSpitWindow",1,"Pain") 		
		UNDP G 0 A_GiveInventory("SlimerSpitWindow",1)
        UNDP G 1 ACS_NamedExecuteAlways("Slimer Spit",0)
        Goto Pain	
	Death:
		UNDP H 6 A_PlayerScream
		TNT1 H 0 a_spawnitemex("AmmoPack2", random(-10, 10), random(-10, 10), random(20, 44), random(1,2), random(1,2), random(3,4), 0, 0, 255)
		TNT1 H 0 a_spawnitemex("AmmoPack2", random(-10, 10), random(-10, 10), random(20, 44), random(1,2), random(1,2), random(3,4), 0, 0, 55)
		TNT1 H 0 a_spawnitemex("StimPack2C", random(-10, 10), random(-10, 10), random(20, 44), random(1,2), random(1,2), random(3,4), 0, 0, 255)
		TNT1 H 0 a_spawnitemex("StimPack2C", random(-10, 10), random(-10, 10), random(20, 44), random(1,2), random(1,2), random(3,4), 0, 0, 200)
		TNT1 H 0 a_spawnitemex("StimPack2C", random(-10, 10), random(-10, 10), random(20, 44), random(1,2), random(1,2), random(3,4), 0, 0, 150)
		TNT1 H 0 a_spawnitemex("StimPack2C", random(-10, 10), random(-10, 10), random(20, 44), random(1,2), random(1,2), random(3,4), 0, 0, 100)
    	UNDP I 6 
    	UNDP JK 6
    	UNDP L 6 A_NoBlocking
    	UNDP M 6
    	UNDP N -1
    	Stop
	XDeath:
	    UNDP G 2 A_XScream
	    TNT1 AAAAAA 0 A_CustomMissile("CeilBloodLauncherLong",0,0,Random(0,360),2,Random(50,130))
		TNT1 AA 0 A_CustomMissile("XDeath1",32,0,Random(0,360),2,Random(0,160))
		TNT1 AA 0 A_CustomMissile("XDeath2",32,0,Random(0,360),2,Random(0,160))
		TNT1 AA 0 A_CustomMissile("XDeath3",32,0,Random(0,360),2,Random(0,160))
		TNT1 AA 0 A_CustomMissile("XDeath4",32,0,Random(0,360),2,Random(0,160))
		TNT1 AA 0 A_CustomMissile("XDeath5",32,0,Random(0,360),2,Random(0,160))
		TNT1 AAAAAAAA 0 A_CustomMissile("SuperWallRedBlood",40,0,Random(0,360),2,Random(-5,5))
		TNT1 AAAA 0 A_CustomMissile("Instestin",32,0,Random(0,360),2,Random(0,160))
	    TNT1 AAAAAAAAAAAAAAAAAAAAAAAA 0 A_CustomMissile("Brutal_FlyingBlood",35,0,Random(0,360),2,Random(0,160))
	    TNT1 AAAAAA 0 A_CustomMissile("SuperGoreSpawner",32,0,Random(0,360),2,Random(50,130))
		TNT1 A -1
		Stop
	}
}

ACTOR KXPriestHeal : CustomInventory
{
  +INVENTORY.ALWAYSPICKUP
  Inventory.PickupMessage "God Bless you."
  Inventory.PickupSound "Health3/Pick"
  States
  {
  Spawn:
    STI2 A -1
    Stop
  Pickup:
    TNT1 AA 0 A_GiveInventory("Medikit", 1)
	TNT1 A 0 A_SetBlend("D8 FF 00", .8, 35)
	TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("KXPriestHealParticle", FRandom(24, 32), 0, FRandom(1,15), 0, 0, (Random(20, 70)*0.1), Random(0, 360), 128)
    Stop
  }
}

Actor KXPriestHealParticle
{
  Height 2
  Radius 2
  Damage 0
  RenderStyle Add
  Alpha 0.8
  Scale 0.33
  +NoInteraction
  +NoBlockMap
  +ThruActors
  States
  {
  Spawn:
    CBTS S 1 Bright A_FadeOut(0.04)
    Loop
  }
}

ACTOR Scapular : CustomInventory 
{
   Radius 21
   Height 12
   Inventory.Amount 1
   Inventory.MaxAmount 3
   Inventory.PickupSound "items/getinvteleporter"
   Inventory.PickupMessage "Got a Scapular"
   Inventory.Icon "ESCAB0"
   Inventory.InterHubAmount 1
   +Inventory.Undroppable
   +INVBAR
   +FLOORCLIP
   States
   {
   Spawn:
      ESCA A -1
      Loop
   Use:
	  TNT1 A 0 A_JumpIfInventory("KXHeavenFaith", 30, "Succeed")
	  Fail
   Succeed:
      TNT1 A 0 A_TakeInventory("KXHeavenFaith",30)
	  TNT1 A 0 A_PlaySoundEx("Heaven/Clean", "Auto",0,2)
	  CBOS A 0 A_RadiusGive("ScapularClean",512,RGF_PLAYERS,1)
	  CBOS A 0 A_GiveInventory("ScapularClean",1)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",0,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",10,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",20,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",30,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",40,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",50,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",60,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",70,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",80,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",90,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",100,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",110,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",120,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",140,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",130,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",150,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",160,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",170,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",180,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",190,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",200,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",210,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",220,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",230,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",240,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",250,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",260,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",270,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",280,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",290,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",300,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",310,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",320,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",330,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",340,0)
	  TNT1 A 0 A_FireCustomMissile("ScapularEffectParticle",350,0)
      Stop
   } 
}

Actor ScapularEffectParticle
{
	Scale 0.5
	Alpha 1.0
	RenderStyle Add
	Speed 20
	+ThruActors
	+NoBlockMap
	+NoInteraction
	+ClientSideOnly
	Translation "0:255=%[0.00,0.00,0.00]:[2.00,2.00,2.00]"
	States
	{
	Spawn:
	Death:
		CBTS KKLLMMNNOOPPQQRRSSTTUUVVWW 1 Bright A_FadeOut(0.03)
		Stop
	}
}

ACTOR ScapularClean : CustomInventory
{
  +Inventory.AlwaysPickup
  +Inventory.Quiet
  Inventory.PickupMessage "God bless you."
  States
  {
  Spawn:
    TNT1 A 1
    Stop
  Pickup:
    TNT1 A 1 A_GiveInventory("PowerScapularProtection",1)
	TNT1 A 1 A_TakeInventory("PowerSlowCurse",1)
	TNT1 A 1 A_TakeInventory("BelfegartFrost",1)
	TNT1 A 1 A_TakeInventory("HieroWeaken",1)
	TNT1 A 1 A_TakeInventory("HieroAmpDMG",1)
	TNT1 A 1 A_TakeInventory("HieroSlow",1)
	TNT1 A 1 A_TakeInventory("DeltaHurricane",1)
	TNT1 A 1 A_TakeInventory("AzureDragonMoistureTrue",1)
	TNT1 A 1 A_TakeInventory("SnotfolusSlimeSlow",1)
	TNT1 AAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("ScapularEffectParticle2", FRandom(24, 32), 0, FRandom(1,15), 0, 0, (Random(20, 70)*0.1), Random(0, 360), 128)
	TNT1 A 0 A_SetBlend ("0, 0, 0", 1, 0.0)
    Stop
  }
}

Actor PowerScapularProtection : PowerProtection
{
Powerup.Color "F5 FF 74", 0.4
Powerup.Duration -5
Damagefactor "Boss", 0.5
}

Actor ScapularEffectParticle2 : KXPriestHealParticle
{
  Translation "0:255=%[0.00,0.00,0.00]:[2.00,2.00,2.00]"
}