Actor RavenStaff : Weapon
{
	+PRIMARY_USES_BOTH
	+ALT_AMMO_OPTIONAL
	Weapon.KickBack 100
	+UNDROPPABLE
	Inventory.PickupMessage "RAVEN STAFF"
	Obituary "%o was pecked down by %k's Raven Staff"
	Weapon.AmmoType1 "Mana1"
	Weapon.AmmoType2 "Mana2"
	Weapon.AmmoGive1 0
	Weapon.AmmoGive2 0
	Weapon.AmmoUse1 6
	Weapon.AmmoUse2 6
	Weapon.SelectionOrder 5
	Tag "Raven Staff"
	Weapon.BobStyle InverseSmooth
	Weapon.BobSpeed 2.1
	Weapon.BobRangeY 0.4
	Weapon.BobRangeX 0.5
	States
	{
	Spawn:
		RVNS A -1
		Loop
	Select:
		RVNS B 1 A_Raise
		TNT1 A 0 A_Raise
		Loop
	Deselect:
		RVNS B 1 A_Lower
		TNT1 A 0 A_Lower
		Loop
	Ready:
		RVNS B 1 A_WeaponReady
		loop
	Fire:
		RVNS B 0 A_PlayWeaponSound("Weapons/RavenStaff/Fire11")
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), -35, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), -45, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), -55, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), 35, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), 45, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), 55, 128)
		RVNS B 0 A_FireCustomMissile("RavenMissile", 0, 1)
		RVNS B 0 A_FireCustomMissile("RavenMissile", 4, 0)
		RVNS B 0 A_FireCustomMissile("RavenMissile", -4, 0)
		RVNS B 0 A_FireCustomMissile("RavenMissile", -8, 0)
		RVNS B 1 Offset(-2, 35) A_FireCustomMissile("RavenMissile", 8, 0)
		RVNS B 1 Offset(-1, 47) A_SetPitch(Pitch-3)
		RVNS B 1 Offset(1, 48) A_SetPitch(Pitch+1)
		RVNS B 1 Offset(-2, 49) A_SetPitch(Pitch+1)
		RVNS B 1 Offset(-1, 50) A_SetPitch(Pitch+1)
		RVNS B 1 Offset(1, 49)
		RVNS B 1 Offset(2, 48)
		RVNS B 1 Offset(1, 47)
		RVNS B 1 Offset(-1, 46)
		RVNS B 1 Offset(-2, 45)
		RVNS B 1 Offset(1, 44)
		RVNS B 1 Offset(2, 43)
		RVNS B 1 Offset(-1, 42)
		RVNS B 1 Offset(-2, 41)
		RVNS B 1 Offset(1, 40)
		RVNS B 1 Offset(-1, 39)
		RVNS B 1 Offset(2, 37)
		RVNS B 1 Offset(1, 36)
		RVNS B 1 Offset(-2, 35)
		RVNS B 1 Offset(-1, 34)
		RVNS B 1 Offset(0, 33)
		Goto Ready
	Altfire:
		MSTF H 0 A_JumpIfInventory("Mana1", 16, 1)
		Goto Ready
		MSTF H 0 A_JumpIfInventory("Mana2", 16, 1)
		Goto Ready
		RVNS B 0 A_PlayWeaponSound("NecromancerRavenStaffAltFire")
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), -35, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), -45, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), -55, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), 35, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), 45, 128)
		RVNS B 0 A_SpawnItemEx("RavenSmoke", 6, 0, frandom(31, 33), 2, 0, frandom(-0.5, 0.5), 55, 128)
		RVNS B 0 A_FireCustomMissile("PoweredRavenMissile", frandom(-12, 12), 0, 0, 0, 0, frandom(-4, 6))
		RVNS B 0 A_FireCustomMissile("PoweredRavenMissile", frandom(-12, 12), 0, 0, 0, 0, frandom(-4, 6))
		RVNS B 0 A_FireCustomMissile("PoweredRavenMissile", frandom(-12, 12), 0, 0, 0, 0, frandom(-4, 6))
		RVNS B 0 Bright A_TakeInventory("Mana1", 16, TIF_NOTAKEINFINITE)
		RVNS B 0 Bright A_TakeInventory("Mana2", 16, TIF_NOTAKEINFINITE)
		RVNS B 1 Offset(-2, 35) A_FireCustomMissile("PoweredRavenMissile", frandom(-12, 12), 0, 0, 0, 0, frandom(-4, 6))
		RVNS B 1 Offset(-1, 47) A_SetPitch(Pitch-3)
		RVNS B 1 Offset(1, 48) A_SetPitch(Pitch+1)
		RVNS B 1 Offset(-2, 49) A_SetPitch(Pitch+1)
		RVNS B 1 Offset(-1, 50) A_SetPitch(Pitch+1)
		RVNS B 1 Offset(1, 49)
		RVNS B 1 Offset(2, 48)
		RVNS B 1 Offset(1, 47)
		RVNS B 1 Offset(-1, 46)
		RVNS B 1 Offset(-2, 45)
		RVNS B 1 Offset(-1, 45)
		RVNS B 1 Offset(1, 44)
		RVNS B 1 Offset(2, 43)
		RVNS B 1 Offset(1, 43)
		RVNS B 1 Offset(-1, 42)
		RVNS B 1 Offset(-2, 41)
		RVNS B 1 Offset(1, 40)
		RVNS B 1 Offset(-1, 39)
		RVNS B 1 Offset(-2, 39)
		RVNS B 1 Offset(1, 38)
		RVNS B 1 Offset(2, 37)
		RVNS B 1 Offset(1, 36)
		RVNS B 1 Offset(-2, 35)
		RVNS B 1 Offset(-1, 34)
		RVNS B 3 Offset(0, 33)
		Goto Ready
	}
}


