/*
CREDITS:

Sprites:
Source - Volition (Red Faction)
Rip and edits by Woodchuck

Sounds:
Up, Fire - Ubisoft (WillRock)
Add Fire - Raven, I think? (Wolfenstein 3)
Start, Buzz, Exp, Shield Loop, Shield Button, Shield Detonate - Raven (Wolfenstein 3)
Boom - ?
Hit1-Hit3, Nope - ID (Doom 3)
Deploy - ?
*/

ACTOR Vindicator : Weapon 24527
{
   //$Category Weapons
   //$Title Vindicator
   //$Sprite ATMGX0
   Inventory.PickupSound "misc/w_pkup"
   Inventory.PickupMessage "You got the ''Vindicator'' Plasma Tantrum Cannon Prototype! I swear I could just kill everyone around me...... so I did. HAAAA-HAHAHAHAHAHAAA! (8)"
   Obituary "%o was evaporated by unstable plasma eruption, thanks to %k's ''Vindicator''."
   Weapon.SelectionOrder 1
   Weapon.UpSound "Weapons/VindicatorUp"
   Weapon.AmmoGive 100
   Weapon.AmmoType "PlasmaAmmo"
   Weapon.AmmoUse 100
   Weapon.AmmoType2 "PlasmaAmmo"
   Weapon.AmmoUse2 20
   Weapon.Kickback 100
   Weapon.SlotNumber 8
   Scale 0.65
   States
   {
   Spawn:
      ATMG X -1
      Stop
   Ready:
      ATMG EDCBA 2
      Goto ReadyMain
   ReadyMain:
      ATMG A 1 A_WeaponReady
      Loop
   Deselect:
      ATME B 0 A_ZoomFactor(1)
      ATME B 0 A_Lower
      ATME B 1 A_Lower
      Loop
   Select:
      ATME A 0 A_Raise
      ATME A 1 A_Raise
      Loop
   Fire:
      ATMF A 0 A_AlertMonsters
      ATMF A 0 A_Recoil(35)
      ATMF A 0 A_PlaySound("Weapons/VindicatorFire",1,0.8)
      ATMF A 0 A_GunFlash
      ATMF A 0 A_FireCustomMissile("VindicatorBomb",0,1,15,7)
      ATMF A 0 ACS_Execute(851,0,120+random(20,-20),80+random(15,-15))
      ATMF A 1 Bright A_ZoomFactor(0.95)
      ATMF A 0 A_PlaySound("Weapons/VindicatorAddFire",5,0.5,0)
      ATMF A 0 A_PlaySound("Weapons/VindicatorAddFire",6,0.9,0)
      ATMF B 1 Bright A_ZoomFactor(0.8)
      ATMF C 1 Bright A_ZoomFactor(0.65)
      ATMF D 1 Bright A_ZoomFactor(0.7)
      ATMF E 1 Bright A_ZoomFactor(0.75)
      ATMF F 1 Bright A_ZoomFactor(0.8)
      ATMF G 1 A_ZoomFactor(0.85)
      ATMF H 1 A_ZoomFactor(0.95)
      ATMF I 1 A_ZoomFactor(0.96)
      ATMF J 1 A_ZoomFactor(0.97)
      ATMF K 1 A_ZoomFactor(0.98)
      ATMF L 1 A_ZoomFactor(0.99)
      ATMF M 1 A_ZoomFactor(1)
      ATMF NOPQRS 1
      ATMF T 1
      ATML ABCD 2
      ATML E 8
      ATML DCBA 2
      ATMF T 6
      ATMG A 6
      Goto ReadyMain
   AltFire:
      ATMF A 0 A_JumpIfInventory("SanctumInAir",1,"SanctumHeckNo")
   SanctumDeployCheck:
      ATMF A 0 A_JumpIfInventory("SanctumDeployed",1,"SanctumOperational")
   DeployingSanctum:
      ATMF A 0 A_GiveInventory("SanctumDeployed",1)
      ATMF A 0 A_AlertMonsters
      ATMF A 0 A_Recoil(25)
      ATMF A 0 A_PlaySound("Weapons/VindicatorFire",1,0.8)
      ATMF A 0 A_GunFlash
      ATMF A 0 A_FireCustomMissile("VindicatorSanctumProjectile",0,1,15,7)
      ATMF A 0 ACS_Execute(851,0,120+random(20,-20),80+random(15,-15))
      ATMF A 1 Bright A_ZoomFactor(0.95)
      ATMF B 1 Bright A_ZoomFactor(0.9)
      ATMF C 1 Bright A_ZoomFactor(0.8)
      ATMF D 1 Bright A_ZoomFactor(0.7)
      ATMF E 1 Bright A_ZoomFactor(0.75)
      ATMF F 1 Bright A_ZoomFactor(0.8)
      ATMF G 1 A_ZoomFactor(0.85)
      ATMF H 1 A_ZoomFactor(0.95)
      ATMF I 1 A_ZoomFactor(0.96)
      ATMF J 1 A_ZoomFactor(0.97)
      ATMF K 1 A_ZoomFactor(0.98)
      ATMF L 1 A_ZoomFactor(0.99)
      ATMF M 1 A_ZoomFactor(1)
      ATMF NOPQRS 1
      ATMF T 1
      ATML ABCD 2
      ATML E 8
      ATML DCBA 2
      ATMF T 6
      ATMG A 6
      Goto ReadyMain
    SanctumOperational:
      ATMG A 0 A_PlaySound("Weapons/VindicatorButton",5,0.8)
      ATMF T 16 A_GiveInventory("SanctumTrigger",1)
      ATMG A 16 A_TakeInventory("SanctumTrigger",1)
      Goto ReadyMain
    SanctumHeckNo:
      TNT1 A 0 A_PlaySound("Weapons/VindicatorNope")
      ATMN A 3
      ATMG A 2
      ATMN A 3
      ATMG A 2
      ATMN A 3
      ATMG A 2
      ATMG A 6
      Goto ReadyMain
   }
}

