ACTOR HeartOfYorick : Weapon
{
	Weapon.KickBack 100
	+UNDROPPABLE
    Weapon.AmmoType1 "Mana1"
    Weapon.AmmoType2 "Mana1"
    Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
    Weapon.AmmoUse1 1
    Weapon.AmmoUse2 4
    Inventory.PickupMessage "HEART OF YORICK"
	Tag "Heart of Yorick"
	Weapon.SelectionOrder 1
	Weapon.BobStyle InverseSmooth
	Weapon.BobSpeed 2.1
	Weapon.BobRangeY 0.4
	Weapon.BobRangeX 0.5
    States
    {
    Spawn:
		WHRT ABCDABCDABCDABCDABC 4 Bright
		WHRT D 4 Bright
		Loop
    Ready:
		LORC A 0 A_JumpIfInventory("BeatCheck",75,3)
		LORC A 0 A_GiveInventory("BeatCheck",1)
		LORC A 1 A_WeaponReady
	Goto Ready
		LORC H 4 A_WeaponReady
		LORC H 0 A_TakeInventory("BeatCheck",75)
		LORC H 0 A_PlaySound("Fability/BloodRush", CHAN_WEAPON, 1, 0)
		Loop
    Deselect:
		LORC A 1 A_Lower
		LORC A 0 A_TakeInventory("BeatCheck",75)
		TNT1 A 0 A_Lower
		Loop
    Select:
		LORC A 1 A_Raise
		LORC A 0 A_TakeInventory("BeatCheck",75)
		TNT1 A 0 A_Raise
		Loop
    Fire:
		LORC B 3
		LORC C 1 offset(-1,31)
		LORC C 1 offset(-2,39)
		LORC C 1 offset(-1,31)
		LORC D 1 offset(2,31)
		LORC D 1 offset(-1,39)
		LORC D 1 offset(1,34) 
    Hold:
		LORC E 1 Bright offset(-2,31) A_FireCustomMissile("HeartOfYorickBeamMain",frandom(-4,4),1,frandom(8,12),frandom(5,7))
		LORC E 1 Bright offset(-1,33) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC E 1 Bright offset(1,35) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC M 1 Bright offset(-1,34) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC E 1 Bright offset(1,31) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC E 1 Bright offset(2,33) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC M 1 Bright offset(2,35) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC M 1 Bright offset(1,31) A_FireCustomMissile("HeartOfYorickBeam",frandom(-4,4),0,frandom(8,12),frandom(5,7))
		LORC E 1 Bright offset(2,33) A_ReFire
		LORC F 1 offset(-1,31)
		LORC F 1 offset(-2,39)
		LORC F 1 offset(-1,31)
		LORC G 1 offset(1,32)
		LORC G 1 offset(-1,33)
		LORC G 1
		Goto Ready
    AltFire:
		LORC B 0 A_PlaySoundEx("weapon/heart/charge", "SoundSlot7", 0)
		LORC B 3
		LORC C 1 offset(-1,31)
		LORC C 1 offset(-2,39)
		LORC C 1 offset(-1,31)
		LORC D 1 offset(2,31)
		LORC D 1 offset(-1,39)
		LORC D 1 offset(1,34)
    AltHold:
		LORC E 1 Bright offset(2,31)
		LORC E 1 Bright offset(-1,39)
		LORC M 1 Bright offset(1,34)
		LORC M 1 Bright offset(-1,31) A_PlayWeaponSound("NecromancerHeartBallFire")
		LORC F 1 Bright offset(-2,39) A_FireCustomMissile("HeartOfYorickBloodBall",0,1,0,4)
		LORC F 1 Bright offset(-1,31)
		LORC F 1 Bright offset(2,33)
		LORC F 1 Bright offset(-1,31)
		LORC G 1 offset(2,33)
		LORC G 1 offset(-1,31)
		LORC G 1 offset(1,32)
		LORC A 4
		Goto Ready
    }
}

ACTOR HeartOfYorickBeam
{
	Radius 2
	Height 4
	Speed 15
	Damage (ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(1,8), INTELLECT, 0, WOCTARGET))
	Damagetype "Shadow"
	Scale 0.50
	PROJECTILE
	+FLOATBOB
	+SeekerMissile
	+MTHRUSPECIES /*+NODAMAGETHRUST*/ +DONTBLAST
	+HITMASTER
	Renderstyle Add
	States
	{
	Spawn:
		VAM2 A 0
		VAM2 A 0 Bright A_PlaySound("vampire/beam", 4, 1, 1)
	Looper:
		VAM2 A 1 Bright A_CStaffMissileSlither
		VAM2 A 1 Bright A_CStaffMissileSlither
		VAM2 A 0 Bright A_SpawnItemEx("HeartOfYorickBeamTrail", 0, 0, 0, 0, 0, 0, 0, 128)
		VAM2 A 1 Bright A_CStaffMissileSlither
		VAM2 A 1 Bright A_CStaffMissileSlither
		VAM2 A 0 Bright A_SpawnItemEx("HeartOfYorickBeamTrail", 0, 0, 0, 0, 0, 0, 0, 128)
		VAM2 A 0 Bright A_SeekerMissile(5,5,SMF_PRECISE)
		loop
	Death:
		VAM2 CDEFGH 3 Bright
		stop
	}
}

