//SWORD STUFF

//=====================================================
//=====================================================
//BOOMERANG
//=====================================================
//=====================================================

actor NormalBoomerang
{
	+notimefreeze
	+skyexplode
	+forcepain
	projectile
	+thruspecies
	+HITTRACER
	+bright
	species "Player"
	DamageType "CALinked"
	+FORCEXYBILLBOARD
	+dontreflect
	radius 10
	height 8
	damage (1)
	speed 30
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_playsound ("PastLinked/Boomerang",8,1,1,1.20)
		BMRG ABCDEF 1 
		BMRG ABCDEF 1 
		BMRG ABCDEF 1 
		TNT1 A 0 a_scalevelocity (0.50)
		BMRG ABCDEF 1 
		BMRG ABCDEF 1
		BMRG ABCDEF 1
		TNT1 A 0 a_stop
		goto flyback
	flyback:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("boomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop	
	death:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_playsound ("subweapons/miss")
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("BoomerangFlyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	xdeath:	
		TNT1 A 0 a_stop
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_changeflag ("nogravity", 1)
		TNT1 A 0 a_playsound ("PastLinked/Hitsound")
		TNT1 A 0 a_giveinventory ("BoomerangStun",1,AAPTR_TRACER)
		//TNT1 A 0 a_radiusgive ("BoomerangStun",80,RGF_MONSTERS)
		TNT1 A 1 a_custommissile ("BoomerangFlyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("boomerangflyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	catch:
		TNT1 A 0
        TNT1 A 0 A_TakeFromTarget ("BoomerangCooldown", 999)
		TNT1 A 0 a_stopsound (8)
        TNT1 A 1 
		stop
	}
}

actor boomerangflyback : NormalBoomerang
{
    -SOLID
    +NOCLIP
    +notimefreeze
	+SEEINVISIBLE
	speed 30
	reactiontime 3
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_playsound ("PastLinked/Boomerang",8,1,0,1.20)
		BMRG A 1 bright A_JumpIfCloser (50,"catch")
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		BMRG B 1 bright A_JumpIfCloser (50,"catch")
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		BMRG C 1 bright A_JumpIfCloser (50,"catch")
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		BMRG D 1 bright A_JumpIfCloser (50,"catch")
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		BMRG E 1 bright A_JumpIfCloser (50,"catch")
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		BMRG F 1 bright A_JumpIfCloser (50,"catch")
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_countdown
		TNT1 A 0 a_stopsound (8)
		TNT1 A 1 a_custommissile ("boomerangflyback",0,0,0,CMF_TRACKOWNER)
		stop
	death:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_custommissile ("boomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_custommissile ("boomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop
	}
}


actor BoomerangDamage
{
	projectile
    Radius 25
    Height 20
	scale 1
    Speed 0
	damage (0)
	DamageType "CALinked"
	+thruspecies
	+HITTRACER
	species "player"
	+DONTBLAST
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1
		stop
	death:
		TNT1 A 1
		stop
	Xdeath:
		TNT1 A 0
		TNT1 A 0 a_playsound ("PastLinked/HitSound")
		TNT1 A 0 a_giveinventory ("BoomerangStun",1,AAPTR_TRACER)
		//TNT1 A 0 a_radiusgive ("BoomerangStun",75,RGF_MONSTERS)
		TNT1 A 1
		stop
		
	}
}


actor BoomerangStun : custominventory
{
	+inventory.alwayspickup
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower(1,"death")
		TNT1 A 0 ACS_NamedExecuteAlways("BoomerangStunner")
		TNT1 A 0 a_jumpif(Z >= FloorZ+5,"SkyHit")
		TNT1 A 1 
		stop
	death:
		TNT1 A 0
		TNT1 A 1
		stop
	SkyHit:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 1 thrustthingz (0,25,1,0)
		stop
	}
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Magical Boomerang
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

actor MagicalBoomerang : NormalBoomerang
{
	speed 60
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_playsound ("PastLinked/Boomerang",8,1,1,1.20)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40) 
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)
		TNT1 A 0 a_scalevelocity (0.50)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40)	
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40) 	
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40) 	
		2MRG ABCDEF 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,40) 	
		TNT1 A 0 a_stop
		goto flyback
	flyback:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("MagicalBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop	
	death:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_playsound ("subweapons/miss")
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("MagicalBoomerangFlyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	xdeath:	
		TNT1 A 0 a_stop
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_changeflag ("nogravity", 1)
		TNT1 A 0 a_playsound ("PastLinked/Hitsound")
		TNT1 A 0 a_giveinventory ("BoomerangStun",1,AAPTR_TRACER)
		TNT1 AAAAAAAAAAAAA 0 A_SpawnItemEx("BoomerangParticle",frandom(-2,2),frandom(-2,2),frandom(-6,6),frandom(-7,7),frandom(-5,5),frandom(-4,4),0,SXF_NOCHECKPOSITION)
		TNT1 A 1 a_custommissile ("MagicalBoomerangFlyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("MagicalBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	catch:
		TNT1 A 0
        TNT1 A 0 A_TakeFromTarget ("BoomerangCooldown", 999)
		TNT1 A 0 a_stopsound (8)
        TNT1 A 1 a_playsound ("subweapons/boomerangcatch")
		stop
	}
}

actor MagicalBoomerangflyback : Boomerangflyback
{
	speed 60
	reactiontime 3
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_playsound ("PastLinked/Boomerang",8,1,0,1.20)
		2MRG A 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,10)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		2MRG B 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,10)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		2MRG C 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,10)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		2MRG D 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,10)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		2MRG E 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,10)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		2MRG F 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,10)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_countdown
		TNT1 A 0 a_stopsound (8)
		TNT1 A 1 a_custommissile ("MagicalBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		stop
	death:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_custommissile ("MagicalBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_custommissile ("MagicalBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop
	}
}




ACTOR BoomerangParticle
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+DONTBLAST
	+NOCLIP
	Renderstyle add
	Alpha 0.90
	Scale 1.5
	+clientsideonly
	Mass 5
	States
	{
	Spawn:
		BPKL A 3 Bright 
		BPKL B 3 Bright 
		BPKL A 3 Bright 
		BPKL B 4 Bright 
		BPKL C 4 Bright 
		goto death
	Death:
		TNT1 A 1
		stop
	}
}

ACTOR BoomerangParticle3 : BoomerangParticle
{
	states
	{
	Spawn:
		BPKL A 6 Bright 
		BPKL B 4 Bright 
		BPKL C 4 Bright
		TNT1 A 3
		TNT1 A 0 A_SpawnItemEx ("BoomerangParticle2", frandom(-8,8),frandom(-10,10),frandom(-10,10), 0,0,0, 0, SXF_NOCHECKPOSITION)
		Goto Death	
	}
}

ACTOR BoomerangParticle2 : BoomerangParticle
{
	states
	{
	Spawn:
		BPKL A 6 Bright 
		BPKL B 4 Bright 
		BPKL C 4 Bright
		TNT1 A 3
		TNT1 A 0 A_SpawnItemEx ("BoomerangParticle", frandom(-12,12),frandom(-15,15),frandom(-13,13), 0,0,0, 0, SXF_NOCHECKPOSITION)
		Goto Death	
	}
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Fire Boomerang
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

actor FireBoomerang : NormalBoomerang
{
	speed 60
	Damage (30)
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_playsound ("PastLinked/Boomerang",8,1,1,1.20)
		TNT1 A 0 a_playsound ("PastLinked/Candle",0)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION) 
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_scalevelocity (0.50)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION)	
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION) 	
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION) 	
		3MRG ABCDEF 1 A_SpawnItemEx("BigBoomerangFlame",frandom(-2,2),frandom(3,4),frandom(-8,-4),0,0,0,0,SXF_NOCHECKPOSITION) 	
		TNT1 A 0 a_stop
		goto flyback
	flyback:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("FireBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop	
	death:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_playsound ("subweapons/miss")
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("FireBoomerangFlyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	xdeath:	
		TNT1 A 0 a_stop
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_changeflag ("nogravity", 1)
		TNT1 A 0 a_playsound ("PastLinked/Hitsound")
		TNT1 A 0 a_giveinventory ("BoomerangStun",1,AAPTR_TRACER)
		TNT1 A 0 a_playsound ("PastLinked/Candle",0)
		TNT1 AAAA 0 A_SpawnItemEx ("MiniRedmagicflare", frandom(-30,30),frandom(-30,30),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 1 a_custommissile ("FireBoomerangFlyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_custommissile ("FireBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	catch:
		TNT1 A 0
        TNT1 A 0 A_TakeFromTarget ("BoomerangCooldown", 999)
		TNT1 A 0 a_stopsound (8)
        TNT1 A 1 a_playsound ("subweapons/boomerangcatch")
		stop
	}
}

actor FireBoomerangflyback : Boomerangflyback
{
	speed 60
	reactiontime 3
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_playsound ("PastLinked/Boomerang",8,1,0,1.20)
		3MRG A 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		3MRG B 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		3MRG C 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		3MRG D 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		3MRG E 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		3MRG F 1 bright A_JumpIfCloser (80,"catch")
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_spawnitemex ("BoomerangDamage",0,0,0,0,0,0,0,0,120)
		TNT1 A 0 A_FaceTarget
		TNT1 A 0 A_countdown
		TNT1 A 0 a_stopsound (8)
		TNT1 A 1 a_custommissile ("FireBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		stop
	death:
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_custommissile ("FireBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop
	crash:
		TNT1 A 0
		TNT1 A 0		
		TNT1 A 0 a_stopsound (8)
		TNT1 A 0 a_custommissile ("FireBoomerangflyback",0,0,0,CMF_TRACKOWNER)
		TNT1 A 1
		stop
	}
}


Actor BigBoomerangFlame
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+NOTELEPORT
	+bright
	renderstyle add
	Alpha 0.20
	yscale 1.20
	xScale 2.00
	Mass 5
	states
	{
	spawn:
		TNT1 A 0
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-16,16),frandom(-16,16),frandom(9,15),frandom(-1,1),frandom(-1,1),frandom(3,8))
		CFRE CD 1 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(12,15),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,200)
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-16,16),frandom(-16,16),frandom(9,15),frandom(-1,1),frandom(-1,1),frandom(3,8))
		goto death
	death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


//tokens

actor stuntimer : inventory
{inventory.maxamount 151}

actor BoomerangToken : inventory
{inventory.maxamount 1}

