actor MusorShotgunner : GenericHumanScum 
{

   //----------------------------COMPLEX DOOM COMPATIBILITY DROPS------------------------
 	   
	DropItem "HealthFlask" 40
	DropItem "ArmorCharge" 40
	DropItem "AmmoPack" 20
	DropItem "HandGrenadeAmmo" 50 1
	DropItem "MineAmmo" 25 1
  
  scale 1.0
  obituary "%o was lethally forced to become unalive by the former public protector"
  health 33
  radius 15
  height 54
  mass 100
  speed 10
    Species "Z"
  +DOHARMSPECIES
  painchance 150
  SeeSound "MusorShotgunner/see"
  PainSound "MUSRPA01"
  DeathSound "Manhunt/Death"
  ActiveSound "MusorShotgunner/Active" 
  dropitem "Shotgun"
  Tag "Former public protector"
  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.03, 0.03), scaleY+frandom(-0.08,0.08))
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
  Spawn2:
    MUSR A 10 A_Look
    loop
  STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUMusorShotgunner")
	 Goto Spawn+2
  VanJump:
	 TNT1 A 0
	 TNT1 A 0  NODELAY ACS_NamedExecuteAlways ("VanillaHeights")
	Goto Spawn+3	 
  See:
   "####" A random(1,5)
	 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_JumpIfInventory ("ShotgunShotCounter", 6, "Reload")
	TNT1 A 0 A_Jump (199, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
    MUSR AABBCCDD 3 A_Chase
    loop
  CheckReload:
    TNT1 A 0 A_Jump (150, "CheckReload2")
 	Goto SeeLoop+1
  CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("ShotgunShotCounter", 6, "Reload")
	Goto SeeLoop+1
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    MUSR AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		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))
	    MUSR AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		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))
	    MUSR AABBCCDD 2 ThrustThing(angle*256/360+192, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
	DodgeRight:
	    TNT1 A 0 A_FaceTarget
	    MUSR AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		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)) 
	    MUSR AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		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)) 
	    MUSR AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
  AlphaBravo:
    TNT1 A 0 A_JumpIfInventory ("ShotgunShotCounter", 6, "Reload")
    MUSR E 4 A_FaceTarget
	TNT1 A 0 A_Chase ("", "MissileAmbush", CHF_DONTMOVE)
	MUSR E 4 A_FaceTarget
	TNT1 A 0 A_Chase ("", "MissileAmbush", CHF_DONTMOVE)
	MUSR E 4 A_FaceTarget
	TNT1 A 0 A_Chase ("", "MissileAmbush", CHF_DONTMOVE)
	TNT1 A 0 A_Jump (1, "SeeLoop")
   Loop		
  MissileCheck:
    TNT1 A 0 A_JumpIfTargetInLos ("Missile", 0, JLOSF_DEADNOJUMP)
	Goto SeeLoop
  MissileAmbush:
    MUSR EE 4 A_FaceTarget	
  Missile:
    MUSR E 14 A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 6, "Reload") 
	TNT1 A 0 A_JumpIfTargetInLos ("LongRange", 0, JLOSF_DEADNOJUMP | JLOSF_CLOSENOJUMP, 0, 950)
	TNT1 A 0 A_JumpIfTargetInLos ("CloseQuarters", 0, JLOSF_DEADNOJUMP, 400)
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 32, 9, random (-5,5))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    MUSR F 6 Bright A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 6, "Reload") 
	MUSR E 15 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 32, 9, random (-5,0))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    MUSR F 6 Bright A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 6, "Reload") 
	MUSR E 15 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 32, 9, random (0,5))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    MUSR F 15 Bright A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 6, "Reload") 
	Goto SeeLoop
  CloseQuarters:
    MUSR E 3 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 32, 9, random (-5,5))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    MUSR F 6 Bright A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 6, "Reload") 
	Goto SeeLoop
  LongRange:
    MUSR E 35 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BSHFR")
	TNT1 A 0 A_PlaySound ("BSHFRF", 6, 0.5, 0)
	TNT1 AAAAAAAA 0 A_CustomMissile ("ShotgunTracer", 32, 9, random (-3,3))
	TNT1 A 0 A_GiveInventory ("ShotgunShotCounter", 1)
    MUSR F 6 Bright A_FaceTarget
	TNT1 A 0 A_JumpIfInventory ("ShotgunShoTCounter", 6, "Reload") 
    TNT1 A 0 A_MonsterRefire (2, "AlphaBravo")
   Loop
  Reload:
    MUSR DE 7 A_Playsound ("SHOTLOD")
	MUSR DE 7 A_Playsound ("SHOTLOD")
	MUSR DE 7 A_Playsound ("SHOTLOD")
	TNT1 A 0 A_TakeInventory ("ShotgunShotCounter", 6)
	MUSR DE 7 A_Playsound ("SHOTLOD")
	MUSR DE 7 A_Playsound ("SHOTLOD")
	MUSR DE 7 A_Playsound ("SHOTLOD")
	TNT1 A 0 A_PlaySound ("SHOTPUMP")
	Goto SeeLoop	
  Pain:
    MUSR H 3
    MUSR H 3 A_Pain
    goto SeeLoop
  Death:
    MUSR I 5  A_Scream
    MUSR J 5 A_NoBlocking
    MUSR K 5 
    MUSR L 5 A_Playsound ("FallingBodyLight", CHAN_BODY)
    MUSR M -1
    stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    MUSR N 4
    MUSR O 4 A_XScream
    MUSR P 4 A_NoBlocking
    MUSR QRSTU 3
    MUSR V -1
    Stop
  Raise:
    TNT1 A 0 
	TNT1 A 0 A_SpawnItemEx ("NanoResEffect", 0, 0, 15, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
	MUSR MLKJI 5
   Goto See	
  Idle:
    MUSR AA 4 A_Wander
    MUSR A 0 A_Look
    MUSR BB 4 A_Wander
    MUSR A 0 A_Look
    MUSR CC 4 A_Wander
    MUSR A 0 A_Look
    MUSR DD 4 A_Wander
    MUSR A 0 A_Look
    loop
  }
}

	