//PROJECTILE

ACTOR VindicatorBomb : FastProjectile
{
   Radius 13
   Height 8
   Damage 40
   Speed 65
   Projectile
   Obituary "%o was evaporated by unstable plasma eruption, thanks to %k's ''Vindicator''."
   +FORCERADIUSDMG
   +EXPLODEONWATER
   MissileType "VindicatorSmokeTrailSpawner"
   DamageType "Superweapon"
   Scale 0.5
   States
   {
   Spawn:
      ATMP A 0
      ATMP A 0 ThrustThingZ(0,20,0,1)
   Looplet:
      ATMP A 1 A_SpawnItemEx("VindicatorTrailA",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-4),0,1)
      ATMP B 1 A_SpawnItemEx("VindicatorTrailB",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-4),0,1)
      ATMP C 1 A_SpawnItemEx("VindicatorTrailC",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-4),0,1)
      ATMP D 1 A_SpawnItemEx("VindicatorTrailD",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-4),0,1)
      ATMP E 1 A_SpawnItemEx("VindicatorTrailE",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-4),0,1)
      Loop
   Death:
      TNT1 A 0 A_SpawnItemEx("VindicatorImpactSpawner",0,0,40,0,0,0,0,128,0)
      TNT1 A 0 A_SpawnItemEx("VindicatorImpactConstant",0,0,40,0,0,0,0,128,0)
      TNT1 A 0 A_SpawnItemEx("VindicatorDamager",0,0,40,0,0,0,0,0,0)
      //TNT1 A 0 A_SpawnItemEx("VindicatorSmoker",0,0,40,0,0,0,0,128,0)
      TNT1 A 0 A_SpawnItemEx("VindicatorAfterSmoker",0,0,40,0,0,0,0,128,0)
      TNT1 A 0 A_SpawnItemEx("VindicatorSerpentineSpawner",0,0,40,0,0,0,0,128,0)
      TNT1 A 0 A_SpawnItemEx("VindicatorUberBlast",0,0,40,0,0,0,0,128,0)
      TNT1 A 0 A_SpawnItemEx("VindicatorDamageBlast",0,0,40,0,0,0,0,0,0)
      Stop
   }
}