Actor BoomerangActive : Inventory
{inventory.maxamount 1}

actor BoomerangCooldown : inventory 
{inventory.maxamount 260}

ACTOR BoomerangReady : Powerup
{
  Powerup.Duration 4
}



//=====================================================
//=====================================================
//CANDLE
//=====================================================
//=====================================================


actor candlefire 
{
	+MBFBOUNCER
	+bright
	+thruspecies
	+thruactors
	+bounceonwalls
	WallBounceFactor 0.50
	radius 10
	gravity 0.40
	speed 10
	damage (0)
	scale 2.5
	reactiontime 30
	species "Player"
	DamageType "CALinked"
	+forceradiusdmg
	+NODAMAGETHRUST
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 a_jump (80,"Slowdown1")
		TNT1 A 0 a_jump (80,"Slowdown2")
		TNT1 A 0 a_jump (80,"Slowdown3")
		goto sliding
	Slowdown1:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.87)
		Goto sliding
	Slowdown2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.90)
		Goto sliding
	Slowdown3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.69) //Nice
		Goto sliding
	Sliding:
		CFRE A 1 a_explode (5,30,0,0,30)
		CFRE A 1
		CFRE A 1 A_SpawnItemEx("BlueFireEmber",frandom(-16,16),frandom(-16,16),frandom(18,25),frandom(-1,1),frandom(-1,1),frandom(3,8))
		CFRE B 1 
		CFRE B 1
		CFRE B 1 A_SpawnItemEx("BlueFireEmber",frandom(-16,16),frandom(-16,16),frandom(18,25),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		TNT1 AAAAAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-16,16),frandom(-16,16),frandom(18,25),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 1
		stop
	}
}

Actor RedCandleFire : CandleFire
{
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 a_jump (80,"Slowdown1")
		TNT1 A 0 a_jump (80,"Slowdown2")
		TNT1 A 0 a_jump (80,"Slowdown3")
		goto sliding
	Slowdown1:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.37)
		Goto sliding
	Slowdown2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.70)
		Goto sliding
	Slowdown3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.59)
		Goto sliding
	Sliding:
		CFRE C 1 a_explode (6,30,0,0,30)
		CFRE C 1 A_SpawnItemEx("RedFireEmber",frandom(-16,16),frandom(-16,16),frandom(18,25),frandom(-1,1),frandom(-1,1),frandom(3,8))
		CFRE D 1 
		CFRE D 1
		CFRE D 1 A_SpawnItemEx("RedFireEmber",frandom(-16,16),frandom(-16,16),frandom(18,25),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		TNT1 AAAAAA 0 A_SpawnItemEx("RedFireEmber",frandom(-16,16),frandom(-16,16),frandom(18,25),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 1
		stop
	}
}


Actor CandleLightTimer : Powerup
{
  Powerup.Duration -11
}

ACTOR MagicCandleLight : PowerupGiver
{
	+COUNTITEM
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	Inventory.MaxAmount 0
	Powerup.Type "Torch"
	Powerup.Duration -999
	//Inventory.PickupMessage "Light Amplification scope!"
	States
	{
	Spawn:
		LASC A 10 bright
		LASC A 10 
		Loop
	}
}

//Tokens

actor CandleActive : inventory
{inventory.maxamount 1}

actor CandleCooldown : inventory 
{inventory.maxamount 450}

ACTOR CandleReady : Powerup
{
  Powerup.Duration 4
}

ACTOR BlueFireEmber
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+NOTELEPORT
	Alpha 0.90
	Scale 0.80
	+clientsideonly
	Mass 5
	States
	{
	Spawn:
		FIP1 A 2 Bright A_FadeOut(0.1)
		FIP1 B 2 Bright A_FadeOut(0.1)
		FIP1 C 2 Bright A_FadeOut(0.1)
	fade:
		FIP1 D 2 Bright A_FadeOut(0.1)
		loop
	}
}

ACTOR BlueFireEmber2
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+NOTELEPORT
	renderstyle add
	alpha 0.99
	Scale 0.80
	+clientsideonly
	Mass 5
	States
	{
	Spawn:
		FIP1 D 2 Bright A_FadeOut(0.1)
		loop
	}
}

ACTOR BlueFireEmber3
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	+NOTELEPORT
	renderstyle add
	alpha 0.99
	Scale 0.80
	+clientsideonly
	Mass 5
	States
	{
	Spawn:
		CFRE A 2 Bright
		CFRE B 2 Bright 
		CFRE A 2 Bright
		CFRE B 2 Bright 
		FIP1 A 2 Bright A_FadeOut(0.1)
		FIP1 B 2 Bright A_FadeOut(0.1)
		FIP1 C 2 Bright A_FadeOut(0.1)
	fade:
		FIP1 D 2 Bright A_FadeOut(0.1)
		loop
	}
}

ACTOR RedFireEmber : BlueFireEmber
{
	States
	{
	Spawn:
		FIP2 A 2 Bright A_FadeOut(0.1)
		FIP2 B 2 Bright A_FadeOut(0.1)
		FIP2 C 2 Bright A_FadeOut(0.1)
	fade:
		FIP2 D 2 Bright A_FadeOut(0.1)
		loop
	}
}

ACTOR RedFireEmber2 : BlueFireEmber2
{
	States
	{
	Spawn:
		FIP2 D 2 Bright A_FadeOut(0.1)
		loop
	}
}

ACTOR RedFireEmber3 : BlueFireEmber3
{
	States
	{
	Spawn:
		CFRE C 2 Bright
		CFRE D 2 Bright 
		CFRE C 2 Bright
		CFRE D 2 Bright 
		FIP2 A 2 Bright A_FadeOut(0.1)
		FIP2 B 2 Bright A_FadeOut(0.1)
		FIP2 C 2 Bright A_FadeOut(0.1)
	fade:
		FIP2 D 2 Bright A_FadeOut(0.1)
		loop
	}
}



//=====================================================
//=====================================================
//BOMBS
//=====================================================
//=====================================================


actor LinkedBomb
{
	projectile
	+thruspecies
	+thruactors
	+bright
	+DONTBLAST
	+doombounce
	-nogravity
	radius 8
	height 8
	Bouncefactor 0
	WallBounceFactor 0.50
	gravity 0.90
	speed 25
	damage (0)
	scale 1
	species "Player"
	DamageType "CALinkedBomb"
	reactiontime 20
	+forceradiusdmg
	mass 188000
	states
	{
	spawn:
		TNT1 A 0
		LKB1 A 25
		TNT1 A 0 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		LKB1 B 3 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		LKB1 A 3 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		LKB1 B 3 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		LKB1 A 1 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		LKB1 B 1 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(12,13),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 A 0
		Goto death
	Death:
		TNT1 A 0 a_setscale (3)
		TNT1 A 0 a_changeflag ("NOGRAVITY",1)
		TNT1 A 0 a_stop
		LKB1 C 2
		TNT1 A 0 a_explode (180,140,0,0,140)
		TNT1 A 0 Radius_Quake (3,10,0,20,0)
		TNT1 A 0 a_radiusthrust (1200,25,RTF_NOIMPACTDAMAGE,25)
		TNT1 A 0 a_playsound ("PastLinked/BombExplode",0,1,0,0.80)
		LKB1 DEFGHIJKLM 1
		TNT1 A 4
		stop
	}
}

ACTOR LinkedBombSmoke
{
	+NOBLOCKMAP
	+NOGRAVITY
	+ALLOWPARTICLES
	+RANDOMIZE
	Alpha 0.90
	Scale 0.60
	+clientsideonly
	Mass 5
	States
	{
	Spawn:
		LDBK A 2 Bright A_FadeOut(0.1)
		LDBK B 2 Bright A_FadeOut(0.1)
		LDBK C 2 Bright A_FadeOut(0.1)
	fade:
		LDBK C 2 Bright A_FadeOut(0.1)
		loop
	}
}


//Tokens

actor BombBagActive : inventory
{inventory.maxamount 1}



//*************************************************************************************
//*************************************************************************************
//*************************************************************************************
//*************************************************************************************
//*************************************************************************************



//BOW STUFF




//=====================================================
//=====================================================
//LADDER ARROW (BOOMERANG)
//=====================================================
//=====================================================



