Actor LightningRod : Weapon
{
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Weapon.SlotNumber 2
Inventory.PickupMessage "Picked up the Lightning Rod"
Obituary "%o was electrocuted."
States
	{
	Ready:
		TNT1 A 0
		DSPS A 1 A_WeaponReady
		Loop
	Select:
		DSPS A 1 A_Raise
		Loop
	Deselect:
		DSPS A 1 A_Lower
		Loop
	Fire:
		DSPS A 2
		DSPS A 2 A_StartSound("DsparilStaff/Charge",CHAN_WEAPON,CHANF_OVERLAP)
		DSPS BCD 1
		DSPS E 2 A_GunFlash
		TNT1 A 0 A_StartSound("DsparilStaff/Fire",CHAN_WEAPON)
		DSPS F 2 A_FireBullets(0,0,1,5,"ElectricPuff",0)
		DSPS G 1 A_DamageSelf(1)
		DSPS H 1
		DSPS JA 1
		TNT1 A 0 A_Refire
		Goto Ready
	Flash:
		TNT1 A 3 A_Light1
		TNT1 A 4 A_Light2
		TNT1 A 2 A_Light1
		Goto LightDone
	Spawn:
		DSTF A -1
		Stop
	}
}

Actor ElectricPuff : BulletPuff
{
	+PUFFONACTORS
	States
	{
	Spawn:
		DFX1 K 4 Bright
	Melee:
		DFX1 LMNOPQRS 2 Bright
		Stop
	XDeath:
		DFX1 K 4 Bright
		DFX1 LMNOPQRS 2 Bright
		Stop
	}
}

Actor WandOfEmbers : Weapon
{
	Inventory.PickupSound "Misc/W_PkUp"
	Inventory.PickupMessage "Picked up the Wand of Embers."
	Obituary "%o couldn't stand the heat."
	Weapon.SlotNumber 3
	Weapon.AmmoGive 0
	Weapon.AmmoUse 0
	+FLOATBOB
	+NOGRAVITY
	States
	{
	Spawn:
		WEMB A -1
		Loop
	Select:
		WEMB B 1 A_Raise
		Loop
	Deselect:
		WEMB B 1 A_Lower
		Loop
	Ready:
		WEMB B 1 A_WeaponReady
		Loop
	Fire:
		WEMB C 0 A_PlaySoundEx("Weapons/WandOfEmbers/Open", "SoundSlot6", 0)
		WEMB E 2 Bright
	Hold:
		WEMB E 0 A_PlayWeaponSound("Weapons/WandOfEmbers/Fire")
		WEMB F 0 A_FireProjectile("WandOfEmbersBall", Random(-5, -3), false, 0, 0, 0, Random(-2, 2))
		WEMB F 0 A_FireProjectile("WandOfEmbersBall", Random(5, 3), false, 0, 0, 0, Random(-2, 2))
		WEMB F 0 A_FireProjectile("WandOfEmbersBall", Random(-3, 3), false, 0, 0, 0, Random(1, 3))
		WEMB F 0 A_FireProjectile("WandOfEmbersBall", Random(-3, 3), false, 0, 0, 0, Random(-3, -1))
		WEMB F 0 A_FireProjectile("WandOfEmbersBall", 0, false)
		WEMB F 5 Bright A_DamageSelf(5)
		WEMB G 5 Bright
		WEMB D 6
		WEMB C 5 A_ReFire
		WEMB B 6
		Goto Ready
	}
}

Actor WandOfEmbersBall
{
	Radius 4
	Height 4
	Speed 24
	Damage (random(1,3) * 5)
	RenderStyle Add
	Alpha 0.75
	Scale 0.75
	Projectile
	+NoGravity
	-BloodSplatter
	+BloodlessImpact
	DeathSound "Weapons/WandOfEmbers/Hit1"
	Decal EmberWandScorch
	States
	{
	Spawn:
		WEMP AABBB 1 Bright A_SpawnItemEx("WandOfEmbersTrail", 0, 0, 0, 0, 0, 0, 0, 128)
		Loop
	Death:
		WEMP CDEFG 3 Bright
		Stop
	}
}

