Actor PhaseBarrelMan : LegendaryBarrelMan
{
//Creator: Nemesiscaptain(uwu)and Makarov
//Origin: Nexus Infinity
//Sprite: PBMN
Monster
Health 4500
BloodColor "51 07 94"
Speed 45
Scale 1.2
Height 56
Radius 20
PainChance 50
Species "Zombies"
DamageFactor 0.6
DamageFactor "PlayerFireSword", 0.5
DamageFactor "PDTBFG", 0.25
DamageFactor "PDTBFGTracer", 0.25
DamageFactor "Cyber10K", 0.0
DamageFactor "Legendary", 0.0
DamageFactor "LegendaryGuru", 0.3
DamageFactor "LegendaryGuruPlayer", 0.3
DamageFactor "LegendaryPlayer", 0.3
DamageFactor "BFGSplash", 0.25
DamageFactor "BFGSpray", 0.3
DamageFactor "PlayerDevBall", 0.15
DamageFactor "PlayerDevBall2", 0.15
DamageFactor "PlayerDevTracer", 0.125
DamageFactor "DBFG", 0.3
DamageFactor "DBFG10K", 0.3
DamageFactor "DBFG10K2", 0.4
DamageFactor "PlayerDBFG", 0.3
DamageFactor "PlayerDBFG2", 0.4
DamageFactor "PlayerDBFG10K", 0.3
DamageFactor "PlayerDBFG10K2", 0.4
DamageFactor "UltimateLegendary", 0.5
DamageFactor "Extreme", 0.0
DamageFactor "PyroShot", 0.0
DamageFactor "PlayerPyro", 0.0
DamageFactor "PDTPuff", 0.0
DamageFactor "Ice", 0.3
DamageFactor "Fire", 0.0
DamageFactor "SuccubusThunder", 0
DamageFactor "ShadowFire", 0
DamageFactor "FreezerBurn", 0.0
DamageFactor "SuperWeapon", 0.0
DamageFactor "DemolisherEx", 0.0
DamageFactor "DarkDemoEx", 0.0
DamageFactor "CerChainguns", 0.0
DamageFactor "CerEnergyBall", 0.0
DamageFactor "LegMind", 0.0
DamageFactor "BeheComet", 0.0
DamageFactor "NobleComet", 0.0
DamageFactor "CacoComet", 0.0
DamageFactor "CadaverRocket", 0.0
DamageFactor "HellComet", 0.0
DamageFactor "Legendary1", 0.0
DropItem "HandGrenadeAmmo" 230 2
DropItem "MineAmmo" 240 2
DropItem "MineAmmo" 120 2
DropItem "Backpack" 200 1
DropItem "Armorplate" 240 1
DropItem "ArmorBooster" 240 3
DropItem "ArmorCharge" 240 5
DropItem "PortableMedCellPack" 100 1
DropItem "PortableMedCell", 200 1
DropItem "Portablemedkit" 240 1
DropItem "StimKit" 240 3
DropItem "HealthFlask" 240 5
DropItem "PhaseArmor" 120 1
DropItem "PhaseSphere" 100 1
Obituary "%o was obliterated by a walking, living warhead - the Phase Barrel Man."
Tag "\ctPhase BarrelMan\c-"
SeeSound ""
PainSound ""
DeathSound ""
ActiveSound "" 
var int user_music;
var int user_phased;
var int user_attackmode;
var int user_missile;
States
     {
  Spawn:
	PBMN A 0 A_SetTranslucent(0.15)
	TNT1 A 0 A_SpawnItem("PhaseCyberFlameSpawner",0,0,0,0)
	PBMN A 0 A_Look
	TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	TNT1 A 0 A_SpawnItem("PhaseCyberFlameSpawner",0,0,0,0)
	PBMN A 0 A_Look
	TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	Loop 
  Stalking:
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
    TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	PBMN AA 3 A_Chase("","")
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
    TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	PBMN BB 3 A_Chase("","")
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep",0,0,0,0)
    TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	PBMN CC 3 A_Chase("","")
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
    TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	PBMN DD 3 A_Chase("","")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep",0,0,0,0)
	Loop
   Seen:	
    P4BM AABB 8 A_SpawnItem("PhaseCyberFlameSpawner",0,0,0,0)
	TNT1 A 0 A_JumpIfInTargetLOS("Seen",130)
	Goto Stalking
  Idle:
	TNT1 A 0 A_ChangeFlag(NOPAIN,0)
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
	PBMN A 10 A_Look
	Loop
  See:
    TNT1 A 0
    TNT1 A 0 A_JumpIf(user_attackmode == 1,1)
	TNT1 A 0 A_JumpIf(user_music == 1,3)
	TNT1 A 0 ACS_NamedExecuteAlways("InfinityMusic",0,1773,300)
	TNT1 A 0 A_SetUserVar("user_music",1)
	Goto Seen
	TNT1 A 0 A_ChangeFlag(NOPAIN,0)
	TNT1 A 0 A_UnHideThing
	TNT1 A 0 A_SetShootable
    TNT1 A 0 A_JumpIfTargetInLOS("Strafing")
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
	PBMN AA 3 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
	PBMN BB 3 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
	TNT1 A 0 A_SpawnItem("LegendaryFootStep",0,0,0,0)
    TNT1 A 0 A_JumpIfTargetInLOS("Strafing")
	PBMN CC 3 A_Chase
	TNT1 A 0 A_Jump(80,"Phase")
	PBMN A 0 A_Jump(80,"Rush")
	TNT1 A 0 A_SpawnItemEx("PhaseCyberFlameSpawner")
	PBMN DD 3 A_Chase
	TNT1 A 0 A_SpawnItem("LegendaryFootStep",0,0,0,0)
	Loop
  Strafing:
	TNT1 A 0 A_SpawnItem("FootStep",0,0,0,0)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	PBMN AA 3 Bright A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	PBMN BB 3 Bright A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 A 0 A_SpawnItem("FootStep",0,0,0,0)
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	PBMN CC 3 Bright A_GiveInventory("PhaseZombieStrafing",1)  
	TNT1 A 0 A_Chase("","Missile",CHF_DONTMOVE)
	PBMN DD 3 Bright A_GiveInventory("PhaseZombieStrafing",1)
  Rush:
    PBMN A 0 A_JumpIfTargetInLOS("Strafing")
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("PhaseCyberFlameSpawner")
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostA")
	PBMN A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostA")
	PBMN A 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostB")
	PBMN B 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostB")
	PBMN B 1 A_Chase
	TNT1 A 0 A_Jump(80,"Phase")
	TNT1 A 0 A_SpawnItem("FootStep")
    TNT1 A 0 A_SpawnItem("PhaseCyberFlameSpawner")
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostC")
	PBMN C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostC")
	PBMN C 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostD")
	PBMN D 1 A_Chase
	TNT1 A 0 A_SpawnItemEx("PhaseBarrelManGhostD")
	PBMN D 1 A_Chase
	TNT1 A 0 A_SpawnItem("FootStep")
	TNT1 A 0 A_SpawnItem("PhaseCyberFlameSpawner")
	TNT1 A 0 A_Jump(84,"See")
	TNT1 A 0 A_SpawnItem("PhaseCyberFlameSpawner")
	Loop
  Phase:
	TNT1 A 0 A_PlaySound("phaseimp/teleport")
	PBMN E 2 A_FaceTarget
	PBMN E 1 A_SetTranslucent(0.75)
	PBMN E 1 A_SetTranslucent(0.55)
	PBMN E 1 A_SetTranslucent(0.35)
	PBMN E 1 A_SetTranslucent(0.20)
	Goto Phased
  UnPhase:
	TNT1 A 0 A_PlaySound("phaseimp/teleport")
	PBMN E 1 A_SetTranslucent(0.15)
	PBMN E 1 A_SetTranslucent(0.35)
	PBMN E 1 A_SetTranslucent(0.55)
	PBMN E 1 A_SetTranslucent(0.75)
	TNT1 A 0 A_SetTranslucent(1)
	PBMN E 2 A_FaceTarget
    Goto See
  Phased:
	PBMN AABBCCDDAABBCCDDAABBCCDDAABBCCDD 1 A_ExtChase(0,0)
	PBMN AABBCCDDAABBCCDD 1 A_Chase
	TNT1 A 0 A_Jump(24,"UnPhase")
	Goto Phased+32
  Pause:
	PBMN E 0 A_PlaySound("weapons/demontechsteam")
	PBMN EEEEE 3 A_GiveInventory("PhaseZombieStrafing",1)
	Goto See	
  Missile:
    TNT1 A 0 A_SetShootable
    TNT1 A 0 A_UnsetInvulnerable
    TNT1 A 0 A_SetTranslucent(1)
    PBMN EEEE 3 A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 A 0 A_Jump(20,"Rapid")
	PBMN E 3 A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 A 0 A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 AA 0 A_CustomMissile("ZPhaseDTProjectile",32,0,Frandom(-1,1),0)
	PBMN F 3 A_PlaySoundEx("weapons/demontechfire","Weapon")
	TNT1 A 0 A_Jump(24,"Pause")
	TNT1 A 0 A_SpidRefire
	Goto Missile+4	
  Rapid:
    PBMN EEEEEEEE 3 A_GiveInventory("PhaseZombieStrafing",1)
  RapidLoop:
    TNT1 A 0 A_JumpIf(user_missile == 20,"Pause")
    PBMN E 1 A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 AA 0 A_CustomMissile("ZPhaseDTProjectile",32,0,Frandom(-1,1),0)
	PBMN F 3 A_PlaySoundEx("weapons/demontechfire","Weapon")
	TNT1 A 0 A_PlayWeaponSound("BlueDTRFire")
	TNT1 A 0 A_SetUserVar("user_missile",user_missile+1)
	Loop
  Pain:
	PBMN L 3 	
	PBMN L 3 A_Pain
	TNT1 A 0 A_Jump(128,"Missile")
	Goto See   	
  PainMissile: 
	PBMN E 3 A_GiveInventory("PhaseZombieStrafing",1)
	TNT1 A 0 A_Pain
	PBMN E 3 A_GiveInventory("PhaseZombieStrafing",1)
	Goto Missile
  Death:
	PBMN H 1
	TNT1 AA 0 A_SpawnItemEx("MutantGibbedGenerator",Random(10,-10),Random(10,-10),Random(20,60),0,0,0,0,128,0)
	TNT1 AAA 0 A_CustomMissile("BigPurpleBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_radiusgive("PhaseMindfuck",330,RGF_PLAYERS)
	TNT1 A 0 Bright A_CustomMissile("PurpleKaboom", random(20,80), random(20,-20), random(0,360), 2, random(0,360))
	TNT1 AA 0 A_SpawnItemEx("MutantGibbedGenerator",Random(10,-10),Random(10,-10),Random(20,60),0,0,0,0,128,0)
	TNT1 AAA 0 A_CustomMissile("BigPurpleBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_radiusgive("PhaseMindfuck",330,RGF_PLAYERS)
	TNT1 A 0 Bright A_CustomMissile("PurpleKaboom", random(20,80), random(20,-20), random(0,360), 2, random(0,360))
	TNT1 AA 0 A_SpawnItemEx("MutantGibbedGenerator",Random(10,-10),Random(10,-10),Random(20,60),0,0,0,0,128,0)
	TNT1 AAA 0 A_CustomMissile("BigPurpleBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_radiusgive("PhaseMindfuck",330,RGF_PLAYERS)
	TNT1 A 0 Bright A_CustomMissile("PurpleKaboom", random(20,80), random(20,-20), random(0,360), 2, random(0,360))
	TNT1 AA 0 A_SpawnItemEx("MutantGibbedGenerator",Random(10,-10),Random(10,-10),Random(20,60),0,0,0,0,128,0)	
	TNT1 AAA 0 A_CustomMissile("BigPurpleBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_radiusgive("PhaseMindfuck",330,RGF_PLAYERS)
	TNT1 A 0 A_SpawnItemEx("PhaseSphere",0,0,12,Frandom(4,-4),Frandom(4,-4),Frandom(1,2),0,SXF_NOCHECKPOSITION,128)
	TNT1 A 0 Bright A_CustomMissile("PurpleKaboom", random(20,80), random(20,-20), random(0,360), 2, random(0,360))
	TNT1 AA 0 A_SpawnItemEx("MutantGibbedGenerator",Random(10,-10),Random(10,-10),Random(20,60),0,0,0,0,128,0)
	TNT1 AAA 0 A_CustomMissile("BigPurpleBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_radiusgive("PhaseMindfuck",330,RGF_PLAYERS)
	TNT1 A 0 Bright A_CustomMissile("PurpleKaboom", random(20,80), random(20,-20), random(0,360), 2, random(0,360))
	TNT1 AAAA 0 A_SpawnItemEx("MutantGibbedGenerator",Random(10,-10),Random(10,-10),Random(20,60),0,0,0,0,128,0)
	TNT1 AAAAAA 0 A_CustomMissile("BigPurpleBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 A 0 A_radiusgive("PhaseMindfuck",330,RGF_PLAYERS)
	TNT1 AAAAAAAA 0 A_CustomMissile("SmokeFX3", Random(20,80), 0, random(0,360), 2, random(0,360))	
	PBMN I 5 A_Scream
	PBMN JK 5 A_NoBlocking
	PBMN L 5
	PBMN M 5
	PBMN N -1
	Stop	
  	}
}

 ACTOR PhaseBarrelManGhostA
{
Scale 1.1
Radius 20
Height 56
Speed 0
Alpha 0.7
PROJECTILE
RENDERSTYLE Translucent
+NOTIMEFREEZE
+NOINTERACTION
+CLIENTSIDEONLY
+NONETID
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 A 1
	Goto Fade
  Fade:
	PBMN A 2 A_FadeOut(0.1,1)
	Loop
  Toaster:
	TNT1 A 1
	Stop
	}
}

ACTOR PhaseBarrelManGhostB : PhaseBarrelManGhostA
{   
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 A 1
	Goto Fade
  Fade:
	PBMN B 2 A_FadeOut(0.1,1)
	Loop
  }
}

ACTOR PhaseBarrelManGhostC : PhaseBarrelManGhostA
{   
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 A 1
	Goto Fade
  Fade:
	PBMN C 2 A_FadeOut(0.1,1)
	Loop
  }
}

ACTOR PhaseBarrelManGhostD : PhaseBarrelManGhostA
{   
States
{
  Spawn:
	TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(304) == 1, "NULL")
	TNT1 A 1
	Goto Fade
  Fade:
	PBMN D 2 A_FadeOut(0.1,1)
	Loop
  }
}

Actor ZPhaseDTProjectile 
{
   Height 4
   Radius 4
   Speed 50
   Damage 10
   Scale 0.06
   PROJECTILE
   +THRUSPECIES
   +FORCERADIUSDMG
   DamageType "ZombieDemonTech"
   DeathSound "weapons/demontechex"
   Decal PDTRScorch
   States
   {
   Spawn:
	  TNT1 A 0 A_SeekerMissile(12,0)
	  TNT1 A 0
	  TNT1 A 0 A_Jump(128,"Spawn2")
   Normal:
	  TNT1 A 0 A_SeekerMissile(12,0)
   	  TNT1 A 0 A_Jump(128,"NormalFX")
      PTPR A 1 Bright A_SpawnItemEx("PhaseSentryDemonTechTrail",Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-20,20),128)
      Loop
   NormalFX:
      PTPR A 1 Bright A_SpawnItemEx("PhaseSentryDemonTechTrail",Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-20,20),128)
      PTPR A 1 Bright A_SpawnItemEx("PhaseSentryDemonTechTrail",Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-20,20),128)
      Goto Normal
   Spawn2:
	  TNT1 A 0 A_SeekerMissile(12,0)
	  TNT1 A 0 A_Jump(128,"Spawn2FX")
      PTPR A 1 Bright A_SpawnItemEx("PhaseSentryDemonTechTrail2",Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-20,20),128)
      Loop
   Spawn2FX:
      PTPR A 1 Bright A_SpawnItemEx("PhaseSentryDemonTechTrail",Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-20,20),128)
      PTPR A 1 Bright A_SpawnItemEx("PhaseSentryDemonTechTrail",Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-1,1),Random(-20,20),128)
      Goto Spawn2
   Death:
   	  TNT1 A 0
	  TNT1 A 0 A_radiusgive("PhaseMindfuck",100,RGF_PLAYERS)
	  TNT1 A 0 A_SpawnItemEx("PhaseSentryDemonTechEx",0,0,0,0,0,0,0,128,0)
	  TNT1 AAA 0 A_CustomMissile("Kaboom8", 0, 0, random(0,360), 2, random(0,360))
	  TNT1 AAA 0 A_CustomMissile("SmokeFX4", 0, 0, random(0,360), 2, random(0,360))
	  TNT1 A 1 Bright A_Explode(20,64)
      Stop
	}
}