actor LadderArrow : LinkedArrow
{
	Speed 35
	States
	{
	Spawn:
		LDRW A 1
		loop
	Death:
		STBE B 1
		TNT1 A 0 a_playsound ("Pastlinked/LadderArrowhit",0)
		STBE B 2 a_setscale (1.30,1.30)
		TNT1 A 0 A_JumpIf(floorz == z, "LadderUp")
		TNT1 A 0 A_checkceiling ("DropLadder")
		TNT1 A 0 A_spawnitemex("LadderDropper",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("LadderArrowTip",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		Stop
	LadderUp:
		TNT1 A 0
		TNT1 A 1 A_spawnitemex("LadderArrowTip",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		stop
	DropLadder:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("LadderDropper",0,0,-40,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("LadderArrowTip",0,0,-50,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 1
		stop
	xdeath:
		STBE B 1
		TNT1 A 0 A_PlaySound("PastLinked/Hitsound", CHAN_AUTO)
		TNT1 A 0 a_playsound ("Pastlinked/LadderArrowhit",0)
		TNT1 A 0 A_spawnitemex("WallBuilder",0,-2,0,0,-15,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("WallBuilder",0,2,0,0,15,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,6,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-6,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		STBE B 2 a_setscale (1.30,1.30)
		stop
	}
}


ACTOR LadderArrowTip
{
	Projectile
	Radius 6
	Height 20
	Damage (0)
	+thruactors
	+SKYEXPLODE
	+bright
	+DONTBLAST
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("LadderRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LHK1 A 1 A_ChangeVelocity(0,0,15,CVF_REPLACE)
		loop
	Death:
		TNT1 A 0
		LHK1 A 20
		LHK1 BCDE 3
		LHK1 E 250
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1	
		Stop
	}
}

Actor LadderDropper : LadderArrowTip
{
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("LadderRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN1 A 1 A_ChangeVelocity(0,0,-15,CVF_REPLACE)
		loop
	Death:
		TNT1 A 0
		LRN1 A 20
		LRN1 BCDE 3
		LRN1 E 250
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		stop
	}
}
	

Actor LadderRung : SwitchableDecoration
{
	Height 12
	Radius 18
	Activation THINGSPEC_Switch|THINGSPEC_ThingTargets
	+NOGRAVITY
	+DONTBLAST
	+bright
	-SOLID
	-USESPECIAL 
	reactiontime 300
	States
	{
	Spawn:
		LRN1 A 20
		LRN1 BCDE 3
		TNT1 A 0 a_changeflag ("USESPECIAL",1)
	Open:
		LRN1 E 1
		TNT1 A 0 a_countdown
		loop
	Active:
		TNT1 A 0
		TNT1 A 0 a_countdown
		LRN1 E 1 A_Giveinventory("ClimbVSpeed",1,AAPTR_TARGET)
		Goto open
	Inactive:
		TNT1 A 0
		TNT1 A 0 a_countdown
		LRN1 E 1 A_Giveinventory("ClimbVSpeed",1,AAPTR_TARGET)
		Goto open
	Death:
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		LDBK ABBCCC 1
		stop
	}
}

ACTOR ClimbVSpeed : Custominventory
{
	+INVENTORY.ALWAYSPICKUP 
	+INVENTORY.AUTOACTIVATE
	States
	{
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("PastLinked/LadderClimb")
		TNT1 A 0 A_ChangeVelocity(0,0,10,CVF_REPLACE)
		Stop
	}
}


//===============================================================
//WALL BUILDER
//===============================================================


Actor WallBuilder
{
	Projectile
	Radius 6
	Height 10
	Damage (0)
	+thruactors
	+SKYEXPLODE
	+DONTBLAST
	+bright
	States
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("VerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 a_stop
		goto death
	Death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


Actor VerticalWallBuilderUp : LadderDropper
{
	reactiontime 3
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("WallRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN1 A 1 A_ChangeVelocity(0,0,15,CVF_REPLACE)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		LRN1 A 20
		LRN1 BCDE 3
		LRN1 E 100
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		Stop
	}
}

Actor VerticalWallBuilderDown : LadderDropper
{
	reactiontime 3
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("WallRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN1 A 1 A_ChangeVelocity(0,0,-15,CVF_REPLACE)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		LRN1 A 20
		LRN1 BCDE 3
		LRN1 E 100
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		Stop
	}
}

Actor WallRung
{
	Height 12
	Radius 18
	+NOGRAVITY
	+bright
	+SOLID
	+thruspecies
	+shootable
	+DONTBLAST
	+invulnerable
	+noblooddecals
	health 99999
	species "Player"
	-USESPECIAL 
	Mass 999999999
	reactiontime 100
	States
	{
	Spawn:
		LRN1 A 20
		TNT1 A 0 a_playsound ("Pastlinked/Ladderbuild",6)
		LRN1 BCDE 3
	Open:
		LRN1 E 1
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_fall
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		stop		
	}
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//MAGICAL LADDER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



actor MagicalLadderArrow : LadderArrow 
{
	Speed 35
	States
	{
	Spawn:
		LDRW B 1 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,160)
		loop
	Death:
		STBE B 1
		TNT1 A 0 a_playsound ("Pastlinked/LadderArrowhit",0)
		STBE B 2 a_setscale (1.30,1.30)
		TNT1 A 0 A_JumpIf(floorz == z, "LadderUp")
		TNT1 A 0 A_checkceiling ("DropLadder")
		TNT1 A 0 A_spawnitemex("MagicalLadderDropper",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalLadderArrowTip",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		Stop
	LadderUp:
		TNT1 A 0
		TNT1 A 1 A_spawnitemex("MagicalLadderArrowTip",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		stop
	DropLadder:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("MagicalLadderDropper",0,0,-40,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalLadderArrowTip",0,0,-50,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 1
		stop
	xdeath:
		STBE B 1
		TNT1 A 0 A_PlaySound("PastLinked/Hitsound", CHAN_AUTO)
		TNT1 A 0 a_playsound ("Pastlinked/LadderArrowhit",0)
		TNT1 A 0 A_spawnitemex("MagicalWallBuilder",0,-2,0,0,-15,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalWallBuilder",0,2,0,0,15,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,6,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-6,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		STBE B 2 a_setscale (1.30,1.30)
		stop
	}
}


ACTOR MagicalLadderArrowTip
{
	Projectile
	Radius 6
	Height 20
	Damage (0)
	DamageType "CALinked"
	+thruactors
	+SKYEXPLODE
	+bright
	+DONTBLAST
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("MagicalLadderRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LHK2 A 1 A_ChangeVelocity(0,0,15,CVF_REPLACE)
		loop
	Death:
		TNT1 A 0
		LHK2 A 20
		LHK2 BCDE 3
		LHK2 E 500
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1	
		Stop
	}
}

Actor MagicalLadderDropper : LadderArrowTip
{
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("MagicalLadderRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN2 A 1 A_ChangeVelocity(0,0,-15,CVF_REPLACE)
		loop
	Death:
		TNT1 A 0
		LRN2 A 20
		LRN2 BCDE 3
		LRN2 E 500
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		stop
	}
}
	

Actor MagicalLadderRung : SwitchableDecoration
{
	Height 12
	Radius 18
	Activation THINGSPEC_Switch|THINGSPEC_ThingTargets
	+NOGRAVITY
	+DONTBLAST
	+bright
	+NOTARGET
	-SOLID
	-USESPECIAL 
	reactiontime 600
	States
	{
	Spawn:
		LRN2 A 20
		LRN2 BCDE 3
		TNT1 A 0 a_changeflag ("USESPECIAL",1)
	Open:
		LRN2 E 1 
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,240)
		TNT1 A 0 a_countdown
		loop
	Active:
		TNT1 A 0
		TNT1 A 0 a_countdown
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,240)
		LRN2 E 1 A_Giveinventory("ClimbVSpeed",1,AAPTR_TARGET)
		Goto open
	Inactive:
		TNT1 A 0
		TNT1 A 0 a_countdown
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,240)
		LRN2 E 1 A_Giveinventory("ClimbVSpeed",1,AAPTR_TARGET)
		Goto open
	Death:
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		LDBK ABBCCC 1
		stop
	}
}


//===============================================================
//WALL BUILDER
//===============================================================


Actor MagicalWallBuilder : WallBuilder
{
	States
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("MagicalVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 a_stop
		goto death
	Death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


Actor MagicalVerticalWallBuilderUp : LadderDropper
{
	reactiontime 3
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("MagicalWallRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN2 A 1 A_ChangeVelocity(0,0,15,CVF_REPLACE)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		LRN2 A 20
		LRN2 BCDE 3
		LRN2 E 150
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		Stop
	}
}

Actor MagicalVerticalWallBuilderDown : LadderDropper
{
	reactiontime 3
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("MagicalWallRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN2 A 1 A_ChangeVelocity(0,0,-15,CVF_REPLACE)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		LRN2 A 20
		LRN2 BCDE 3
		LRN2 E 150
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		Stop
	}
}

Actor MagicalWallRung
{
	Height 12
	Radius 18
	+NOGRAVITY
	+bright
	+SOLID
	+thruspecies
	+shootable
	+DONTBLAST
	+invulnerable
	+noblooddecals
	+NOTARGET
	health 99999
	species "Player"
	-USESPECIAL 
	Mass 999999999
	reactiontime 150
	States
	{
	Spawn:
		LRN2 A 20
		TNT1 A 0 a_playsound ("Pastlinked/Ladderbuild",6)
		LRN2 BCDE 3
	Open:
		LRN2 E 1
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,240)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_fall
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		stop		
	}
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//FIRE LADDER
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



actor FireLadderArrow : LadderArrow 
{
	Speed 35
	States
	{
	Spawn:
		LDRW C 1
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		loop
	Death:
		STBE B 1
		TNT1 A 0 a_playsound ("Pastlinked/LadderArrowhit",0)
		STBE B 2 a_setscale (1.30,1.30)
		TNT1 A 0 A_JumpIf(floorz == z, "LadderUp")
		TNT1 A 0 A_checkceiling ("DropLadder")
		TNT1 A 0 A_spawnitemex("FireLadderDropper",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireLadderArrowTip",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		Stop
	LadderUp:
		TNT1 A 0
		TNT1 A 1 A_spawnitemex("FireLadderArrowTip",0,0,2,0,0,0,0,SXF_NOCHECKPOSITION)
		stop
	DropLadder:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("FireLadderDropper",0,0,-40,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireLadderArrowTip",0,0,-50,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 1
		stop
	xdeath:
		STBE B 1
		TNT1 A 0 A_PlaySound("PastLinked/Hitsound", CHAN_AUTO)
		TNT1 A 0 a_playsound ("Pastlinked/LadderArrowhit",0)
		TNT1 A 0 A_spawnitemex("FireWallBuilder",0,-2,0,0,-15,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireWallBuilder",0,2,0,0,15,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,6,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-6,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		STBE B 2 a_setscale (1.30,1.30)
		stop
	}
}


ACTOR FireLadderArrowTip
{
	Projectile
	Radius 6
	Height 20
	Damage (0)
	DamageType "CALinked"
	+thruactors
	+SKYEXPLODE
	+bright
	+DONTBLAST
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("FireLadderRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LHK3 A 1 A_ChangeVelocity(0,0,15,CVF_REPLACE)
		loop
	Death:
		TNT1 A 0
		LHK3 A 20
		LHK3 BCDE 3
		LHK3 E 500
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1	
		Stop
	}
}

Actor FireLadderDropper : LadderArrowTip
{
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("FireLadderRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN3 A 1 A_ChangeVelocity(0,0,-15,CVF_REPLACE)
		loop
	Death:
		TNT1 A 0
		LRN3 A 20
		LRN3 BCDE 3
		LRN3 E 500
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		LDBK ABBCCC 1
		stop
	}
}
	

Actor FireLadderRung : SwitchableDecoration
{
	Height 12
	Radius 18
	Activation THINGSPEC_Switch|THINGSPEC_ThingTargets
	+NOGRAVITY
	+DONTBLAST
	+bright
	-SOLID
	-USESPECIAL 
	reactiontime 600
	States
	{
	Spawn:
		LRN3 A 20
		LRN3 BCDE 3
		TNT1 A 0 a_changeflag ("USESPECIAL",1)
	Open:
		LRN3 E 1
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,20),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,255)
		TNT1 A 0 a_countdown
		loop
	Active:
		TNT1 A 0
		TNT1 A 0 a_countdown
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,20),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,255)
		LRN3 E 1 A_Giveinventory("ClimbVSpeed",1,AAPTR_TARGET)
		Goto open
	Inactive:
		TNT1 A 0
		TNT1 A 0 a_countdown
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,20),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,255)
		LRN3 E 1 A_Giveinventory("ClimbVSpeed",1,AAPTR_TARGET)
		Goto open
	Death:
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		LDBK ABBCCC 1
		stop
	}
}


//===============================================================
//WALL BUILDER
//===============================================================


Actor FireWallBuilder : WallBuilder
{
	States
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 1
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderUp",0,0,5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 A_spawnitemex("FireVerticalWallBuilderDown",0,0,-5,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		TNT1 A 0 a_stop
		goto death
	Death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


Actor FireVerticalWallBuilderUp : LadderDropper
{
	reactiontime 3
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("FireWallRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN3 A 1 A_ChangeVelocity(0,0,15,CVF_REPLACE)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		LRN3 A 20
		LRN3 BCDE 3
		LRN3 E 150
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		TNT1 AA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,120)
		LDBK ABBCCC 1
		Stop
	}
}

Actor FireVerticalWallBuilderDown : LadderDropper
{
	reactiontime 3
	states
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_spawnitemex("FireWallRung",0,0,0,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LRN3 A 1 A_ChangeVelocity(0,0,-15,CVF_REPLACE)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		LRN3 A 20
		LRN3 BCDE 3
		LRN3 E 150
		TNT1 A 0
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		TNT1 AA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,120)
		LDBK ABBCCC 1
		Stop
	}
}

Actor FireWallRung
{
	Height 12
	Radius 18
	+NOGRAVITY
	+bright
	+SOLID
	+thruspecies
	+shootable
	+DONTBLAST
	+invulnerable
	+noblooddecals
	health 99999
	species "Player"
	-USESPECIAL 
	Mass 999999999
	reactiontime 150
	States
	{
	Spawn:
		LRN3 A 20
		TNT1 A 0 a_playsound ("Pastlinked/Ladderbuild",6)
		LRN3 BCDE 3
	Open:
		LRN3 E 1
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,20),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,255)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_fall
		TNT1 A 0 a_playsound ("Pastlinked/LadderBreak",6)
		TNT1 AA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,120)
		LDBK ABBCCC 1
		stop		
	}
}




//=====================================================
//=====================================================
//FIRE ARROW (CANDLE)
//=====================================================
//=====================================================

actor BlueFireArrow : LinkedArrow
{
	PROJECTILE
	scale 2
	Damage (70)
	Speed 50
	Radius 8
	Height 8
	+bright
	+NOEXTREMEDEATH
	+thruspecies
	DamageType "CALinked"
	Decal CANESDecal
	species "Player"
	States
	{
	Spawn:
		LFRW A 1
		TNT1 AAA 0 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		loop
	Death:
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		Stop
	xdeath:
		STBE B 1
		TNT1 A 0 A_PlaySound("PastLinked/Hitsound", CHAN_AUTO)
		STBE B 2 a_setscale (1.30,1.30)
		stop
	}
}



ACTOR BlueFireBall
{
	Speed 45
	Radius 13
	Height 10
	PROJECTILE
	damage (20)
	+bloodlessimpact
	+DoomBounce
	+bright
	+thruspecies
	DamageType "CALinked"
	Species "Player"
	gravity 0.60
	Scale 1
	renderstyle add
	alpha 0.99
	Decal SmallCANESDecal
	MissileHeight 8
	States
	{
	Spawn:
		LFB1 AA 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_scalevelocity (0.80)
		LFB1 BB 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_scalevelocity (0.70)
		LFB1 A 0 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 CC 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 DD 1 Bright 
		TNT1 A 0 a_changeflag ("NOGRAVITY",0)
	drift:
		LFB1 AA 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 BB 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 CC 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 DD 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		loop
	Death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_playsound ("PastLinked/FireballMiss",0,1,0,1.50)
		LFB1 EFGH 2
		Stop
	XDeath:
		TNT1 A 0
		TNT1 AAAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-2,2),frandom(-2,2),frandom(0,1))
		TNT1 AAAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-2,2),frandom(-2,2),frandom(0,1))
		TNT1 A 0 a_playsound ("PastLinked/FireballHit",0,1,0,1.50)
		LFB1 EFGH 2
		Stop
	}
}


actor RedFireArrow : BlueFireArrow
{
	Damage (80)
	States
	{
	Spawn:
		LFRW B 1
		TNT1 AAA 0 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		loop
	Death:
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		Stop
	xdeath:
		STBE B 1
		TNT1 A 0 A_PlaySound("PastLinked/Hitsound", CHAN_AUTO)
		STBE B 2 a_setscale (1.30,1.30)
		stop
	}
}


ACTOR RedFireBall : BlueFireBall
{
	damage (20)
	States
	{
	Spawn:
		LFB2 AA 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_scalevelocity (0.80)
		LFB2 BB 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_scalevelocity (0.70)
		LFB2 A 0 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 CC 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 DD 1 Bright 
		TNT1 A 0 a_changeflag ("NOGRAVITY",0)
	drift:
		LFB2 AA 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 BB 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 CC 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 DD 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		loop
	Death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_playsound ("PastLinked/FireballMiss",0,1,0,1.50)
		LFB2 EFGH 2
		Stop
	XDeath:
		TNT1 A 0
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-2,2),frandom(-2,2),frandom(0,1))
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-2,2),frandom(-2,2),frandom(0,1))
		TNT1 A 0 a_playsound ("PastLinked/FireballHit",0,1,0,1.50)
		LFB2 EFGH 2
		Stop
	}
}