ACTOR VindicatorTrailA
{ 
    +NOGRAVITY
    +NOINTERACTION
	+CLIENTSIDEONLY
    Renderstyle Add
    Scale 0.5
    Alpha 0.7
    States
    {
    Spawn:
      TNT1 A 0
      ATMP A 1 A_FadeOut(0.1)
      Wait
    }
}

ACTOR VindicatorTrailB : VindicatorTrailA
{ 
    States
    {
    Spawn:
      TNT1 A 0
      ATMP B 1 A_FadeOut(0.1)
      Wait
    }
}

ACTOR VindicatorTrailC : VindicatorTrailA
{ 
    States
    {
    Spawn:
      TNT1 A 0
      ATMP C 1 A_FadeOut(0.1)
      Wait
    }
}

ACTOR VindicatorTrailD : VindicatorTrailA
{ 
    States
    {
    Spawn:
      TNT1 A 0
      ATMP D 1 A_FadeOut(0.1)
      Wait
    }
}

ACTOR VindicatorTrailE : VindicatorTrailA
{ 
    States
    {
    Spawn:
      TNT1 A 0
      ATMP E 1 A_FadeOut(0.1)
      Wait
    }
}

ACTOR VindicatorSmokeTrailSpawner
{ 
    +NOGRAVITY
    +NOINTERACTION
	+CLIENTSIDEONLY
    States
    {
    Spawn:
      TNT1 A 0
      TNT1 A 0 A_SpawnItemEx("VindicatorSmokeTrail",-19,0.4*random(10,-10),8,frandom(-1,-0.5),0,0,0,128,0)
      TNT1 A 1
      Stop
    }
}

ACTOR VindicatorSmokeTrail
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	Renderstyle Add
	Alpha 0.18
	Scale 0.15
	States
	{
	Spawn:
	SMKE ABCDEFGHJIKLMNOPQ 1 A_FadeOut(0.01)
	Stop
	}
}

//EXPLOSION

ACTOR VindicatorImpactSpawner
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	ReactionTime 25
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("VindicatorImpact",random(180,-180),random(180,-180),random(180,-180),frandom(1,0.5),frandom(1,0.5),frandom(-1,1),random(0,359),128,0)
	TNT1 A 0 A_Countdown
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorImpactConstant
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	ReactionTime 400
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_PlaySoundEx("Weapons/VindicatorStart","SoundSlot6",0)
	TNT1 A 0 A_PlaySoundEx("Weapons/VindicatorBuzz","SoundSlot5",1)
	Looplet:
	TNT1 A 0 A_SpawnItemEx("VindicatorImpact",random(200,-200),random(200,-200),random(200,-200),frandom(1,0.5),frandom(1,0.5),frandom(-1,1),random(0,359),128,0)
	TNT1 A 1 A_Countdown
	Loop
	Death:
	TNT1 A 0 A_StopSoundEx("SoundSlot5")
	Stop
	}
}

ACTOR VindicatorImpact
{
	Projectile
	+NOGRAVITY
	+CLIENTSIDEONLY
	Renderstyle Add
	Scale 4
	States
	{
	Spawn:
	ATGT ABCDEFGHJIKMNOPQRSTUVW 1 Bright //A_SetScale(ScaleX+0.1,ScaleY+0.1)
	ATGT XYZ 1 Bright A_FadeOut(0.1)
	ATGU ABCDE 1 Bright A_FadeOut(0.1)
	Stop
	}
}

