
// Plasma Ball
actor PlasmaBall_Player : FastProjectile replaces PlasmaBall
{
  Game Doom
  SpawnID 51
  Radius 13
  Height 8
  Speed 40
  Damage 7
  Projectile
  RenderStyle Add
  Alpha 1.0
  SeeSound "weapons/plasmaf"
  DeathSound "weapons/plasmax"
  Obituary "$OB_MPPLASMARIFLE"
  DamageType MarineFire
  +MTHRUSPECIES
  States
  {
  Spawn:
    PLSS AB 6 bright
    Loop
  Death:
    TNT1 A 0 a_Explode(6,24, 0, true, 12)
    PLSE ABCDE 4 bright
    stop
  }
}


ACTOR PlasmaProjectile_Turret : FastProjectile
{
	Radius				11
	Height				8
	Speed				60
	Damage				10
	DamageType			MarineFire
	RenderStyle			Add
	Projectile
	+MTHRUSPECIES
	SeeSound			"x1/fire1"
	//DeathSound		"weapons/rocklx"
	Obituary			"%o smells %k's rails... oh wait, thats $o's melted insides"
	
	States
	{
		Spawn:
			PLSS A 1 bright A_SpawnItem ("PlasmaTrail_Turret" , 0, 0, 0, 0)
			PLSS B 1 bright A_SpawnItem ("PlasmaTrail_Turret" , 0, 0, 0, 0)
			Loop
		Death:
			PLSE C 8 bright
			PLSE D 6 bright
			PLSE E 4 bright
			stop
	}
}

Actor PlasmaProjectile_TurretLv1 : PlasmaProjectile_Turret {
	Speed	62
}

Actor PlasmaProjectile_TurretLv2 : PlasmaProjectile_Turret {
	Speed	64
	Damage	12
}

Actor PlasmaProjectile_TurretLv3 : PlasmaProjectile_Turret {
	Speed	66
	Damage	15
	States
	{
		Death:
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, 45, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, 135, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, -45, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, -135, 2,AAPTR_TARGET)
			PLSE C 8 bright
			PLSE D 6 bright
			PLSE E 4 bright
			stop
	}
}

Actor PlasmaProjectile_TurretLv4 : PlasmaProjectile_Turret {
	Speed	68
	Damage	18
	States
	{
		Death:
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, 30, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, 60, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, 120, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, 160, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, -30, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, -60, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, -120, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, -160, 2,AAPTR_TARGET)
			PLSE C 8 bright
			PLSE D 6 bright
			PLSE E 4 bright
			stop
	}
}

Actor PlasmaProjectile_TurretLv5 : PlasmaProjectile_TurretLv4 {
	Speed	70
	Damage	20
	+SEEKERMISSILE
	States
	{
		Spawn:
			PLSS A 1 bright A_SpawnItem ("PlasmaTrail_Turret" , 0, 0, 0, 0)
			TNT1 A 0 A_SeekerMissile(0, 5, SMF_Look, 256,5)
			PLSS B 1 bright A_SpawnItem ("PlasmaTrail_Turret" , 0, 0, 0, 0)
			TNT1 A 0 A_SeekerMissile(0, 5, SMF_Look, 256,5)
			loop
	}
}


actor PlasmaTrail{
  Radius 0
  Height 0
  //Gravity 100
  Alpha 0.12
  Renderstyle Add
  +FORCEXYBILLBOARD
	+ClientsideOnly
	+NOINTERACTION
}


Actor PlasmaTrail1 : PlasmaTrail
{
  States
  {
   Melee:
   Spawn:
		PLSE A 2 bright 
		PLSS A 2 BRIGHT
		stop
  }
}

Actor PlasmaTrail2 : PlasmaTrail
{
  States
  {
   Melee:
   Spawn:
		PLSE A 2 bright 
		PLSS B 2 BRIGHT
		stop
  }
}

Actor PlasmaTrail_Turret : PlasmaTrail
{
  States
  {
   Melee:
   Spawn:
		PLSE A 2 nodelay bright A_CheckRange(512, "Gone")
		TNT1 A 0 A_CheckRange(512, "Gone")
		PLSE B 2 BRIGHT a_fadeout(0.25)
		loop
	Gone:
		TNT1 A 1
	Stop
  }
}

Actor PlasmaTrailSpawn : RandomSpawner{
	DropItem "PlasmaTrail1", 255, 1
	DropItem "PlasmaTrail2", 255, 1
}