Actor WandOfEmbersTrail
{   
	Radius 2
	Height 2
	Damage 0
	Scale 0.75
	Projectile
	-BloodSplatter
	+BloodlessImpact
	RenderStyle Add
	Alpha 0.5
	States
	{
	Spawn:
		TNT1 A 2
		WEMP HIJ 3 Bright
		Stop 
	}
}

ACTOR JadeWand : Weapon
{
	Inventory.PickupMessage "You found the Jade Wand!"
	Obituary "%k drowned in a river of jade."
	Weapon.AmmoGive 0
	Weapon.SlotNumber 4
	Weapon.AmmoUse 0
	AttackSound "weapons/jadefire"
	+FLOATBOB
	+NOGRAVITY
	States
	{
	Spawn:
		JADE C -1 Bright
		Loop
	Ready:
		JADE A 1 A_WeaponReady
		Loop
	Deselect:
		JADE A 1 A_Lower
		Loop
	Select:
		JADE A 1 A_Raise
		Loop
	Fire:
		JADE A 1 Bright
		JADE B 0 A_PlaySoundEx("weapons/jadefire","auto")
		JADE B 2 Bright A_FireProjectile("JadeShot",frandom(-2.0,2.0),false,0,0,0,frandom(-2.0,2.0))
		JADE B 1 A_DamageSelf(1)
		Jade A 1
		JADE A 0 A_Refire
		Goto Ready
	}
}

ACTOR JadeShot
{
   Radius 5
   Height 5
   Speed 60
   Damage (random(1,3) * 10)
   // Scale .75
   Alpha .5
   PROJECTILE
   +RIPPER
   +NoGravity
   RENDERSTYLE Normal
   SeeSound "weapons/jadefire"
   DeathSound "weapons/jadehit"
   States
   {
   Spawn:
      IDEX A 1 Bright
	  IDEX A 0 A_PlaySoundEx("weapons/jadefire","auto")
      IDEX B 0 A_SpawnItemEx("JadeTrail",0,0,0,0,0,0,0,8)
      Loop
   Death:
      IDEX B 0 A_SpawnItemEx("JadeLightSpawner")
      IDEX B 0 A_SpawnItemEx("JadeLightSpawner")
      IDEX B 0 A_SpawnItemEx("JadeLightSpawner")
      IDEX B 0 A_SpawnItemEx("JadeLightSpawner")
	  IDEX B 0 A_SpawnItemEx("JadeLightSpawner")
      Stop
   }
}

ACTOR JadeTrail
{   
   Radius 0
   Height 1
   Damage 0
   Speed 0
   Scale 0.5
   PROJECTILE
   RENDERSTYLE ADD
   ALPHA 0.50
   States
   {
   Spawn:
      BONE IJKLMNOP 2 Bright
      Stop 
   }
}

actor JadeLightSpawner
{
	+NoBlockMap +NoGravity +NoSector +NoInteraction +NoClip -Solid +CLIENTSIDEONLY
	states
	{
	Spawn:
	   Active:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(Args[1], "Circle")
		TNT1 A 2
		TNT1 A 0 A_SpawnItemEx ("JadeTrail", random(-Args[0], Args[0]), random(-Args[0], Args[0]), random(0, 8), (0.1)*Random(1, 3), 0, (0.1)*Random(1, 10), random(0,360), 129, Args[2])
			TNT1 A 0 A_SpawnItemEx ("JadeTrail", random(-Args[0], Args[0]), random(-Args[0], Args[0]), random(0, 8), (0.1)*Random(1, 3), 0, (0.1)*Random(1, 10), random(0,360), 129, Args[2]) 
		Stop
	   Circle:
		TNT1 A 0
		TNT1 A 2 A_SpawnItemEx ("JadeTrail", random(-Args[0], Args[0]), 0, random(0, 8), (0.1)*Random(1, 3), 0, (0.1)*Random(1, 10), Random(0, 360), 129, Args[2]) 
		Loop
	   Inactive:
	TNT1 A 1
	Loop
	}     
}