ACTOR VindicatorDamager
{
	+NOINTERACTION
	+NOGRAVITY
	ReactionTime 200
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("VindicatorExplodium",random(200,-200),random(200,-200),random(200,-200),frandom(1,0.5),frandom(1,0.5),frandom(-1,1),random(0,359),0,0)
	TNT1 A 2 A_Countdown
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorExplodium
{
	Projectile
	+NOGRAVITY
	+FORCERADIUSDMG
	DamageType "Superweapon"
	States
	{
	Spawn:
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAA 1 A_Explode(500,256)
	Stop
	}
}

ACTOR VindicatorSmoker
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	ReactionTime 200
	States
	{
	Spawn:
	TNT1 AA 0 A_SpawnItemEx("VindicatorSmoke",random(240,-240),random(240,-240),random(225,-225),frandom(1,0.5),frandom(1,0.5),frandom(-1,1),random(0,359),128,0)
	TNT1 A 2 A_Countdown
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorAfterSmoker
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	ReactionTime 120
	States
	{
	Spawn:
	TNT1 A 370
	Looplet:
	TNT1 AA 0 A_SpawnItemEx("VindicatorSmoke",random(230,-230),random(230,-230),random(215,-215),frandom(1,0.5),frandom(1,0.5),frandom(-1,1),random(0,359),128,0)
	TNT1 A 1 A_Countdown
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorSmoke
{ 
    Scale 2
    Alpha 0.9
    RenderStyle Add
    +NOINTERACTION
	+CLIENTSIDEONLY
    +NOGRAVITY
    +THRUGHOST
    +DONTSPLASH
    States
    {
    Spawn:
      ISMK A 0
      ISMK A 0 A_Jump(255,"SmokeA","SmokeB","SmokeC","SmokeD","SmokeE","SmokeF","SmokeG","SmokeH","SmokeI","SmokeJ","SmokeK")
    SmokeA:
      ISMK A 0 A_FadeOut(0.025)
      ISMK A 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeB:
      ISMK A 0 A_FadeOut(0.025)
      ISMK B 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeC:
      ISMK A 0 A_FadeOut(0.025)
      ISMK C 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeD:
      ISMK A 0 A_FadeOut(0.025)
      ISMK D 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeE:
      ISMK A 0 A_FadeOut(0.025)
      ISMK E 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeF:
      ISMK A 0 A_FadeOut(0.025)
      ISMK F 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeG:
      ISMK A 0 A_FadeOut(0.025)
      ISMK G 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeH:
      ISMK A 0 A_FadeOut(0.025)
      ISMK H 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeI:
      ISMK A 0 A_FadeOut(0.025)
      ISMK I 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeJ:
      ISMK A 0 A_FadeOut(0.025)
      ISMK J 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    SmokeK:
      ISMK A 0 A_FadeOut(0.025)
      ISMK A 3 //A_SetScale(ScaleX +0.005, ScaleY +0.005)
      Loop
    }
}

ACTOR VindicatorSerpentineSpawner
{
	+NOINTERACTION
	+NOGRAVITY
	ReactionTime 380
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 AAA 0 A_SpawnItemEx("VindicatorSerpentine",random(180,-180),random(180,-180),random(180,-180),frandom(1,0.5),frandom(1,0.5),frandom(1,0.5),random(0,359),128,0)
	TNT1 A 1 A_Countdown
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorSerpentine// : FastProjectile
{
  Radius 1
  Height 1
  PROJECTILE
  BounceType Hexen
  //MissileType "VindicatorSerpentineTrail"
  ReactionTime 45
  +CANBOUNCEWATER
  Renderstyle Add
  Scale 1
  States
  {
  Spawn:
    VINF A 0
    VINF A 0 A_SpawnItemEx("VindicatorTrailSpawner",0,0,0,0,0,0,0,128,0)
    VINF A 0 A_ChangeVelocity (frandom(-4, 4), frandom(-4, 4), frandom(-2, 2), 0)
    VINF A 0 A_Jump(128,2)
    VINF A 0 A_Countdown
    VINF A 1 Bright
    Loop
  Death:
    TNT1 A 1 A_CustomMissile("VindicatorSeductor",0,0,0,4,0)
    Stop
  }
}

ACTOR VindicatorSerpentineTrail
{
  Scale 0.5
  Alpha 1
  RenderStyle Add
  +NOINTERACTION
  +CLIENTSIDEONLY
  States
  {
  Spawn:
    VINR A 0
    VINR A 0 A_FadeOut(0.1)
    VINR A 1 //A_SetScale(ScaleX+0.075, ScaleY+0.075)
    Loop
  }
}

ACTOR VindicatorTrailSpawner
{
  +NOGRAVITY
  +NOINTERACTION
  +CLIENTSIDEONLY
  States
  {
  Spawn:
    TNT1 A 0
    TNT1 A 1 A_SpawnItemEx("VindicatorSerpentineTrail", frandom(-4, 4), frandom(-4, 4), frandom(-3, 3), 0, 0, 0, 0, 128, 0)
    stop
  }
}

ACTOR VindicatorSeductor
{
   Radius 0
   Height 0
   +ISMONSTER
   +FRIENDLY
   +LOOKALLAROUND
   +NOBLOCKMONST
   +NOGRAVITY
   +NOINTERACTION
   +NOCLIP
   States
   {
   Spawn:
      TNT1 A 0
      TNT1 A 1 A_LookEx(0,0,3072,3072,0,"See")
      TNT1 A 1 A_SpawnItemEx("VindicatorHit",0,0,0,0,0,0,0,128,0)
      Stop
   See:
   Missile:
      TNT1 A 0 A_FaceTarget
      TNT1 A 1 A_CustomMissile("VindicatorProjectile",0,0,0)
      Stop
   XDeath:
      TNT1 A 1
      stop
   Death:
      TNT1 A 1
      stop
   }
}

Actor VindicatorProjectile //: FastProjectile
{
  Speed 100
  Radius 11
  Height 8
  Damage 125
  PROJECTILE
  //MissileType "VindicatorTrailSpawner"
  Obituary "%k burned down by %o like a house, because %g didn't want %p goddamn lemons."
  DamageType Nope
  Renderstyle Add
  Scale 1
  +SEEKERMISSILE
  +NOGRAVITY
  +FORCERADIUSDMG
  +EXPLODEONWATER
  states
  {
  Spawn:
    TNT1 A 0
    VINF A 0 A_SpawnItemEx("VindicatorTrailSpawner",0,0,0,0,0,0,0,128,0)
    VINF A 1 Bright
    Loop
  Death:
    TNT1 A 0 A_PlaySound("Weapons/VindicatorHit")
    TNT1 A 0 A_Explode(150,164,0,1)
    TNT1 A 1 A_SpawnItemEx("VindicatorHit",0,0,0,0,0,0,0,128,0)
    stop
  }
}

ACTOR VindicatorHit
{
  Scale 0.5
  Alpha 1
  RenderStyle Add
  +NOINTERACTION
  +CLIENTSIDEONLY
  States
  {
  Spawn:
    VINR A 0
    VINR AA 0 A_SpawnItemEx("VindicatorSmoke",random(3,-3),random(3,-3),random(3,-3),frandom(0.5,0.25),frandom(0.5,0.25),frandom(0.5,0.25),random(0,359),128,0)
  Looplet:
    VINR A 0 A_FadeOut(0.05)
    VINR A 1 //A_SetScale(ScaleX+0.25, ScaleY+0.25)
    Loop
  }
}

ACTOR VindicatorUberBlast
{
	+NOINTERACTION
	+NOGRAVITY
	+CLIENTSIDEONLY
	ReactionTime 500
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 397
	TNT1 A 1 A_PlaySoundEx("Weapons/VindicatorExplosion",5)
	TNT1 A 0 A_PlaySoundEx("Weapons/VindicatorKaboom",6)
	Looplet:
	TNT1 A 0 A_SpawnItemEx("VindicatorBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),128,0)
	TNT1 A 0 A_Countdown
	Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorDamageBlast
{
	+NOINTERACTION
	+NOGRAVITY
	ReactionTime 400
	States
	{
	Spawn:
	TNT1 A 0
	TNT1 A 398
	Looplet:
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("VindicatorExplodiumBlast",random(120,-120),random(120,-120),random(160,-160),random(45,50),random(45,50),random(-8,8),random(0,359),0,0)
	//TNT1 A 0 A_Countdown
	//Loop
	Death:
	TNT1 A 1
	Stop
	}
}

ACTOR VindicatorBlast
{
	+NOINTERACTION
	+CLIENTSIDEONLY
	+NOGRAVITY
	Renderstyle Add
	Scale 4
	States
	{
	Spawn:
	ATGT A 0
	ATGT A 0 A_Jump(164,4,3,2,1)
	ATGT ABCDEFGHJIKMNOPQRSTUVW 1 Bright //A_SetScale(ScaleX+0.15,ScaleY+0.15)
	ATGT XYZ 3 Bright A_FadeOut(0.1)
	ATGU ABCDE 4 Bright A_FadeOut(0.1)
	Stop
	}
}

ACTOR VindicatorExplodiumBlast
{
	+NOINTERACTION
	+NOGRAVITY
	+FORCERADIUSDMG
	Renderstyle Add
	DamageType "Superweapon"
	Scale 4
	States
	{
	Spawn:
	ATGT A 0
	ATGT A 0 A_Jump(164,4,3,2,1)
	TNT1 AAAAAAAAAAAAAAAAAAAAAA 1 A_Explode(300,256)
	TNT1 AAAAAAAAA 1 A_Explode(300,256)
	TNT1 AAAAAAAAAAAAAAAAAAAA 1 A_Explode(300,256)
	Stop
	}
}


////////////
//ALT-FIRE// VINDICATOR SANCTUARY
////////////



ACTOR SanctumDeployed : Inventory
{
     Inventory.MaxAmount 1
}

ACTOR SanctumTrigger : Inventory
{
     Inventory.MaxAmount 1
}

ACTOR SanctumInAir : Inventory
{
     Inventory.MaxAmount 1
}

ACTOR VindicatorSanctumProjectile : FastProjectile
{
   Radius 11
   Height 7
   Damage 40
   Speed 55
   Projectile
   Obituary "%o was somehow killed by %k's ''Vindicator'' sanctuary deployer."
   +FORCERADIUSDMG
   +EXPLODEONWATER
   +SKYEXPLODE
   +DONTBLAST
   MissileType "VindicatorSmokeTrailSpawner"
   Scale 0.4
   States
   {
   Spawn:
      ATMP A 0
      ATMP A 0 A_GiveToTarget("SanctumInAir",1)
      ATMP A 0 ThrustThingZ(0,20,0,1)
   Looplet:
      ATMP A 1 A_SpawnItemEx("VindicatorTrailA",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-3),0,1)
      ATMP B 1 A_SpawnItemEx("VindicatorTrailB",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-3),0,1)
      ATMP C 1 A_SpawnItemEx("VindicatorTrailC",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-3),0,1)
      ATMP D 1 A_SpawnItemEx("VindicatorTrailD",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-3),0,1)
      ATMP E 1 A_SpawnItemEx("VindicatorTrailE",0,0,0,0,0,0,0,128,0)
      ATMP A 0 ThrustThingZ(0,random(-2,-3),0,1)
      Loop
   Death:
      TNT1 A 0 A_PlaySound("Weapons/VindicatorDeploy",5)
      TNT1 A 0 A_ChangeFlag("MISSILE",0)
      TNT1 A 0 A_ChangeFlag("NOBLOCKMAP",0)
      TNT1 A 0 A_ChangeFlag("NOCLIP",1)
      TNT1 A 0 A_ChangeFlag("NOINTERACTION",1)
      ATMP E 1
      ATMP E 1
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)

      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,20)

      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,40)

      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,60)

      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,80)

      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,-20)

      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,-40)

      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)
      TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,-60)

      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,40,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,80,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,120,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,160,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-20,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-60,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-100,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      //TNT1 A 0 A_CustomMissile("RepulsionBall",0,0,-140,CMF_AIMDIRECTION|CMF_TRACKOWNER,-80)
      TNT1 A 0 A_CustomMissile("RepulsionBall0",0,0,0,CMF_AIMDIRECTION|CMF_TRACKOWNER,0)
      ATMP E 1 A_FadeOut(0.1)
      stop
   }
}