ACTOR PlasmaProjectile_Adv2 : FastProjectile
{
	Radius				11
	Height				8
	Speed				50
	Damage				10
	DamageType			MarineFire
	RenderStyle			Add
	Projectile
	+MTHRUSPECIES
	+SEEKERMISSILE
	+SCREENSEEKER 
	DeathSound "weapons/plasmax"
	MissileType "PlasmaTrailSpawn"
	MissileHeight 8
	//DeathSound		"weapons/rocklx"
	Obituary			"%o could'nt escape from %k's plasma balls"
	
	var int user_countdown;
	States
	{
		Spawn:
			PLSS AB 1 bright A_SeekerMissile(5, 30, SMF_LOOK)
			TNT1 A 0 A_SetUserVar("user_countdown", user_countdown + 1)
			TNT1 A 0 A_JumpIf(user_countdown > 88, "Spawn.Unchase") // Nearly 5 seconds.
			Loop
		Spawn.Unchase:
			PLSS AB 1
			loop
		Death:
			PLSE C 8 bright a_Explode(16,64, 0, true, 32)
			PLSE D 6 bright
			PLSE E 4 bright
			stop
	}
}

ACTOR PlasmaProjectile_Adv2Alt 
{
	Radius				12
	Height				12
	Speed				30
	Damage				20
	DamageType			MarineFire
	scale 0.5
	RenderStyle			Add
	Projectile
	+MTHRUSPECIES
	+SEEKERMISSILE
	+SCREENSEEKER 
	DeathSound "weapons/plasmax"
	MissileType "PlasmaTrailSpawn"
	MissileHeight 8
	//DeathSound		"weapons/rocklx"
	Obituary			"%o could'nt escape from %k's plasma balls"
	Translation "112:127=192:207", "228:230=168:169"
	
	var int user_countdown;
	States
	{
		Spawn:
			BFS1 AB 2 bright A_SeekerMissile(5, 5, SMF_LOOK)
			TNT1 A 0 A_SetUserVar("user_countdown", user_countdown + 1)
			TNT1 A 0 A_JumpIf(user_countdown > 88, "Spawn.Unchase") // Nearly 5 seconds.
			Loop
		Spawn.Unchase:
			PLSS AB 1
			loop
		Death:
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, 30, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, 60, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, 120, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, 160, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, -30, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, -60, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, -120, 2,AAPTR_TARGET)
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Adv2", 0, 0, -160, 2,AAPTR_TARGET)
			BFE1 ABC 4 Bright a_Explode(20,128, 0, true, 32)
			BFE1 D 3 bright
			BFE1 E 2 bright
			BFE1 F 2 bright
			stop
	}
}

ACTOR PlasmaProjectile_Alt 
{
	Radius				8
	Height				8
	Speed				30
	Damage				20
	DamageType			MarineFire
	scale 0.3
	RenderStyle			Add
	Projectile
	+MTHRUSPECIES
	DeathSound "weapons/plasmax"
	//DeathSound		"weapons/rocklx"
	Obituary			"%o could'nt escape from %k's plasma balls"
	Translation "112:127=192:207", "228:230=168:169"
	States
	{
		Spawn:
			BFS1 AB 2 bright 
			loop
		Death:
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Alt_Hit1", 0, 0, 0, CMF_AIMDIRECTION|CMF_TRACKOWNER, 0)
			TNT1 A 0 a_Explode(10,64, 0, true, 16)
		Death.Rest:
			BFE1 ABC 4 
			BFE1 D 3 bright
			BFE1 E 2 bright
			BFE1 F 2 bright
			stop
	}
}
ACTOR PlasmaProjectile_Alt_Hit1 : PlasmaProjectile_Alt 
{
	scale 0.25
	States
	{
		Death:
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Alt_Hit2", 0, 0, 0, CMF_AIMDIRECTION|CMF_TRACKOWNER, 0)
			TNT1 A 0 a_Explode(8,32, 0, true, 16)
			goto Super::Death.Rest
	}
}
ACTOR PlasmaProjectile_Alt_Hit2 : PlasmaProjectile_Alt 
{
	scale 0.20
	States
	{
		Death:
			TNT1 A 0 A_CustomMissile("PlasmaProjectile_Alt_Hit3", 0, 0, 0, CMF_AIMDIRECTION|CMF_TRACKOWNER, 0)
			TNT1 A 0 a_Explode(6,32, 0, true, 16)
			goto Super::Death.Rest
	}
}
ACTOR PlasmaProjectile_Alt_Hit3 : PlasmaProjectile_Alt 
{
	scale 0.15
	States
	{
		Death:
			TNT1 A 0 a_Explode(4,16, 0, true, 16)
			goto Super::Death.Rest
	}
}

ACTOR PlasmaProjectile_Spread : FastProjectile
{
	Game Doom
	SpawnID 51
	Radius 13
	Height 8
	Speed 64
	Damage 7
	Projectile
	RenderStyle Add
	Alpha 0.75
	SeeSound "weapons/plasmaf"
	DeathSound "weapons/plasmax"
	Obituary "$OB_MPPLASMARIFLE"
	+MTHRUSPECIES
	DamageType	MarineFire
	States
	{
		Spawn:
		TNT1 A 0
		//TNT1 A 0 A_ClearTarget
		Spawn2:
		PLSS AB 2 bright
		goto Spawn
		Death:
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, 90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, -90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, 135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split", 0, 0, -135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE AAAAA 0 A_CustomMissile("PlasmaProjectile_Spread_Explode", 0, 0, random(0,359),2,random(90,-90))
		PLSE ABCDE 4 bright
		stop
	}
}