//=====================================================
//=====================================================
//BOMB ARROW (BOMBS)
//=====================================================
//=====================================================

actor LinkedBombArrow : LinkedArrow
{
	PROJECTILE
	scale 2
	Speed 50
	Radius 8
	Height 8
	+bright
	+NOEXTREMEDEATH
	+thruspecies
	decal BigCANESDecal
	species "Player"
	DamageType "CALinked"
	States
	{
	Spawn:
		LBRW A 1
		TNT1 A 0 A_SpawnItemEx("LinkedBombSmoke",frandom(-1,1),frandom(-1,1),frandom(2,3),frandom(-1,1),frandom(-1,1),frandom(3,8))
		loop
	XDeath:
	Death:
		TNT1 A 0 a_setscale (3)
		TNT1 A 0 a_changeflag ("NOGRAVITY",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_explode (100,100,0,0,100)
		TNT1 A 0 a_explode (20,100,1,0,100)
		TNT1 A 0 Radius_Quake (3,10,0,20,0)
		TNT1 A 0 a_radiusthrust (1200,25,RTF_NOIMPACTDAMAGE,25)
		TNT1 A 0 a_playsound ("PastLinked/BombExplode",0,1,0,0.80)
		LKB1 DEFGHIJKLM 1
		TNT1 A 4
		stop
	}
}

//*************************************************************************************
//*************************************************************************************
//*************************************************************************************
//*************************************************************************************
//*************************************************************************************



//CRISSWORD STUFF




//=====================================================
//=====================================================
//BAIT (BOOMERANG)
//=====================================================
//=====================================================

actor Bait
{
	projectile
	+thruspecies
	+thruactors
	+DONTBLAST
	+Hexenbounce
	+shootable
	+invulnerable
	+noradiusdmg
	+skyexplode
	-noblockmap
	-nogravity
	health 9999999999
	radius 8
	height 32
	Bouncefactor 0
	WallBounceFactor 0.50
	gravity 0.90
	speed 25
	damage (0)
	scale 0.25
	species "Player"
	reactiontime 10
	mass 188000
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0  ACS_NamedExecuteAlways("TagBait")
	Baiting:
		LKBT A 8 a_radiusgive ("BaitDistractor",300,RGF_MONSTERS)
		TNT1 A 0 a_radiusgive ("BaitDistractor",300,RGF_MONSTERS)
		LKBT A 6 bright a_radiusgive ("BaitDistractor",300,RGF_MONSTERS)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_setscale (2,2)
		LDBK ABBCCC 1
		stop		
	}
}

actor MagicalBait : Bait
{
	reactiontime 15
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0  ACS_NamedExecuteAlways("TagBait")
	Baiting:
		LKBT B 8 a_radiusgive ("BaitDistractor",400,RGF_MONSTERS)
		TNT1 AAA 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,20)
		TNT1 A 0 a_radiusgive ("BaitDistractor",400,RGF_MONSTERS)
		LKBT B 6 bright a_radiusgive ("BaitDistractor",400,RGF_MONSTERS)
		TNT1 AAA 0 A_SpawnItemEx("BoomerangParticle",frandom(-16,16),frandom(-16,16),frandom(-5,5),0,0,0,0,SXF_NOCHECKPOSITION,20)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_setscale (2,2)
		LDBK ABBCCC 1
		stop		
	}
}


actor FireBait : Bait
{
	reactiontime 15
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("TagBait")
	Baiting:
		LKBT C 8 a_radiusgive ("BaitDistractor",400,RGF_MONSTERS)
		TNT1 A 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,120)
		TNT1 A 0 a_radiusgive ("BaitDistractor",400,RGF_MONSTERS)
		LKBT C 6 bright a_radiusgive ("BaitDistractor",400,RGF_MONSTERS)
		TNT1 AA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,120)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 A 0 a_setscale (2,2)
		TNT1 AAA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,50)
		TNT1 AAA 0 a_spawnitemex ("RedCandleFire",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		LDBK ABBCCC 1
		stop		
	}
}


actor BaitDistractor : custominventory
{
	+inventory.alwayspickup
	+INVENTORY.AUTOACTIVATE
	states
	{
	pickup:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("Baited")
		TNT1 A 1 
		stop
	death:
		TNT1 A 0
		TNT1 A 1
		stop
	}
}


//=====================================================
//=====================================================
//LEECH FIRE MAGIC (CANDLE)
//=====================================================
//=====================================================