Actor RavenMissile
{
	Radius 11
	Height 8
	Scale 0.75
	Speed 30
	Damage (ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(30,50), INTELLECT, 0, WOCTARGET))
	Damagetype "Physical"
	Projectile
	+ThruGhost
	+WINDTHRUST
	+MTHRUSPECIES +NODAMAGETHRUST +DONTBLAST
	SeeSound "Weapons/RavenStaff/Fire12"
	DeathSound "Weapons/RavenStaff/Hit"
	Decal MummyScorch
	States
	{
	Spawn:
		RVNP AABBCCDD 1 A_SpawnItemEx("RavenTrail", 0, frandom(-2, 2), frandom(-2, 2), 0, 0, 0, 0, 128)
		Loop
	Death:
		RVNP E 0 Bright A_SetTranslucent(1, 1)
		RVNP EFGHIJKLMN 3 Bright
		Stop
	}
}

Actor PoweredRavenMissile : RavenMissile
{
	Radius 11
	Height 8
	Speed 22
	Damage (0)//(Random(1,2)+(ACS_ExecuteWithResult(WOC_DECORATE,STATS,INTELLECT,WOCTARGET)-10)/20)
	Damagetype "Shadow"
	Projectile
	+SeekerMissile
	+Ripper
	-BloodSplatter
	+BloodlessImpact
	+HexenBounce
	-ALLOWBOUNCEONACTORS
	-BOUNCEONACTORS
	+CanBounceWater
	-ThruGhost
	-WINDTHRUST
	+NODAMAGETHRUST +DONTBLAST
	//BounceCount 15
	+FORCERADIUSDMG
	BounceFactor 1.0
	RenderStyle Translucent
	SeeSound ""
	Alpha 0.85
	ReactionTime 16
	States
	{
	Spawn:
		RVSR A 0 Bright
		RVSR A 0 A_PlaySound("NecromancerRavenStaffAltScream", 4, 0.5)
		RVSR A 0 Bright A_Jump(256, "Spawn1", "Spawn2", "Spawn3", "Spawn4")
	Spawn1: //This is just to randomize what frame they start on
		RVSR AA 1 Bright A_SpawnItemEx("CrowTrailA")
	Spawn2:
		RVSR BB 1 Bright A_SpawnItemEx("CrowTrailB")
	Spawn3:
		RVSR CC 1 Bright A_SpawnItemEx("CrowTrailC")
	Spawn4:
		RVSR DD 1 Bright A_SpawnItemEx("CrowTrailD")
	Idle:
		RVSR A 0 Bright A_SpawnItemEx("CrowTrailA")
		RVSR A 0 Bright A_ChangeFlag("PAINLESS", Random(0,4)/4)
		RVSR A 1 Bright A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(2,3), INTELLECT, 0, WOCTARGET),64,0,0,64) // | SMF_PRECISE)
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		RVSR A 1 Bright A_SpawnItemEx("CrowTrailA")
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		TNT1 A 0 Bright A_SeekerMissile(60, 85, SMF_LOOK | SMF_PRECISE, 256)
		RVSR B 1 Bright A_SpawnItemEx("CrowTrailB")
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		RVSR B 1 Bright A_SpawnItemEx("CrowTrailB")
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		TNT1 A 0 Bright A_SeekerMissile(60, 85, SMF_LOOK | SMF_PRECISE, 256)
		RVSR C 0 Bright A_SpawnItemEx("CrowTrailC")
		RVSR C 0 Bright A_ChangeFlag("PAINLESS", Random(0,4)/4)
		RVSR C 1 Bright A_Explode(ACS_NamedExecuteWithResult("WOC Player Scale", FRandom(2,3), INTELLECT, 0, WOCTARGET),64,0,0,64)
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		RVSR C 1 Bright A_SpawnItemEx("CrowTrailC")
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		TNT1 A 0 Bright A_SeekerMissile(60, 85, SMF_LOOK | SMF_PRECISE, 256)
		RVSR D 1 Bright A_SpawnItemEx("CrowTrailD")
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		RVSR D 1 Bright A_SpawnItemEx("CrowTrailD")
		TNT1 A 0 Bright A_SpawnItemEx("RavenFeather", 0, 0, 0, 0, 0, 0, 0, 128, 32)
		TNT1 A 0 Bright A_SeekerMissile(60, 85, SMF_LOOK | SMF_PRECISE, 256)
		TNT1 A 0 Bright A_Countdown
		Loop
	Death:
		TNT1 A 0 A_Stop
		TNT1 A 0 A_SetTranslucent(1,1)
		TNT1 A 0 A_PlaySound("Weapons/RavenStaff/RavenDeath")
		TNT1 A 0 A_SpawnItemEx("RavenFeather", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenFeather", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenFeather", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenFeather", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenFeather", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenSmoke", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenSmoke", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenSmoke", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 0 A_SpawnItemEx("RavenSmoke", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		TNT1 A 1 A_SpawnItemEx("RavenSmoke", 0, 0, 0, frandom(1, 2), 0, frandom(1, 2), frandom(0, 360), 128)
		Stop
	}
}

ACTOR CrowTrailA
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	Alpha 0.8
	States
	{
	Spawn:
		RVSR A 1 A_FadeOut(0.2)
		Loop
	}
}

ACTOR CrowTrailB : CrowTrailA
{
	States
	{
	Spawn:
		RVSR B 1 A_FadeOut(0.2)
		Loop
	}
}

ACTOR CrowTrailC : CrowTrailA
{
	States
	{
	Spawn:
		RVSR C 1 A_FadeOut(0.2)
		Loop
	}
}

ACTOR CrowTrailD : CrowTrailA
{
	States
	{
	Spawn:
		RVSR D 1 A_FadeOut(0.2)
		Loop
	}
}