actor SMGReichLover : GenericHumanScum 
{
  scale 1.0
  obituary "%o was slayed by the enraged Reichlover with SMG" 
  health 55
  radius 15
  height 54
  mass 100
  speed 11
  Damage 1
  Species "IMP"
+DONTHARMSPECIES
  painchance 170
  SeeSound "ReichLover/See"
  PainSound "ReichLover/pain"
  DeathSound "ReichLover/Death"
  ActiveSound "ReichLover/Active"
  Tag "SMG Reich Lover"
  //+DROPOFF
  MONSTER
  +FLOORCLIP
  states
  {
  Spawn:
    TNT1 A 0
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("STFUCheck") == 1, "STFU")
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult ("VanJumpCheck") == 1, "VanJump")
    TNT1 A 0 A_SetScale (scaleX+frandom(-0.02, 0.02), scaleY+frandom(-0.08,0.08)) 
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
	TNT1 A 0 A_SpawnItemEx ("SiegWRITER", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION, 69)
  Spawn2:
    SMNA A 10 A_Look
    loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUReichLover")
	 Goto Spawn+2
  VanJump:
	 TNT1 A 0
	 TNT1 A 0  NODELAY ACS_NamedExecuteAlways ("VanillaHeights")
	Goto Spawn+3	 
  See:
     "####" A random(1,4)
	 TNT1 A 0 A_Jump (70, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	 TNT1 A 0 A_Jump (180, "MissileCheck")
  SeeLoop:
	TNT1 A 0 A_CheckSight ("CheckReload")
	TNT1 A 0 A_Jump (170, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 20, "Reload")
    SMNA AABBCCDD 3 A_Chase
    loop	
  MissileCheck:
    TNT1 A 0
	TNT1 A 0 A_JumpIfTargetInLos ("ShortBurst", 50, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 750)
	Goto SeeLoop
    CheckReload:
    TNT1 A 0 A_Jump (150, "CheckReload2")
 	Goto SeeLoop+1
  CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 20, "Reload")
	Goto SeeLoop+1
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    SMNA AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (120, "MissileCheck2")
		TNT1 A 0 A_Jump (50, "DodgeRight")
		Goto SeeLoop+1
	DodgeLeftF:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil (random (-8,-3))
	    SMNA AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (120, "MissileCheck2")
		Goto SeeLoop+1
    DodgeLeftB:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil (random (3,8))
	    SMNA AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (120, "MissileCheck2")
		Goto SeeLoop+1
	DodgeRight:
	    TNT1 A 0 A_FaceTarget
	    SMNA AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "MissileCheck2")
		Goto SeeLoop+1
	DodgeRightF:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil ( random (-8,-3)) 
	    SMNA AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "MissileCheck2")
		Goto SeeLoop+1
	DodgeRightB:
	    TNT1 A 0 A_FaceTarget
	    TNT1 A 0 ThrustThingZ (0, 15, 0, 0)
	    TNT1 A 0 A_Recoil ( random (3,8)) 
	    SMNA AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (100, "MissileCheck2")
		Goto SeeLoop+1			
   Retreat:
    TNT1 A 0 A_Changeflag ("FRIGHTENED", 1)
	TNT1 A 0 A_ChangeFlag ("Missilemore", 1)
	TNT1 A 0 A_ChangeFlag ("MissileEvenMore", 1)  
	Goto SeeLoop+1	
  Missile:
    TNT1 A 0 A_TakeInventory ("AccuracyCounter", 4)
    TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 20, "Reload")
	TNT1 A 0 A_JumpIfTargetInLos ("ShortBurst", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 500) 
    SMNA E 9 A_FaceTarget
  MissileLoop:
	SMNA E 1 A_FaceTarget
	TNT1 A 0 A_JumpIfTargetInLos ("ShortBurst", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 500)
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 20, "Reload")
	TNT1 A 0 A_PlaySound ("MP5")
	TNT1 A 0 A_PlaySound ("MP5FF", 6, 0.5, 0)
	SMNA F 1 BRIGHT A_CustomMissile ("SMGTracer",32,7,random (-3,3))
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
    SMNA E 1 A_MonsterRefire (40, "SeeLoop")
	goto MissileLoop+1
  ShortBurst:
    TNT1 A 0
    TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 4, "SeeLoop")
	TNT1 A 0 A_JumpIfInventory ("SMGShotCounter", 20, "Reload")
    SMNA E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("MP5")
	TNT1 A 0 A_PlaySound ("MP5FF", 6, 0.5, 0)
	SMNA F 1 Bright A_CustomMissile ("SMGTracer",32,7,random (-1,1))
	TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 4, "SeeLoop")
	TNT1 A 0 A_GiveInventory ("SMGShotCounter", 1)
	TNT1 A 0 A_GiveInventory ("AccuracyCounter", 1)
	//SMNA F 1 A_MonsterRefire (40, "SeeLoop")
	Loop
  Reload:
    TNT1 A 0 A_JumpIfCloser (250, "Retreating")
    SMNA E 15 A_PlaySound ("SMGOUT")
	TNT1 A 0 A_TakeInventory ("SMGShotCounter", 20)
	SMNA D 38 A_PlaySound ("SMGIN")
	SMNA E 24 A_PlaySound ("SMGCOCK")
	TNT1 A 0 A_JumpIfCloser (450, "MissileCheck2")	
	Goto SeeLoop
  MissileCheck2:
    TNT1 A 0 A_JumpIfTargetInLos ("Missile")
	Goto SeeLoop
  Retreating:
    TNT1 A 0 A_ChangeFlag ("FRIGHTENED", true) 
    SMNA ABCDABCDABCDABCDABCDABCDABCDABCD 2 A_Chase
	TNT1 A 0 A_CheckSight ("ReloadReady")	
 ReloadReady:
    TNT1 A 0 A_ChangeFlag ("FRIGHTENED", false)
	Goto ReloadBrave
 ReloadBrave:
    SMNA E 10 A_PlaySound ("SMGOUT")
	TNT1 A 0 A_TakeInventory ("SMGShotCounter", 20)
	SMNA D 38 A_PlaySound ("SMGIN")
	SMNA E 24 A_PlaySound ("SMGCOCK")
	TNT1 A 0 A_JumpIfCloser (450, "MissileCheck2")	
	Goto SeeLoop	
  Pain:
    SMNA G 3
    SMNA G 3 A_Pain
    goto SeeLoop
  Death:
    SMNA H 5 A_Scream
    SMNA I 5
    SMNA J 5 A_NoBlocking
    SMNA KL 4 
	SMNA M 5 A_Playsound ("FallingBodyLight", CHAN_BODY)
    SMNA N -1
    stop
  Death.WEAK:
    SMNA N 5
    SMNA O 5 A_PlaySound("Baddy/pain")
    SMNA P 5 A_NoBlocking
    SMNA Q 5
    SMNA R -1
    stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    SMNA N 5 A_XScream
    SMNA O 5 
    PGIB A 5 A_NoBlocking
    PGIB BCD 5
    PGIB E -1
    Stop
  Raise:
    TNT1 A 0 
	TNT1 A 0 A_SpawnItemEx ("NanoResEffect", 0, 0, 15, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
 	SMNA NMLKJIH 5
   Goto See	
  Idle:
    SMNA AA 4 A_Wander
    SMNA A 0 A_Look
    SMNA BB 4 A_Wander
    SMNA A 0 A_Look
    SMNA CC 4 A_Wander
    SMNA A 0 A_Look
    SMNA DD 4 A_Wander
    SMNA A 0 A_Look
    loop
  }
}


 