actor BlueLeechFire 
{
	Speed 45
	Radius 8
	Height 8
	PROJECTILE
	damage (0)
	+ripper
	+bright
	+bloodlessimpact
	DamageType "CALinked"
	Scale 2
	decal CANESDecal
	renderstyle add
	alpha 0.99
	reactiontime 5
	States
	{
	Spawn:
		LFB1 A 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 A 0 Bright A_SpawnItemEx("BlueFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("BlueLeechStart",85,RGF_MONSTERS)
		LFB1 B 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 A 0 Bright A_SpawnItemEx("BlueFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("BlueLeechStart",85,RGF_MONSTERS)
		LFB1 C 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 A 0 Bright A_SpawnItemEx("BlueFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("BlueLeechStart",85,RGF_MONSTERS)
		LFB1 D 1 Bright A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 A 0 Bright A_SpawnItemEx("BlueFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("BlueLeechStart",85,RGF_MONSTERS)
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_playsound ("PastLinked/FireballMiss",0,1,0,1.50)
		LFB1 EFGH 2
		Stop
	}
}

Actor BlueLeechStart : custominventory
{
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	states
	{
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_CheckFlag(FRIENDLY,"NoIgnition",AAPTR_DEFAULT)
		TNT1 A 0 a_jumpifinventory ("OnBlueFire",1,"NoScript")
		TNT1 A 0 ACS_NamedExecuteAlways("LeechFireCheck")
	NoScript:
		TNT1 A 0 a_giveinventory ("OnBlueFire",1)
		stop
	NoIgnition:
		TNT1 A 1
		stop
	}
}


actor OnBlueFire : powerup
{
	powerup.duration -5
}



Actor BlueLeechFireSpawner : CustomInventory
{ 
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	States 
	{ 
	Pickup: 
		TNT1 A 0 
		TNT1 A 1
		TNT1 A 0 a_throwgrenade ("LeechFireEffect",-15,0,0)
		stop
	}
}

actor LeechFireEffect
{
	projectile
	+nointeraction
	speed 10
	+BRIGHT
	+CLIENTSIDEONLY
	scale 2
	states
	{
	spawn:	
		TNT1 A 0
		TNT1 AAAAA 0 A_SpawnItemEx ("BlueFireEmber",frandom(-16,16),frandom(-16,16),frandom(-10,15),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION | SXF_SETMASTER | SXF_CLIENTSIDE)
		TNT1 AAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-10,14),frandom(-1,1),frandom(-1,1),frandom(1,2),0,SXF_NOCHECKPOSITION | SXF_SETMASTER| SXF_CLIENTSIDE)
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber3",frandom(-16,16),frandom(-16,16),frandom(-10,14),frandom(-1,1),frandom(-1,1),frandom(1,2),0,SXF_NOCHECKPOSITION | SXF_SETMASTER| SXF_CLIENTSIDE) 
		TNT1 A 2
		Stop
	}
}

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//Red Leech Fire
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

actor RedLeechFire : BlueLeechFire 
{
	States
	{
	Spawn:
		LFB2 A 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 A 0 Bright A_SpawnItemEx("RedFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("RedLeechStart",85,RGF_MONSTERS)
		LFB2 B 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 A 0 Bright A_SpawnItemEx("RedFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("RedLeechStart",85,RGF_MONSTERS)
		LFB2 C 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 A 0 Bright A_SpawnItemEx("RedFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("RedLeechStart",85,RGF_MONSTERS)
		LFB2 D 1 Bright A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 A 0 Bright A_SpawnItemEx("RedFireEmber3",frandom(-2,2),frandom(-2,2),frandom(-8,-4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_radiusgive ("RedLeechStart",85,RGF_MONSTERS)
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_countdown
		loop
	Death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber",frandom(-2,2),frandom(-2,2),frandom(-4,4),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 AAAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-16,16),frandom(-16,16),frandom(-16,16),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 0 a_playsound ("PastLinked/FireballMiss",0,1,0,1.50)
		LFB2 EFGH 2
		Stop
	}
}

Actor RedLeechStart : custominventory
{
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	states
	{
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_CheckFlag(FRIENDLY,"NoIgnition",AAPTR_DEFAULT)
		TNT1 A 0 a_jumpifinventory ("OnRedFire",1,"NoScript")
		TNT1 A 0 ACS_NamedExecuteAlways("RedLeechFireCheck")
	NoScript:
		TNT1 A 0 a_giveinventory ("OnRedFire",1)
		stop
	NoIgnition:
		TNT1 A 1
		stop
	}
}


actor OnRedFire : powerup
{
	powerup.duration -8
}


Actor RedLeechFireSpawner : CustomInventory
{ 
	+INVENTORY.AUTOACTIVATE
	+INVENTORY.ALWAYSPICKUP
	States 
	{ 
	Pickup: 
		TNT1 A 0 
		TNT1 A 1
		TNT1 A 0 a_throwgrenade ("RedLeechFireEffect",-15,0,0)
		stop
	}
}

actor RedLeechFireEffect
{
	projectile
	+nointeraction
	speed 10
	+BRIGHT
	+CLIENTSIDEONLY
	scale 2
	states
	{
	spawn:	
		TNT1 A 0
		TNT1 AAAAA 0 A_SpawnItemEx("RedFireEmber",frandom(-16,16),frandom(-16,16),frandom(2,35),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-16,16),frandom(-16,16),frandom(2,34),frandom(-1,1),frandom(-1,1),frandom(1,2))
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber3",frandom(-16,16),frandom(-16,16),frandom(2,34),frandom(-1,1),frandom(-1,1),frandom(1,2))
		TNT1 A 2
		Stop
	}
}



Actor HeartDropSpawner : CustomInventory
{ 
	States 
	{ 
	Pickup: 
		TNT1 A 0 
		TNT1 A 0 A_SpawnItemEx("LinkedHeart",frandom(-16,16),frandom(-16,16),frandom(12,24),frandom(-4,4),frandom(-5,6),frandom(2,5))
		stop 
	}
}


ACTOR ExtraHeartDropper
{
	+NOBLOCKMAP
	+NOGRAVITY
	+thruactors
	+nointeraction
	States
	{
	Spawn:
		TNT1 AAAAA 0 A_SpawnItemEx("LinkedHeart",frandom(-16,16),frandom(-16,16),frandom(12,24),frandom(-4,4),frandom(-5,6),frandom(2,5),0,0,80)
		TNT1 A 1
		stop
	}
}



actor LinkedHeart : health
{
	+notimefreeze
	+bright
	+dropped
	gravity 0.50
	Inventory.Amount 2
	inventory.maxamount 100
	Inventory.pickupsound "PastLinked/LifeHeart"
	Inventory.PickupMessage "Life heart!"
	scale 1.5
	reactiontime 60
	States
	{
	Spawn:
		LHRT A 6
		LHRT B 6
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		LDBK ABBCCC 1
		stop
	}
}


//=====================================================
//=====================================================
//DUPLICATE MAGIC (BOMBS)
//=====================================================
//=====================================================


actor DupeSpawner
{
	PROJECTILE
	scale 1
	Damage (0)
	Speed 14
	Radius 8
	Height 8
	+bright
	+NOEXTREMEDEATH
	+thruspecies
	+thruactors
	species "Player"
	States
	{
	spawn:
		RTS1 A 5
		TNT1 A 0 a_setscale (1.2,1.2)
		TNT1 A 0 a_scalevelocity (0.80)
		RTS1 A 5
		TNT1 A 0 a_setscale (1.6,1.6)
		RTS1 A 5
		TNT1 A 0 a_scalevelocity (0.40)
		TNT1 A 0 a_setscale (1.8,1.8)
		RTS1 A 5
		TNT1 A 0 a_scalevelocity (0.20)
		TNT1 A 0 a_setscale (2,2)
		RTS1 A 5
		TNT1 A 0 a_scalevelocity (0.10)
		TNT1 A 0 a_setscale (3,3)
		RTS1 A 5
		goto death
	death:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_setscale (2,2)
		TNT1 A 1 a_spawnitemex ("ArtiDupe",0,0,1,0,0,0,0,SXF_SETMASTER|SXF_NOCHECKPOSITION)
		LDBK ABBCCC 1	
		stop
	}
}


actor ArtiDupe
{
	monster
	+DONTBLAST
	+bright
	+friendly
	+nevertarget
	+thruactors
	-SOLID
	+nogravity
	Speed 0
	Radius 4
	Height 8
	Damage (0)
	DamageType "CALinked"
	Mass 999999999
	States
	{
	Spawn:
		TNT1 A 0
		RTE1 A 1 a_look
		TNT1 A 0 a_giveinventory ("DupeTimer",1)
		TNT1 A 0 a_jumpifinventory ("DupeTimer",300,"death")
		loop
	see:
		RTE1 A 1
		RTE1 A 2
		TNT1 A 0 A_JumpIfTargetInLOS ("Missile",360,0,1024,128)
		TNT1 A 0 a_giveinventory ("DupeTimer",1)
		TNT1 A 0 a_jumpifinventory ("DupeTimer",300,"death")
		goto spawn
	Missile:
		RTE1 A 7
		RTE1 A random(1,2)
		TNT1 A 0 a_facetarget
		TNT1 A 0 a_playsound ("PastLinked/SwordAttack",0,0.70)
		TNT1 A 0 a_CustomMissile ("MiniDupeSword",0,0,0,CMF_AIMDIRECTION)
		RTE1 C 8
		TNT1 A 0 A_CustomMissile ("MiniSwordBeam",-2)	
		RTE1 B 2
		RTE1 B random (1,3)
		TNT1 A 0 a_giveinventory ("DupeTimer",15)
		TNT1 A 0 a_jumpifinventory ("DupeTimer",300,"death")
		TNT1 A 0 a_cleartarget
		goto spawn
	death:
		TNT1 A 0
		TNT1 A 0 a_playsound ("PastLinked/Blip",0)
		ZDTH A 3
		ZDTH B 3
		ZDTH A 3
		stop
	}
}


actor MiniSwordBeam : HeroSwordBeam
{
	Speed 25
	Damage (15)
	Projectile
	DamageType "CALinked"
	species "Player"
	+thruspecies
	+bright
	+skyexplode
	SeeSound "PastLinked/SwordBeam"
	scale 0.15
	Obituary "%o was zapped by %k's sword"
	States
	{
	Spawn:
		TNT1 A 0
	Flying:	
		SDBM A 2
		SDBM B 2
		SDBM C 2
		SDBM D 2
		loop
	Death:
		PLZM H 0
		TNT1 A 1
		TNT1 A 1 a_spawnitemex ("SmallSwordBeamFX")
		stop
	Xdeath:
		PLZM H 0
		TNT1 A 0 A_PlaySound("PastLinked/Hitsound", CHAN_AUTO)
		TNT1 A 1
		TNT1 A 1 a_spawnitemex ("SmallSwordBeamFX")
		stop
	}
}

actor MiniDupeSword : HeroSwordBeam
{
	Speed 4
	Damage (0)
	Projectile
	species "Player"
	+thruspecies
	+thruactors
	+bright
	+skyexplode
	+noclip
	scale 0.10
	decal SmallCANESDecal
	Obituary "%o was zapped by %k's sword"
	States
	{
	Spawn:
		SDBM B 2
		TNT1 A 0 a_stop
		SDBM B 5
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 6, 0, 0)
		SDBM B 2
		stop
	death:
		TNT1 A 1
	}
}


actor DupeTimer : inventory
{inventory.maxamount 300}


//*************************************************************************************
//*************************************************************************************
//*************************************************************************************
//*************************************************************************************
//*************************************************************************************



//MAGICAL ROD STUFF


//=====================================================
//=====================================================
//SOMARIA BLOCK (BOOMERANG)
//=====================================================
//=====================================================

actor SomariaBlockSpawner1
{
	Projectile
	-NOGRAVITY
	Radius 15
	Height 15
	speed 10
	scale 0.5
	+bright
	+FORCEXYBILLBOARD
	+DONTREFLECT
	+bounceonwalls
	+DONTBLAST
	species "Somaria"
	states
	{
	spawn:
		SMR1 A 1
		loop
	death:
		SMR1 A 20
		TNT1 A 0 a_playsound ("PastLinked/ExpandBlock",0)
		BLK1 A 1 a_setscale (1,1)
		BLK1 A 1 a_setscale (1.2,1.2)
		SMR1 A 1 a_setscale (1.8,1.8)
		SMR1 A 1 a_setscale (2.2,2.2)
		TNT1 A 0 a_spawnitemex ("SomariaBlock1",0,0,3,0,0,2,0,SXF_NOCHECKPOSITION)
		stop
	}
}

actor SomariaBlock1 : SwitchableDecoration
{
	Health 800
	Radius 25
	Height 45
	speed 10
	Activation THINGSPEC_Switch|THINGSPEC_ThingTargets
	-solid
	+SHOOTABLE
	+reflective
	+thruspecies
	species "Player"
	+NOBLOOD
	+DONTGIB
	+NOICEDEATH
	+USESPECIAL
	+MBFBOUNCER
	+NOTARGET
	+DONTREFLECT
	+bounceonwalls
	+bounceonfloors
	+bright
	+FORCEXYBILLBOARD
	+dontblast
	painchance 255
	mass 9000
	scale 2
	DamageType "CALinked"
	states
	{
	spawn:	
		SMR1 A 5
		SMR1 A 1 a_changeflag ("SOLID",1)
		goto SpawnFlight
	SpawnFlight:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight")
		TNT1 A 0 
		SMR1 A 1
		loop
	
//Three tiers of health
	Block:
		SMR1 A 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (401,"Block2")
		loop
	Block2:
		SMR1 B 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (201,"Block3")
		loop
	Block3:
		SMR1 C 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		loop
	
	Pain:
		"####" # 0 a_playsound ("PastLinked/Shield",0)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (1.9,1.9)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (2.2,2.2)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (2,2)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (201,"Block3")
		TNT1 A 0 a_jumpifhealthlower (401,"Block2")
		goto Block
	
//Reacting to use key
	Active:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("BlockKickSpark",4,0,20,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		TNT1 A 0 a_jumpifhealthlower (401,"BlockJump2")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 A 1 ThrustThingZ (0,24,0,0)
		goto Flying
	BlockJump2:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 B 1 ThrustThingZ (0,24,0,0)
		goto Flying2
	BlockJump3:
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 C 1 ThrustThingZ (0,24,0,0)
		goto Flying3		
	InActive:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("BlockKickSpark",4,0,20,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		TNT1 A 0 a_jumpifhealthlower (401,"BlockJump2")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 A 1 ThrustThingZ (0,24,0,0)
		goto Flying
		
		
//This is the part where the block is actually jumping away
	Flying:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight")
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 A 1
		loop
	Flying2:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight2")
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 B 1
		loop
	Flying3:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight3")
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 C 1
		loop
	
//Coming to a stop
	StopFlight:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 A 1
		SMR1 A 1 a_stop
		goto Block
	StopFlight2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 B 1
		SMR1 B 1 a_stop
		goto Block2
	StopFlight3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR1 C 1
		SMR1 C 1 a_stop
		goto Block3
	death:
		TNT1 A 0
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_playsound ("Pastlinked/SomariaBreak",6)
		BLK1 B 3
		BLK1 A 1
		TNT1 AAAAAAA 0 a_spawnitemex ("SomariaDust",0,0,20,random(-12,12),random(-12,12),random(-6,6))
		TNT1 A 1 
		stop		

	Xdeath:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_radiusgive ("BlockDetonator",100,RGF_OBJECTS)
		TNT1 A 0 a_blast (BF_NOIMPACTDAMAGE,500,300,40)
		TNT1 A 0 Radius_Quake (2,10,0,30,0)
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0)
		BLK1 ABCDEFG 2
		TNT1 A 4
		stop
	Detonate:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_changeflag ("nointeraction",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_blast (BF_NOIMPACTDAMAGE,500,150,20)
		TNT1 A 0 a_spawnitemex ("SomariaWaveShooter",0,0,3,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 Radius_Quake (3,10,0,30,0)
		TNT1 A 0 a_playsound ("PastLinked/SomariaBeam",0)
		BLK2 ABCDEFG 2
		TNT1 A 2
		stop
		
	}
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//BLUE BLOCK
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


actor SomariaBlockSpawner2
{
	Projectile
	-NOGRAVITY
	Radius 15
	Height 15
	speed 10
	scale 0.5
	+bright
	+DONTREFLECT
	+FORCEXYBILLBOARD
	+bounceonwalls
	+DONTBLAST
	species "Somaria"
	states
	{
	spawn:
		SMR2 A 1
		loop
	death:
		SMR2 A 20
		TNT1 A 0 a_playsound ("PastLinked/ExpandBlock",0)
		BLK1 A 1 a_setscale (1,1)
		BLK1 A 1 a_setscale (1.2,1.2)
		SMR2 A 1 a_setscale (1.8,1.8)
		SMR2 A 1 a_setscale (2.2,2.2)
		TNT1 A 0 a_spawnitemex ("SomariaBlock2",0,0,3,0,0,2,0,SXF_NOCHECKPOSITION)
		stop
	}
}

actor SomariaBlock2 : SwitchableDecoration
{
	Health 1200
	Radius 25
	Height 35
	speed 10
	Activation THINGSPEC_Switch|THINGSPEC_ThingTargets
	-solid
	+SHOOTABLE
	+reflective
	+thruspecies
	species "Player"
	+NOBLOOD
	+DONTGIB
	+NOICEDEATH
	+USESPECIAL
	+MBFBOUNCER
	+NOTARGET
	+DONTREFLECT
	+bounceonwalls
	+bounceonfloors
	+bright
	+FORCEXYBILLBOARD
	+dontblast
	painchance 255
	mass 9000
	scale 2
	DamageType "CALinked"
	states
	{
	spawn:	
		SMR2 A 5
		SMR2 A 1 a_changeflag ("SOLID",1)
		goto SpawnFlight
	SpawnFlight:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight")
		TNT1 A 0 
		SMR2 A 1
		loop
	
//Three tiers of health
	Block:
		SMR2 A 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (601,"Block2")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-32,32),frandom(-32,32),frandom(5,15),0,0,0,0,SXF_NOCHECKPOSITION,160)
		loop
	Block2:
		SMR2 B 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (301,"Block3")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-32,32),frandom(-32,32),frandom(5,15),0,0,0,0,SXF_NOCHECKPOSITION,160)
		loop
	Block3:
		SMR2 C 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-32,32),frandom(-32,32),frandom(5,15),0,0,0,0,SXF_NOCHECKPOSITION,160)
		loop
	
	Pain:
		"####" # 0 a_playsound ("PastLinked/Shield",0)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (1.9,1.9)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (2.2,2.2)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (2,2)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (301,"Block3")
		TNT1 A 0 a_jumpifhealthlower (601,"Block2")
		goto Block
	
//Reacting to use key
	Active:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("BlockKickSpark",4,0,20,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifhealthlower (301,"BlockJump3")
		TNT1 A 0 a_jumpifhealthlower (601,"BlockJump2")
		SMR2 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 A 1 ThrustThingZ (0,24,0,0)
		goto Flying
	BlockJump2:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 B 1 ThrustThingZ (0,24,0,0)
		goto Flying2
	BlockJump3:
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 C 1 ThrustThingZ (0,24,0,0)
		goto Flying3		
	InActive:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("BlockKickSpark",4,0,20,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		TNT1 A 0 a_jumpifhealthlower (401,"BlockJump2")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 A 1 ThrustThingZ (0,24,0,0)
		goto Flying
		
		
//This is the part where the block is actually jumping away
	Flying:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-32,32),frandom(-32,32),frandom(5,15),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 A 1
		loop
	Flying2:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight2")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-32,32),frandom(-32,32),frandom(5,15),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 B 1
		loop
	Flying3:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight3")
		TNT1 A 0 A_SpawnItemEx("BoomerangParticle",frandom(-32,32),frandom(-32,32),frandom(5,15),0,0,0,0,SXF_NOCHECKPOSITION,160)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 C 1
		loop
	
//Coming to a stop
	StopFlight:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 A 1
		SMR2 A 1 a_stop
		goto Block
	StopFlight2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 B 1
		SMR2 B 1 a_stop
		goto Block2
	StopFlight3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR2 C 1
		SMR2 C 1 a_stop
		goto Block3
	death:
		TNT1 A 0
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_playsound ("Pastlinked/SomariaBreak",6)
		BLK1 B 3
		BLK1 A 1
		TNT1 AAAAAAA 0 a_spawnitemex ("SomariaDust",0,0,20,random(-12,12),random(-12,12),random(-6,6))
		TNT1 A 1 
		stop		

	Xdeath:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_radiusgive ("BlockDetonator",100,RGF_OBJECTS)
		TNT1 A 0 a_blast (BF_NOIMPACTDAMAGE,800,200,30)
		TNT1 A 0 Radius_Quake (2,10,0,30,0)
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0)
		BLK1 ABCDEFG 2
		TNT1 A 4
		stop
	Detonate:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_changeflag ("nointeraction",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_blast (BF_NOIMPACTDAMAGE,800,200,30)
		TNT1 A 0 a_spawnitemex ("SomariaWaveShooter",0,0,3,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 Radius_Quake (3,10,0,30,0)
		TNT1 A 0 a_playsound ("PastLinked/SomariaBeam",0)
		BLK2 ABCDEFG 2
		TNT1 A 2
		stop
		
	}
}


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//FIRE BLOCK
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


actor SomariaBlockSpawner3
{
	Projectile
	-NOGRAVITY
	Radius 15
	Height 15
	speed 10
	scale 0.5
	+bright
	+DONTREFLECT
	+FORCEXYBILLBOARD
	+bounceonwalls
	+DONTBLAST
	species "Somaria"
	states
	{
	spawn:
		SMR3 A 1
		loop
	death:
		SMR3 A 20
		TNT1 A 0 a_playsound ("PastLinked/ExpandBlock",0)
		BLK1 A 1 a_setscale (1,1)
		BLK1 A 1 a_setscale (1.2,1.2)
		SMR3 A 1 a_setscale (1.8,1.8)
		SMR3 A 1 a_setscale (2.2,2.2)
		TNT1 A 0 a_spawnitemex ("SomariaBlock3",0,0,3,0,0,2,0,SXF_NOCHECKPOSITION)
		stop
	}
}

actor SomariaBlock3 : SwitchableDecoration
{
	Health 1200
	Radius 25
	Height 35
	speed 10
	Activation THINGSPEC_Switch|THINGSPEC_ThingTargets
	-solid
	+SHOOTABLE
	+reflective
	+thruspecies
	species "Player"
	+NOBLOOD
	+DONTGIB
	+NOICEDEATH
	+USESPECIAL
	+MBFBOUNCER
	+NOTARGET
	+DONTREFLECT
	+bounceonwalls
	+bounceonfloors
	+bright
	+FORCEXYBILLBOARD
	+dontblast
	painchance 255
	mass 9000
	scale 2
	DamageType "CALinked"
	states
	{
	spawn:	
		SMR3 A 5
		SMR3 A 1 a_changeflag ("SOLID",1)
		goto SpawnFlight
	SpawnFlight:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight")
		TNT1 A 0 
		SMR3 A 1
		loop
	
//Three tiers of health
	Block:
		SMR3 A 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (601,"Block2")
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,180)
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(0,1),0,SXF_NOCHECKPOSITION,180)
		loop
	Block2:
		SMR3 B 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (301,"Block3")
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,180)
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(0,1),0,SXF_NOCHECKPOSITION,180)
		loop
	Block3:
		SMR3 C 1
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,180)
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(0,1),0,SXF_NOCHECKPOSITION,180)
		loop
	
	Pain:
		"####" # 0 a_playsound ("PastLinked/Shield",0)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (1.9,1.9)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 0 a_facetarget
		"####" # 0 a_custommissile ("RedFireBall",20)
		"####" # 1 a_setscale (2.2,2.2)
		"####" # 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		"####" # 1 a_setscale (2,2)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 A 0 a_jumpifhealthlower (301,"Block3")
		TNT1 A 0 a_jumpifhealthlower (601,"Block2")
		goto Block
	
//Reacting to use key
	Active:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("BlockKickSpark",4,0,20,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifhealthlower (301,"BlockJump3")
		TNT1 A 0 a_jumpifhealthlower (601,"BlockJump2")
		SMR3 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 A 1 ThrustThingZ (0,24,0,0)
		goto Flying
	BlockJump2:
		TNT1 A 0
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 B 1 ThrustThingZ (0,24,0,0)
		goto Flying2
	BlockJump3:
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 C 1 ThrustThingZ (0,24,0,0)
		goto Flying3		
	InActive:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("BlockKickSpark",4,0,20,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 a_jumpifhealthlower (201,"BlockJump3")
		TNT1 A 0 a_jumpifhealthlower (401,"BlockJump2")
		SMR1 A 0 a_facetarget
		TNT1 A 0 a_changeflag ("SOLID",1)
		TNT1 A 0 a_changeflag ("Missile",1)
		TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 18, 0, 0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 A 1 ThrustThingZ (0,24,0,0)
		goto Flying
		
		
//This is the part where the block is actually jumping away
	Flying:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight")
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,180)
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(0,1),0,SXF_NOCHECKPOSITION,180)
		SMR3 A 1
		loop
	Flying2:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight2")
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,180)
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(0,1),0,SXF_NOCHECKPOSITION,180)
		SMR3 B 1
		loop
	Flying3:
		SMR1 A 0
		TNT1 A 0 A_JumpIf(floorz == z, "StopFlight3")
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		TNT1 AA 0 A_SpawnItemEx("RedFireEmber",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(3,8),0,SXF_NOCHECKPOSITION,180)
		TNT1 AAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-20,20),frandom(-20,20),frandom(20,25),frandom(-1,1),frandom(-1,1),frandom(0,1),0,SXF_NOCHECKPOSITION,180)
		SMR3 C 1
		loop
	