ACTOR PlasmaProjectile_Spread_Split : PlasmaProjectile_Spread
{
	scale 0.7
	speed 30
	radius 8
	damage (5 * random (1,6))
	SeeSound ""
	States
	{
		Spawn:
		PLSS AB 2 bright 
		TNT1 A 0 A_FadeOut(0.2)
		loop
		Death:
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, 90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, -90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, 135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split2", 0, 0, -135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE ABCDE 4 bright A_FadeIn(1.0)
		stop
	}
}

ACTOR PlasmaProjectile_Spread_Split2 : PlasmaProjectile_Spread
{
	scale 0.5
	damage (4 * random(1,5))
	radius 6
	speed 20
	SeeSound ""
	+NODAMAGETHRUST
	States
	{
		Spawn:
		PLSS AB 2 bright
		TNT1 A 0 A_FadeOut(0.33)
		goto Spawn
		Death:
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split3", 0, 0, 90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split3", 0, 0, -90, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split3", 0, 0, 135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE A 0 A_CustomMissile("PlasmaProjectile_Spread_Split3", 0, 0, -135, CMF_AIMDIRECTION | CMF_TRACKOWNER)
		PLSE ABCDE 4 bright A_FadeIn(1.0)
		stop
	}
}

ACTOR PlasmaProjectile_Spread_Split3 : PlasmaProjectile_Spread
{
	scale 0.3
	damage (3 * random(1,4))
	radius 4
	speed 10
	SeeSound ""
	+NODAMAGETHRUST
	States
	{
		Spawn:
		PLSS AB 2 bright
		TNT1 A 0 A_FadeOut(0.5)
		goto Spawn
		Death:
		PLSE ABCDE 4 bright A_FadeIn(1.0)
		stop
	}
}

ACTOR PlasmaProjectile_Spread2 : PlasmaProjectile_Spread
{
	states
	{
		Spawn:
		TNT1 A 0
		TNT1 A 0 bright A_CustomMissile("PlasmaProjectile_Spread_Expand", 0, 0, 45, 2,AAPTR_TARGET)
		TNT1 A 0 bright A_CustomMissile("PlasmaProjectile_Spread_Expand", 0, 0, -45, 2,AAPTR_TARGET)
		PLSS A 2 bright 
		TNT1 A 0 bright A_CustomMissile("PlasmaProjectile_Spread_Expand", 0, 0, 45, 2,AAPTR_TARGET)
		TNT1 A 0 bright A_CustomMissile("PlasmaProjectile_Spread_Expand", 0, 0, -45, 2,AAPTR_TARGET)
		PLSS B 2 bright
		loop
		Death:
		PLSE AAAAA 0 A_CustomMissile("PlasmaProjectile_Spread_Explode", 0, 0, random(0,359),2,random(90,-90))
		PLSE ABCDE 4 bright
		stop
	}
}

ACTOR PlasmaProjectile_Spread_Expand 
{
	Game Doom
	SpawnID 51
	Radius 13
	Height 8
	Speed 20
	Damage 5
	Projectile
	+RANDOMIZE
	+MTHRUSPECIES
	RenderStyle Add
	Alpha 0.75
	SeeSound "weap/apr/fire"
	DeathSound "weapons/plasmax"
	Obituary "$OB_MPPLASMARIFLE"
	DamageType MarineFire
	scale 0.6
	States
	{
		Spawn:
		PLSS AB 6 bright 
		TNT1 A 0 A_Fadeout(0.33)
		goto Spawn
		Death:
		PLSE ABCDE 4 bright A_FadeIn(1.0)
		stop
	}
}

ACTOR PlasmaProjectile_Spread_Explode : PlasmaProjectile_Spread_Expand
{
	Damage (3)
	scale 0.3
	Speed 25
	+StrifeDamage
	+NODAMAGETHRUST
	+ripper
      states
      {
		Spawn:
		PLSS AB 2 bright A_FadeOut(0.2)
		goto Spawn
      }
}


Actor Gauss_Puff 
{
	Radius				2
	Height				2
	DamageType			MarineFire
	+AlwaysPuff
	+NOINTERACTION
	+NODAMAGETHRUST
	
	states	
	{
	Spawn:
		TNT1 A 0
		PLSS A 3 BRIGHT A_Explode(10,16,0,0,16)
		PLSS B 2 BRIGHT
		PLSE AEE 2 BRIGHT
		stop
	Death:
		TNT1 A 1
		stop
	}
}