actor AKSquadTerrorist : GenericHumanScum 
{
  scale 1.0
  obituary "%o was eliminated by the professional member of moderate opposition"
  health 260
  radius 15
  height 54
  mass 100
  +NODROPOFF
  speed 14
  Species "Arch"
  Species "Squad"
  +DONTHARMSPECIES
  +THRUSPECIES
  Damage 2
  painchance 25
  SeeSound "Arab/See"
  PainSound "STer/pain"
  DeathSound "STer/Death"
  ActiveSound "arab/Active"
  dropitem "Clip", 20
  Tag "AK squad terrorist"
  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.08, 0.08), scaleY+frandom(-0.08,0.08)) 
	TNT1 A 0 A_SpawnItemEx ("HumanTrails", 0, 0, 0)
	TNT1 A 0 A_SpawnItemEx ("AlaWRITER", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION, 69)
  Spawn2:
    AINS T 10 A_Look
    loop
   STFU:
     TNT1 A 0
	 TNT1 A 0 ACS_NamedExecute ("STFUArab")
	 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_JumpIfInventory ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_JumpIfInventory ("OrderToFire", 1, "MissileCheckCommand")
	TNT1 A 0 A_Jump (199, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")
    AINS AABBCCDD 3 A_Chase
    loop
  CheckReload:
    TNT1 A 0 A_Jump (150, "CheckReload2")
 	Goto SeeLoop+1
  CheckReload2:
    TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	Goto SeeLoop+1
  DodgeCheck:
	TNT1 A 0
	TNT1 A 0 A_Jump (256, "DodgeLeft", "DodgeRight", "DodgeLeftF", "DodgeLeftB", "DodgeRightF", "DodgeRightB")	
  DodgeLeft:
        TNT1 A 0 A_FaceTarget
	    AINS 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))
	    AINS 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))
	    AINS 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
	    AINS 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)) 
	    AINS 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)) 
	    AINS AABBCCDD 2 ThrustThing(angle*256/360+64, 1, 0, 0)
		TNT1 A 0 A_Jump (228, "MissileCheck")
		Goto SeeLoop+1
  MissileCheck:
	TNT1 A 0 A_JumpIfInventory ("GrenadeCoolDown", 1, 2)
    TNT1 A 0 A_Jump (125, "GranataCheck")
    TNT1 A 0 A_JumpIfTargetInLos ("Missile", 0, JLOSF_DEADNOJUMP )
	Goto SeeLoop+3
  MissileCheckCommand:
	TNT1 A 0 A_JumpIfTargetInLos ("MissileCommand", 0, JLOSF_DEADNOJUMP )
	Goto SeeLoop+3
  MissileCommand:
	AINS E 12 A_FaceTarget
	TNT1 A 0 A_Jump (150, 2)
	TNT1 A 0 A_PlaySound ("HARACOM2", CHAN_VOICE, 1.0, false, 0.6)
	TNT1 A 0 A_TakeInventory ("OrderToFire", 1)
	TNT1 A 0 A_Jump (20, 2)
	TNT1 A 0 A_JumpIfTargetInLos ("Granata", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 700, 300)
	TNT1 A 0 A_TakeInventory ("GrenadeCoolDown", 1)
	TNT1 A 0 A_JumpIfTargetInLos ("TriShot", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 600)
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 1500)
	Goto MissileLoop
  Missile:
    AINS E 12 A_FaceTarget
	TNT1 A 0 A_TakeInventory ("GrenadeCoolDown", 1)
	TNT1 A 0 A_JumpIfTargetInLos ("TriShot", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 600)
	TNT1 A 0 A_JumpIfTargetInLos ("Accuracy", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 0, 1500)
  MissileLoop:
	TNT1 A 0
	TNT1 A 0 A_FaceTarget
    TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	AINS F 2 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-2,2))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_GiveInventory ("AccuracyCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AccuracyCounter", 10, "MissileDodge")
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
    AINS E 2 A_MonsterRefire (40, "SeeLoop")
	goto MissileLoop
  MissileDodge:
	TNT1 A 0 A_TakeInventory ("AccuracyCounter", 10)
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	AINS F 1 BRIGHT A_CustomMissile ("AKTracer",32,9,random (-2,2))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 15, "Reload")
	AINS E 2 A_MonsterRefire (40, "SeeLoop")
	TNT1 A 0 A_JumpIfInTargetLos ("DodgeCheck", 5, JLOSF_DEADNOJUMP, 650, 0)
	Loop	
  Trishot:
    TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	AINS F 1 BRIGHT A_CustomMissile ("AKTracer",35,8,0)
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	AINS E 2 A_FaceTarget 
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	AINS F 1 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-1,1))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	AINS E 2 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	AINS F 1 BRIGHT A_CustomMissile ("AKTracer",35,8,random (-2,2))
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	TNT1 A 0 A_Jump (175, "SeeLoop") 
	AINS AABBCCDDAABBCCDDAABBCCDDAABBCCDD 2 A_Wander
	Goto SeeLoop
  Accuracy:
    AINS E 5 A_FaceTarget
	TNT1 A 0 A_PlaySound ("BNDAKFIR")
	TNT1 A 0 A_PlaySound ("AKFARF", 6, 0.5, 0)
	AINS F 1 BRIGHT A_CustomMissile ("AKTracer",35,8)
	TNT1 A 0 A_GiveInventory ("AKShotCounter", 1)
	TNT1 A 0 A_JumpIfInventory ("AKShotCounter", 30, "Reload")
	AINS E 2 A_FaceTarget
	TNT1 A 0 A_MonsterRefire (40, "SeeLoop")
	TNT1 A 0 A_JumpIfInTargetLos ("SeeLoop", 1, JLOSF_DEADNOJUMP, 1510, 0) 
	Loop
  GranataCheck:
	TNT1 A 0 
    TNT1 A 0 A_JumpIfTargetInLos ("Granata", 0, JLOSF_CLOSENOJUMP | JLOSF_DEADNOJUMP, 700, 300)
	Goto MissileCheck+2
  Granata:
    //TNT1 A 0 A_Print ("Granata")
    AINS D 10 A_FaceTarget
	TNT1 A 0 A_PlaySound ("GRNTOSS", CHAN_WEAPON)	
	AINS E 8 A_CustomMissile ("GreenHandGrenade", 42, 0, random (-3,3), CMF_OFFSETPITCH, random (10, 14))
	TNT1 A 0 A_GiveInventory ("GrenadeCoolDown", 1)
	Goto SeeLoop			
  Reload:
    AINS D 17 A_PlaySound ("AK47REL1")
	TNT1 A 0 A_TakeInventory ("AKShotCounter", 30)
	AINS E 32 A_PlaySound ("AK47REL2")
	AINS D 15 A_PlaySound ("AK47REL3")
	Goto SeeLoop
  Pain:
    AINS G 3
    AINS G 3 A_Pain
	TNT1 A 0 A_JumpIfHealthLower (15, "Kabeem")
    goto SeeLoop
  Kabeem:
	AIKB A 5
	AIKB B 3
	AIKB C 3 A_FaceTarget
	AIKB D 7 A_PlaySound ("Arab/See", CHAN_VOICE) 
	AIKB E 7 
	AIKB F 3
	TNT1 A 0 A_SpawnItemEx ("AllaExplosion", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
	TNT1 A 0 DamageThing (999)
   Goto XDeath	
  Death:
  	//TNT1 A 0 A_Jump(20, "Suren")
	AINS H 3 A_NoBlocking 
    AINS I 5 A_Scream
    AINS J 5 
    AINS K 5 A_Playsound ("FallingBodyGear", CHAN_BODY)
    AINS L -1
    stop
  Death2:
	AINS P 4 A_NoBlocking 
	AINS Q 4 A_Scream
	AINS R 4
	AINS S 4
	AINS V -1
	Stop
  XDeath:
    TNT1 A 0
    TNT1 A 0 A_SpawnItemEx ("VgavnonahCore", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
    AINS X 5
    AINS Y 5 A_XScream
    PGIB A 5 A_NoBlocking
    PGIB BCD 5
    PGIB E -1
    Stop
  //Suren:
    RSS1 A 5 A_PlaySound("Baddy/Surren")
    RSS1 B 5 
    RSS1 C 5 A_NoBlocking
    RSS1 C 5 A_SpawnItem("Russ1wimp",0,0)
    stop
  Idle:
    AINS AA 4 A_Wander
    AINS A 0 A_Look
    AINS BB 4 A_Wander
    AINS A 0 A_Look
    AINS CC 4 A_Wander
    AINS A 0 A_Look
    AINS DD 4 A_Wander
    AINS A 0 A_Look
    loop
  }
}