//Coming to a stop
	StopFlight:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 A 1
		SMR3 A 1 a_stop
		goto Block
	StopFlight2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 B 1
		SMR3 B 1 a_stop
		goto Block2
	StopFlight3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.60)
		TNT1 A 0 a_changeflag ("Missile",0)
		TNT1 A 0 a_changeflag ("Thruspecies",0)
		SMR1 A 0 ThrustThingZ (0,5,0,0)
		TNT1 A 0 a_jumpifinventory ("BlockDetonator",1,"Detonate")
		SMR3 C 1
		SMR3 C 1 a_stop
		goto Block3
	death:
		TNT1 A 0
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_playsound ("Pastlinked/SomariaBreak",6)
		BLK1 B 3
		BLK1 A 1
		TNT1 AAAAAAA 0 a_spawnitemex ("SomariaDust",0,0,20,random(-12,12),random(-12,12),random(-6,6))
		TNT1 AAAAAA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,50)
		TNT1 A 1 
		stop		

	Xdeath:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_radiusgive ("BlockDetonator",100,RGF_OBJECTS)
		TNT1 A 0 a_blast (BF_NOIMPACTDAMAGE,800,200,30)
		TNT1 A 0 Radius_Quake (2,10,0,30,0)
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0)
		TNT1 AAAAAAAAAA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,50)
		BLK1 ABCDEFG 2
		TNT1 A 4
		stop
	Detonate:
		TNT1 A 0
		TNT1 A 0 a_stop
		TNT1 A 0 a_changeflag ("USESPECIAL",0)
		TNT1 A 0 a_changeflag ("Nogravity",1)
		TNT1 A 0 a_changeflag ("nointeraction",1)
		TNT1 A 0 a_stop
		TNT1 A 0 a_blast (BF_NOIMPACTDAMAGE,800,200,30)
		TNT1 A 0 a_spawnitemex ("SomariaWaveShooter",0,0,3,0,0,0,0,SXF_NOCHECKPOSITION)
		TNT1 A 0 Radius_Quake (3,10,0,30,0)
		TNT1 A 0 a_playsound ("PastLinked/SomariaBeam",0)
		TNT1 AAAAAAA 0 A_SpawnItemEx("SmallRedFireSpawner",frandom(-16,16),frandom(-16,16),frandom(-5,5),frandom(-10,10),frandom(-10,10),frandom(4,8),0,SXF_NOCHECKPOSITION,50)
		BLK2 ABCDEFG 2
		TNT1 A 2
		stop
		
	}
}