ACTOR RepulsionBall0
{
   Projectile
   Obituary "%o was blasted by %k's ''Vindicator'' plasmic sanctuary."
   +DONTBLAST
   +NOINTERACTION
   States
   {
   Spawn:
      ATMP A 0
      TNT1 AAAAA 5
      Goto Death
   Death:
      TNT1 A 0 A_ChangeFlag("MISSILE",0)
      TNT1 A 0 A_ChangeFlag("NOBLOCKMAP",0)
      TNT1 A 0 A_Stop
      TNT1 AAAA 2
      TNT1 A 1
      Goto Veni
   Veni:
      TNT1 A 0 A_PlaySound("Weapons/VindicatorSanctum",6,0.8,1)
      TNT1 AA 1 A_JumpIfInTargetInventory("SanctumTrigger", 1, "Vidi")
      TNT1 A 0  A_Blast(BF_AFFECTBOSSES, 64, 406, 15, "BlastEffect", None)
      TNT1 AA 1 A_JumpIfInTargetInventory("SanctumTrigger", 1, "Vidi")
      TNT1 A 0  A_Blast(BF_AFFECTBOSSES, 64, 406, 15, "BlastEffect", None)
      TNT1 AA 1 A_JumpIfInTargetInventory("SanctumTrigger", 1, "Vidi")
      TNT1 A 0  A_Blast(BF_AFFECTBOSSES, 64, 406, 15, "BlastEffect", None)
      TNT1 AA 1 A_JumpIfInTargetInventory("SanctumTrigger", 1, "Vidi")
      TNT1 A 0  A_Blast(BF_AFFECTBOSSES, 64, 406, 15, "BlastEffect", None)
      TNT1 AA 1 A_JumpIfInTargetInventory("SanctumTrigger", 1, "Vidi")
      TNT1 A 0  A_Blast(BF_AFFECTBOSSES, 64, 406, 15, "BlastEffect", None)
      
      TNT1 A 0 A_TakeFromTarget("SanctumInAir",1)
      Loop
   Vidi:
      TNT1 A 0 A_TakeFromTarget("SanctumDeployed",1)
      TNT1 A 0 A_PlaySound("Weapons/BlasterEnd",6,1.0,0)
      TNT1 A 0 A_PlaySound("Weapons/VindicatorSanctExp",5,0.8,0)
      TNT1 A 0  A_Blast(BF_AFFECTBOSSES, 64, 512, 15, "BlastEffect", None)
      stop
   }
}