Actor PhaseZombieStrafing : CustomInventory
{
-COUNTITEM
+NOTIMEFREEZE
+INVENTORY.QUIET
+INVENTORY.UNDROPPABLE
+INVENTORY.ALWAYSPICKUP
+INVENTORY.AUTOACTIVATE
Inventory.Amount 1
Inventory.MaxAmount 0
States
  {
  Pickup:
	NULL A 1 
	NULL A 1 A_SpawnItemEx("PhaseCyberFlameSpawner")
	NULL A 1 A_Jump(188,2)
	NULL A 1 A_GiveInventory("LegZombieJumping",1)
	NULL A 1 A_JumpIf(velx != 0 || vely != 0,2)
	NULL A 1 A_Jump(256,2)
	NULL A 1 A_Jump(235,5)
	NULL A 1 A_JumpIfInventory("LegZombieStrafeSens",1,3)
	NULL A 1 A_GiveInventory("LegZombieStrafeSens",1)
	NULL A 1 A_Jump(256,2)  
	NULL A 1 A_TakeInventory("LegZombieStrafeSens",1)
	NULL A 1 A_JumpIfInventory("LegZombieStrafeSens",1,3)
	NULL A 1 ThrustThing(angle*256/360+38.7,3,0,0)
	NULL A 1 A_Jump(256,2)  
	NULL A 1 ThrustThing(angle*256/360+38.7,-3,0,0)
	NULL A 1 A_FaceTarget
	NULL A 1 A_Jump(24,2)
	NULL A 1 A_JumpIfCloser(300,2)
	NULL A 1 A_Recoil(-1)
	Stop
	NULL A 1 A_Recoil(1)
	Stop  
  }
}