actor SomariaDust
{
	projectile
	+nointeraction
	speed 10
	+BRIGHT
	+CLIENTSIDEONLY
	scale 2
	states
	{
	spawn:	
		LDBK A 5
		LDBK B 5
		LDBK C 5
		Stop
	}
}

actor BlockKickSpark
{
	+nointeraction
	speed 10
	+BRIGHT
	+CLIENTSIDEONLY
	scale 2
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 a_playsound ("PastLinked/FireballHit",0,1,0,1.50)
		STBE B 1
		STBE B 2 a_setscale (1.30,1.30)
		stop
	}
}



actor SomariaWaveShooter
{
	+thruspecies
	+DONTBLAST
	Species "Player"
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 0, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 45, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 180, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 225, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 270, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 315, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 0 A_CustomMissile("SomariaWave", 30,0, 360, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		TNT1 A 1
		stop
	death:
		TNT1 A 1
		stop
	}
}




actor SomariaWave : Magicwave
{
	scale 1
	Damage (25)
	speed 25
	renderstyle translucent
	alpha 0.95
	+DONTBLAST
	+hexenbounce
	bouncecount 2
	States
	{
	Spawn:
		MWAV C 1 a_radiusgive ("BlockDetonator",60,RGF_OBJECTS)
		loop
	Death:
		ZDTH A 3
		TNT1 A 0 a_radiusgive ("BlockDetonator",70,RGF_OBJECTS)
		ZDTH B 3
		ZDTH A 3
		Stop
	}
}

actor BlockDetonator : inventory
{inventory.maxamount 1}


//=====================================================
//=====================================================
//FIRE MAGIC (CANDLE)
//=====================================================
//=====================================================


actor BlueFireWave : Magicwave
{
	States
	{
	Spawn:
		MWAV B 1
		TNT1 A 0 a_spawnitemex ("SmallBlueFireSpawner",0,0,0,random(-6,6),random(-6,6),random(1,3))
		MWAV C 1
		TNT1 A 0 a_spawnitemex ("SmallBlueFireSpawner",0,0,0,random(-6,6),random(-6,6),random(1,3))
		loop
	Death:
		ZDTH A 3
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0,0.80)
		TNT1 AAAAAAAAAAAAA 0 a_spawnitemex ("SmallBlueFireSpawner",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAAAA 0 a_spawnitemex ("CandleFire",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAAA 0 a_spawnitemex ("BlueFireball",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH B 3
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH A 3
		Stop
	XDeath:
		ZDTH A 3
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0,0.80)
		TNT1 AAAAAAAAAAAAA 0 a_spawnitemex ("SmallBlueFireSpawner",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAAAA 0 a_spawnitemex ("CandleFire",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAAA 0 a_spawnitemex ("BlueFireball",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH B 3
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Bluemagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH A 3
		Stop
	}
}

actor SmallBlueFireSpawner
{
	projectile
	+bright
	+thruspecies
	+bounceonwalls
	-nogravity
	radius 10
	height 12
	gravity 0.50
	speed 25
	damage (2)
	scale 1.5
	species "Player"
	DamageType "CALinked"

	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 a_jump (80,"Slowdown1")
		TNT1 A 0 a_jump (80,"Slowdown2")
		TNT1 A 0 a_jump (80,"Slowdown3")
		goto sliding
	Slowdown1:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.37)
		Goto sliding
	Slowdown2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.70)
		Goto sliding
	Slowdown3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.59)
		Goto sliding
	Sliding:
		FIP1 E 1 
		FIP1 E 1 
		FIP1 E 1 
		FIP1 F 1 
		FIP1 F 1
		FIP1 F 1 A_SpawnItemEx("BlueFireEmber",frandom(-4,4),frandom(-4,4),frandom(3,5),frandom(-1,1),frandom(-1,1),frandom(2,4))
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("SmallBlueFire",0,0,4,0,0,4,0,SXF_NOCHECKPOSITION)
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-4,4),frandom(-5,5),frandom(4,7),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-4,4),frandom(-5,5),frandom(3,6),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 1
		stop
	}
}


