ACTOR ImpalerCrossbow : Weapon
{
	obituary "%o was skewered by %k's Impaler Crossbow."
	radius 20
	height 16
	inventory.pickupmessage "IMPALER CROSSBOW"
	weapon.selectionorder 1
	weapon.ammotype1 "Mana1"
	Weapon.KickBack 100
	weapon.ammouse1 2
	Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType2 "Mana1"
	Weapon.AmmoUse2 5
	Tag "Impaler Crossbow"
	+UNDROPPABLE
	Weapon.BobStyle InverseSmooth
	Weapon.BobSpeed 2.1
	Weapon.BobRangeY 0.4
	Weapon.BobRangeX 0.5
	States
	{
	Spawn:
		IBOW Z -1
		Stop
	Select:
		IBOW A 1 A_Raise
		TNT1 A 0 A_Raise
		Loop
	Deselect:
		IBOW A 1 A_Lower
		TNT1 A 0 A_Lower
		Loop
	Ready:
		IBOW A 0 A_JumpIfInventory("IsKicking",1,"Kicking")
		IBOW A 1 A_WeaponReady
		Loop
	Fire:
		IBOW B 0 A_GiveInventory("ShadowWalkAttackCheck")
		IBOW B 0 A_PlayWeaponSound("AssassinCrossBowFire")
		IBOW B 0 A_FireCustomMissile("ImpalerMissile",frandom(-1,1),0,0,0,0,frandom(-0.7,0.7))
		IBOW B 0 A_FireCustomMissile("ImpalerMissile",frandom(-1,1),0,0,0,0,frandom(-0.7,0.7))
		IBOW B 1 Offset(0, 50) A_FireCustomMissile("ImpalerMissile",frandom(-1,1),1,0,0,0,frandom(-0.7,0.7))
		IBOW B 1 Offset(0, 49) A_SetPitch(Pitch-.5)
		IBOW B 1 Offset(0, 47) A_SetPitch(Pitch+.125)
		IBOW B 1 Offset(0, 46) A_SetPitch(Pitch+.125)
		IBOW B 1 Offset(0, 45) A_SetPitch(Pitch+.125)
		IBOW B 1 Offset(0, 44) A_SetPitch(Pitch+.125)
		IBOW C 1 Offset(0, 43) A_PlaySound("impalerxbow/load")
		IBOW C 1 Offset(0, 43)
		IBOW C 1 Offset(0, 42)
		IBOW C 1 Offset(0, 41)
		IBOW C 1 Offset(0, 40)
		IBOW C 1 Offset(0, 39)
		IBOW D 1 Offset(0, 38)
		IBOW D 1 Offset(0, 37)
		IBOW D 1 Offset(0, 36)
		IBOW D 1 Offset(0, 35)
		IBOW E 1 Offset(0, 34)
		IBOW E 2 Offset(0, 33)
		IBOW F 2
		IBOW A 8
		Goto Ready
	AltFire:
		IBOW B 0 A_GiveInventory("ShadowWalkAttackCheck")
		IBOW B 0 A_PlayWeaponSound("AssassinCrossBowFire2")
		IBOW B 1 Offset(0, 50) A_FireCustomMissile("ImpalerDarknessBolt")
		IBOW B 1 Offset(0, 49) A_SetPitch(Pitch-.5)
		IBOW B 1 Offset(0, 47) A_SetPitch(Pitch+.125)
		IBOW B 1 Offset(0, 46) A_SetPitch(Pitch+.125)
		IBOW B 1 Offset(0, 45) A_SetPitch(Pitch+.125)
		IBOW B 1 Offset(0, 44) A_SetPitch(Pitch+.125)
		IBOW C 1 Offset(0, 43) A_PlaySound("impalerxbow/load")
		IBOW C 1 Offset(0, 43)
		IBOW C 1 Offset(0, 42)
		IBOW C 1 Offset(0, 41)
		IBOW C 1 Offset(0, 40)
		IBOW C 1 Offset(0, 39)
		IBOW D 1 Offset(0, 38)
		IBOW D 1 Offset(0, 37)
		IBOW D 1 Offset(0, 36)
		IBOW D 1 Offset(0, 35)
		IBOW E 1 Offset(0, 34)
		IBOW E 2 Offset(0, 33)
		IBOW F 2
		IBOW A 12
		Goto Ready
		
	Kicking:
		IBOW A 1 offset(-1,40)
		IBOW A 1 offset(-1,50)
		IBOW A 1 offset(-1,60)
		IBOW A 0 offset(-1,33)
		AKCK A 2
		AKCK B 2
		AKCK B 0 A_GiveInventory("ShadowWalkAttackCheck")
		AKCK C 3 A_FireBullets(0,0,1,ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(20,35), STRENGTH, ABIL_KICK, ACTIVATOR), "KickPuff", FBF_NORANDOM, 96)
		AKCK D 4
		TNT1 A 6
		IBOW A 1 offset(-1,60)
		IBOW A 1 offset(-1,50)
		IBOW A 1 offset(-1,40)
		IBOW A 0 A_TakeInventory("IsKicking",2)
		Goto Ready
	}	
}