Actor HeartOfYorickBeamMain : HeartOfYorickBeam
{
	States
	{
	Death:
		VAM2 C 0 Bright A_JumpIfInTargetInventory("IsHarvester",1,2)
		VAM2 C 0 Bright A_Jump(256,2)
		VAM2 C 0 Bright A_JumpIfInventory("Level",1,"HarvesterDeath",AAPTR_MASTER)
		VAM2 CDEFGH 3 Bright
		stop
	HarvesterDeath:
		VAM2 A 0 Bright A_GiveToTarget("HeartOfYorickBeamHealth", 1)
		VAM2 CDEFGH 3 Bright
		stop
	}
}

Actor HeartOfYorickBeamHealth : CustomInventory
{
	Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	States
	{
	Use:
		TNT1 A 0 ACS_NamedExecuteAlways("WOC Area Heal",0,ACS_NamedExecuteWithResult("WOC Player Scale", 1, WISDOM, 0, ACTIVATOR), 512 , ACTIVATOR)
		Stop
	}
}

ACTOR HeartOfYorickBeamTrail
{
   Radius 2
   Height 4
   RENDERSTYLE ADD
   ALPHA 0.67
   Scale 0.50
   PROJECTILE
   +Clientsideonly
   +FLOATBOB
   +NOINTERACTION
   +DONTSPLASH
   SeeSound "monster/acosht"
   DeathSound "monster/acohit"
   States
   {
   Spawn:
	  VAM2 A 1 Bright A_FadeOut(0.05)
      Loop
   }
}

Actor HeartOfYorickBloodBall
{
	Speed 30
	Radius 8
	Height 12
	Damage (ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(60,75), INTELLECT, 0, WOCTARGET))
	Damagetype "Shadow"
	Projectile
	+SeekerMissile
	+MTHRUSPECIES /*+NODAMAGETHRUST*/ +DONTBLAST
	+HITMASTER
	+FORCERADIUSDMG
	DeathSound "weapons/heart/alt/hit"
	Scale 1.5
	Decal BigBloodSmear
	Renderstyle Add
	States
	{
	Spawn:
		BSBL AABBCC 1 Bright A_SpawnItemEx("HeartOfYorickBloodBallTrail", frandom(-5, 5), frandom(-6, 6), frandom(-6, 6), 0, 0, 0, 0, 128)
		BSBL C 0 A_SeekerMissile(45, 45, SMF_PRECISE)
		BSBL DDEEFF 1 Bright A_SpawnItemEx("HeartOfYorickBloodBallTrail", frandom(-5, 5), frandom(-6, 6), frandom(-6, 6), 0, 0, 0, 0, 128)
		BSBL F 0 A_SeekerMissile(45, 45, SMF_PRECISE)
		Loop
	Death:
		TNT1 A 0 Bright A_JumpIfInTargetInventory("IsHarvester",1,2)
		TNT1 A 0 Bright A_Jump(256,2)
		TNT1 A 0 Bright A_JumpIfInventory("Level",1,"HarvesterDeath",AAPTR_MASTER)
		TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", 64, INTELLECT, 0, WOCTARGET), 172, 0)
		TNT1 A 1 A_SpawnItemEx("HeartOfYorickBloodBallDeath", 0, 0, 0, 0, 0, 0, 0, 128)
		Stop
	HarvesterDeath:
		TNT1 A 0 A_GiveToTarget("HeartOfYorickBallHealth", 1)
		TNT1 A 0 A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", 64, INTELLECT, 0, WOCTARGET), 172, 0)
		TNT1 A 1 A_SpawnItemEx("HeartOfYorickBloodBallDeath", 0, 0, 0, 0, 0, 0, 0, 128)
		Stop
	}
}

Actor HeartOfYorickBallHealth : CustomInventory
{
	Inventory.MaxAmount 0
	+INVENTORY.AUTOACTIVATE
	States
	{
	Use:
		TNT1 A 0 ACS_NamedExecuteAlways("WOC Area Heal",0,ACS_NamedExecuteWithResult("WOC Player Scale", 4, WISDOM, 0, ACTIVATOR), 512, ACTIVATOR)
		Stop
	}
}

Actor HeartOfYorickBloodBallTrail
{
	Radius 1
	Height 1
	+NoGravity
	+NoClip
	Renderstyle Add
	Scale 2.0
	States
	{
	Spawn:
		BSFX A 0
		BSFX A 0 A_Jump(192, 2, 3, 4, 5)
		BSFX B 1 A_FadeOut(0.05)
		Wait
		BSFX C 1 A_FadeOut(0.05)
		Wait
		BSFX D 1 A_FadeOut(0.05)
		Wait
		BSFX E 1 A_FadeOut(0.05)
		Wait
		BSFX F 1 A_FadeOut(0.05)
		Wait
	}
}

Actor HeartOfYorickBloodBallDeath
{
	Radius 1
	Height 1
	+NoGravity
	+NoClip
	RenderStyle Add
	Alpha 0.8
	States
	{
	Spawn:
		BSBL GHIJKL 3 Bright
		BSBL L 2 Bright A_FadeOut(0.05)
		Goto Spawn+6
	}
}

ACTOR BeatCheck : Inventory
{
    Inventory.Amount 1
    Inventory.MaxAmount 75
}