actor SmallBlueFire
{
	projectile
	+bright
	+floorhugger
	+thruspecies
	-nogravity
	radius 25
	height 12
	gravity 0.50
	speed 25
	damage (8)
	scale 1.5
	reactiontime 90
	species "Player"
	DamageType "CALinked"

	states
	{
	spawn:
		TNT1 A 0
		FIP1 E 1 
		FIP1 E 1 
		FIP1 E 1 
		FIP1 F 1 
		FIP1 F 1
		FIP1 F 1 A_SpawnItemEx("BlueFireEmber",frandom(-4,4),frandom(-4,4),frandom(3,5),frandom(-1,1),frandom(-1,1),frandom(2,4))
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-4,4),frandom(-5,5),frandom(4,7),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-4,4),frandom(-5,5),frandom(3,6),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 1
		stop
	}
}


actor Bluemagicflare
{
	+NOINTERACTION
	renderstyle add
	alpha 0.90
	scale 1
	Radius 4
	Height 5
	+bright
	states
	{
	spawn:
		TNT1 A 0
		LFB1 E 3 a_playsound ("PastLinked/FireballHit",0,1,0,1.50)
		TNT1 A 0 a_playsound ("PastLinked/Candle",0)
		TNT1 AAA 0 A_SpawnItemEx("BlueFireEmber",frandom(-10,10),frandom(-10,10),frandom(2,4),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("BlueFireEmber2",frandom(-10,10),frandom(-10,10),frandom(3,5),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB1 FGH 3
		stop
	}
}



//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//RED FIRE WAVE
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@




actor RedFireWave : BlueFireWave
{
	States
	{
	Spawn:
		MWAV A 1
		TNT1 A 0 a_spawnitemex ("SmallRedFireSpawner",0,0,0,random(-6,6),random(-6,6),random(1,3))
		TNT1 A 0 a_spawnitemex ("SmallRedFireSpawner",0,0,0,random(-9,9),random(-9,9),random(1,3))
		MWAV C 1
		TNT1 A 0 a_spawnitemex ("SmallRedFireSpawner",0,0,0,random(-6,6),random(-6,6),random(1,3))
		TNT1 A 0 a_spawnitemex ("SmallRedFireSpawner",0,0,0,random(-9,9),random(-9,9),random(1,3))
		loop
	Death:
		ZDTH A 3
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0,0.80)
		TNT1 AAAAAAAAAAAAAAA 0 a_spawnitemex ("SmallRedFireSpawner",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAAAAAA 0 a_spawnitemex ("RedCandleFire",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAA 0 a_spawnitemex ("RedFireBall",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH B 3
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH A 3
		Stop
	XDeath:
		ZDTH A 3
		TNT1 A 0 a_playsound ("PastLinked/SomariaForce",0,0.80)
		TNT1 AAAAAAAAAAAAAAA 0 a_spawnitemex ("SmallRedFireSpawner",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAAAAAA 0 a_spawnitemex ("RedCandleFire",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 AAAAAAAAA 0 a_spawnitemex ("RedFireBall",0,0,0,random(-10,10),random(-10,10),random(5,8),0,SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH B 3
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 A_SpawnItemEx ("Redmagicflare", frandom(-20,20),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)
		ZDTH A 3
		Stop	
	}
}

actor SmallRedFireSpawner : SmallBlueFireSpawner
{
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 0 a_jump (80,"Slowdown1")
		TNT1 A 0 a_jump (80,"Slowdown2")
		TNT1 A 0 a_jump (80,"Slowdown3")
		goto sliding
	Slowdown1:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.37)
		Goto sliding
	Slowdown2:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.70)
		Goto sliding
	Slowdown3:
		TNT1 A 0
		TNT1 A 0 a_scalevelocity (0.59)
		Goto sliding
	Sliding:
		FIP2 E 1 
		FIP2 E 1 
		FIP2 E 1 
		FIP2 F 1 
		FIP2 F 1
		FIP2 F 1 A_SpawnItemEx("RedFireEmber",frandom(-4,4),frandom(-4,4),frandom(3,5),frandom(-1,1),frandom(-1,1),frandom(2,4))
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		TNT1 A 0 a_spawnitemex ("SmallRedFire",0,0,4,0,0,4,0,SXF_NOCHECKPOSITION)
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber",frandom(-4,4),frandom(-5,5),frandom(4,7),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-4,4),frandom(-5,5),frandom(3,6),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 1
		stop
	}
}


actor SmallRedFire : SmallBlueFire
{
	reactiontime 130
	states
	{
	spawn:
		TNT1 A 0
		FIP2 E 1 
		FIP2 E 1 
		FIP2 E 1 
		FIP2 F 1 
		FIP2 F 1
		FIP2 F 1 A_SpawnItemEx("RedFireEmber",frandom(-4,4),frandom(-4,4),frandom(3,5),frandom(-1,1),frandom(-1,1),frandom(2,4))
		TNT1 A 0 a_countdown
		loop
	death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber",frandom(-4,4),frandom(-5,5),frandom(4,7),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-4,4),frandom(-5,5),frandom(3,6),frandom(-1,1),frandom(-1,1),frandom(0,1))
		TNT1 A 1
		stop
	}
}

actor RedMagicflare
{
	+NOINTERACTION
	renderstyle add
	alpha 0.90
	scale 1
	Radius 4
	Height 5
	+bright
	states
	{
	spawn:
		TNT1 A 0
		LFB2 E 3 a_playsound ("PastLinked/FireballHit",6,1,0,1.50)
		TNT1 A 0 a_playsound ("PastLinked/Candle",0)
		TNT1 AAA 0 A_SpawnItemEx("RedFireEmber",frandom(-10,10),frandom(-10,10),frandom(2,4),frandom(-1,1),frandom(-1,1),frandom(3,8))
		TNT1 AAAAA 0 A_SpawnItemEx("RedFireEmber2",frandom(-10,10),frandom(-10,10),frandom(3,5),frandom(-1,1),frandom(-1,1),frandom(0,1))
		LFB2 FGH 3
		stop
	}
}

Actor MiniRedMagicflare : RedMagicflare
{
	scale 0.50
}




//=====================================================
//=====================================================
//THUNDER MAGIC (BOMBS)
//=====================================================
//=====================================================




actor BigSpark
{
	Radius 13
	Height 8
	Speed 40
	Damage (50)
	Projectile
	+thruspecies
	+DONTBLAST
	+forcepain
	+FORCERADIUSDMG
	DamageType "CALinked"
	species "player"
	+bright
	scale 2
	alpha 0.60
	States
	{
	spawn:
		SPRK ABCDE 1
		loop
	death:
		TNT1 A 0
		TNT1 A 0 a_playsound ("PastLinked/sparkhit",0)
		TNT1 AAAAAA 0 A_SpawnItemEx ("sparkhit", frandom(-90,100),frandom(-100,100),frandom(-8,8), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 AAA 0 A_SpawnItemEx ("bigsparkhit", frandom(-50,50),frandom(-80,80),frandom(-30,30), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 a_explode (5,180,0,0,90)
		TNT1 A random(15,25)
		TNT1 A 0 a_playsound ("PastLinked/sparkhit",0)
		TNT1 AAAA 0 A_SpawnItemEx ("sparkhit", frandom(-90,100),frandom(-100,100),frandom(-8,8), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 AA 0 A_SpawnItemEx ("bigsparkhit", frandom(-50,50),frandom(-80,80),frandom(-30,30), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 a_explode (5,180,0,0,90)
		TNT1 A random(10,15)
		TNT1 A 0 a_playsound ("PastLinked/sparkhit",0)
		TNT1 AAAA 0 A_SpawnItemEx ("sparkhit", frandom(-90,100),frandom(-100,100),frandom(-8,8), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 AA 0 A_SpawnItemEx ("bigsparkhit", frandom(-50,50),frandom(-80,80),frandom(-30,30), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 a_explode (5,180,0,0,90)
		TNT1 A random(6,8)
		TNT1 A 0 a_playsound ("PastLinked/sparkhit",0)
		TNT1 AAAA 0 A_SpawnItemEx ("sparkhit", frandom(-90,100),frandom(-100,100),frandom(-8,8), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 AA 0 A_SpawnItemEx ("bigsparkhit", frandom(-50,50),frandom(-80,80),frandom(-30,30), 0,0,0, 0, SXF_NOCHECKPOSITION)
		TNT1 A 0 a_explode (5,180,0,0,90)
		TNT1 A 3 A_SpawnItemEx ("bigsparkhit", frandom(-3,3),frandom(-20,20),frandom(-20,20), 0,0,0, 0, SXF_NOCHECKPOSITION)	
		stop
	}
}


actor sparkhit
{
	+NOINTERACTION
	scale 2
	Radius 4
	Height 5
	+bright
	states
	{
	spawn:
		TNT1 A 0
		TNT1 A 1 a_jump (80, "zap2")
		SPRK F 1
		SPRK G 1
		SPRK F 1
		SPRK G 1
		SPRK F 1
		SPRK G 1
		stop
	zap2:
		TNT1 A 0
		SPRK G 1
		SPRK F 1
		SPRK G 1
		SPRK F 1
		SPRK G 1
		SPRK F 1
		SPRK G 1
		SPRK F 1
		stop
	death:
		TNT1 A 1
		stop
	}
}

actor bigsparkhit : sparkhit
{
	scale 4
}