ACTOR ImpalerMissile : FastProjectile
{
	PROJECTILE
	+THRUGHOST
	+BLOODSPLATTER
	+WINDTHRUST
	+DONTBLAST
	+MTHRUSPECIES
	Radius 4
	Height 4
	Damage (ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(17,37), AGILITY, 0, WOCTARGET))
	Speed 130
	Damagetype "Physical"
	DeathSound "AssassinCrossbowHit"
	States
	{
	Spawn:
		ARWI A 1 A_SpawnItemEx("ImpalerMissileTrail", -(MomX/1.2), -(MomY/1.2), (MomZ/1.2*-1), (MomX/1.5), (MomY/1.5), (MomZ/1.5), 0, 138)
		Loop
	Death:
	Crash:
		NAIL D 2 Bright A_SetTranslucent(1.0, 1)
		NAIL EFGHI 2 Bright A_Fadeout(0.125)
		stop
	XDeath:
		TNT1 A 1
		Stop
	}
}

Actor ImpalerMissileTrail
{
	Radius 4
	Height 4
	-SOLID
	+NOBLOCKMAP
	RenderStyle Add
	Alpha 0.5
	+PAINLESS
	+CLIENTSIDEONLY
	+NOGRAVITY
	+NOTELEPORT
	+NOINTERACTION
	States
	{
	Spawn:
		ARWI A 1 A_FadeOut(0.1)
		Loop
	}
}

ACTOR ImpalerMissileExplosive : FastProjectile
{
	PROJECTILE
	+THRUGHOST
	+BLOODSPLATTER
	+WINDTHRUST
	+DONTBLAST
	+MTHRUSPECIES
	Radius 4
	Height 4
	Damage 0
	Speed 130
	Damagetype "Fire"
	DeathSound "AssassinCrossbowHit2"
	States
	{
	Spawn:
		ARWE A 1
		Loop
	Death:
		CFCF Q 0 A_SetTranslucent(1,1)
		CFCF Q 0 Bright A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", 96, AGILITY, 0, WOCTARGET), 96, 0)
		CFCF Q 1 Bright A_NoGravity
		CFCF Q 0 A_GiveToTarget("ScreenPitch2")
		CFCF Q 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF Q 0 A_GiveToTarget("ScreenPitch1Back")
		CFCF Q 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF Q 0 A_GiveToTarget("ScreenPitch1Back")
		CFCF Q 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF R 0 Bright A_Scream
		CFCF RRR 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF SSSS 1 Bright A_SpawnItemEx("FlailPuffParticleFXSpawner")
		CFCF T 3 Bright
		CFCF U 4 Bright
		CFCF W 3 Bright
		CFCF X 4 Bright
		CFCF Z 3 Bright
		Stop
	}
}

Actor ImpalerDarknessBolt : FastProjectile
{
	PROJECTILE
	+DONTBLAST
	+MTHRUSPECIES
	+NODAMAGETHRUST
	Radius 6
	Height 6
	//Damage (ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(17,37), AGILITY, 0, WOCTARGET))
	Speed 80
	Damagetype "Shadow"
	Renderstyle Translucent
	DeathSound "AssassinCrossBowHit2"
	MissileType "ImpalerDarknessBoltTrail"
	MissileHeight 8
	Scale 0.1
	States
	{
	Spawn:
		VORY A 0
		VORY AABBCCDD 1 Bright //A_SpawnItemEx("ImpalerDarknessBoltTrail")
		Loop
	Death:
		TNT1 A 0 A_SpawnItemEx("ImpalerDarknessBoltImpact")
		TNT1 AAAAAAAAA 2 A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", 13, AGILITY, 0, WOCTARGET), 32, 0, 0, 6)
		//VORY ABCDEFGHIJKLMNOPQRS 2 Bright A_FadeOut(0.05)
		Stop
	}
}

ACTOR ImpalerDarknessBoltImpact
{
	Radius 4
	Height 4
	PROJECTILE
	+FORCEXYBILLBOARD
	+EXTREMEDEATH
	+DOOMBOUNCE
	+NOINTERACTION
	+CLIENTSIDEONLY +DONTBLAST
	RenderStyle Translucent
	Scale 0.2
	DeathSound "weapons/firex2"
	States
	{
	Spawn:
		VORY ABCDEFGHIJKLMNOPQRS 2 Bright A_FadeOut(0.05)
		Stop
	}
}

ACTOR ImpalerDarknessBoltTrail
{
	Radius 4
	Height 4
	PROJECTILE
	+FORCEXYBILLBOARD
	+EXTREMEDEATH
	+DOOMBOUNCE
	+NOINTERACTION
	+CLIENTSIDEONLY +DONTBLAST
	RenderStyle Add
	Scale 0.1
	DeathSound "weapons/firex2"
	States
	{
	Spawn:
		VORY AABBCCDD 1 Bright A_Fadeout(0.1)
		loop
	}
}