ACTOR RepulsionBall
{
   Damage 0
   Speed 10
   Projectile
   Renderstyle Add
   Alpha 0.5
   Obituary "%o was blasted by %k's ''Vindicator'' plasmic sanctuary."
   +DONTBLAST
   +NOINTERACTION
   +NOCLIP
   Scale 0.6
   States
   {
   Spawn:
      ATMP A 0
      BLSB MMMMM 5 Bright A_SpawnItemEx("BlasterRing",0,0,0,0,0,0,0,128,0)
      Goto Death
   Death:
      TNT1 A 0 A_ChangeFlag("MISSILE",0)
      TNT1 A 0 A_ChangeFlag("NOBLOCKMAP",0)
      TNT1 A 0 A_Stop
      BLSB LKJI 2 Bright A_FadeIn(0.05)
      Goto Veni
   Veni:
      ATMP E 0 A_SpawnItemEx("RepBallConstantSmokeSpawner",0,0,0,0,0,0,0,128,0)

      BLSB AABBCCDDEEFFGGHH 1 Bright A_JumpIfInTargetInventory("SanctumTrigger", 1, "Vidi")
      Loop
   Vidi:
      TNT1 A 0 A_TakeFromTarget("SanctumDeployed",1)
      TNT1 A 0 A_SpawnItemEx("VindicatorHit",0,0,0,0,0,0,0,128,0)
      TNT1 AAAAA 0 A_SpawnItemEx("BlasterVortexParticle",frandom(12,-12),frandom(12,-12),frandom(12,-12),frandom(2.25,3),frandom(2.25,3),frandom(-1,4),frandom(0,359),128,0)
      BLSB IJKLM 2 Bright A_FadeOut(0.05)
      stop
   }
}

ACTOR RepBallConstantSmokeSpawner
{ 
    ReactionTime 8
    +DONTBLAST
    +NOGRAVITY
    +NOINTERACTION
	+CLIENTSIDEONLY
    States
    {
    Spawn:
      TNT1 A 0
      TNT1 A 0 A_Countdown
      //TNT1 A 0 A_Jump(128,2)
      TNT1 A 0 A_SpawnItemEx("BlasterSmokey",frandom(23,-23),frandom(23,-23),frandom(23,-23),frandom(-2,2),frandom(-2,2),frandom(-2,2),frandom(0,359),128,0)
      TNT1 A 1
      Loop
    Death:
      TNT1 A 1
      Stop
    }
}
