//"Maimmary", based on "Hell's Angel" from R667
//Code: Aenima
//Sounds: Mike Koenig, 999999990, acclivity, AlesiaDavina, DeVloek, edits by Aenima
//Sprites: id Software, Craneo, HorrorMovieRei, scalliano, Freedoom 2
//Sprite Edit: DeVloek

Actor Maimmary : SSTDemon 22091
{
//$Category Monsters
  Health 275//300
  PainChance 24
  Speed 11
  Radius 28
  Height 56
  Mass 900
  Monster
  +FLOORCLIP
  +nogravity
  +floatbob
  //+ONLYSLAMSOLID
  SeeSound "Maimmary/Alert"
  AttackSound ""//"Maimmary/Laughter"
  PainSound "Maimmary/Pain"
  DeathSound "Maimmary/Death"
  ActiveSound "Maimmary/Active"
  Obituary "%o was maimed by a maimmary."
  maxtargetrange 420
  meleerange 88
  +missilemore
  +missileevenmore
  +randomize
+noinfighting
+notarget
  gibhealth -30
  PainChance "ShotgunWeak", 12
  +thruspecies
  //+thruactors
  -SOLID
  +dontcorpse
  +forcexybillboard
  States
  {
  Spawn:
    VHSA ABCDCB 7 A_Look
    Loop
  See:
    VHSA A 0 A_Jump(88,"See2")
    VHSA AAABBBCCC 2 A_Chase
    VHSA A 0 A_PlaySoundEx("Maimmary/Wingflap", "SoundSlot7", 0)
    VHSA DDDCCCBBB 2 A_Chase
    Loop
  See2:
    VHSA AAABBBCCC 1 A_Chase("","",CHF_NOPLAYACTIVE|CHF_Fastchase)
	VHSA AA 0 A_Stop
    VHSA A 0 A_PlaySoundEx("Maimmary/Wingflap", "SoundSlot7", 0)
    VHSA DDDCCCBBB 1 A_Chase("","",CHF_NOPLAYACTIVE|CHF_Fastchase)
	VHSA AA 0 A_Stop
    Goto See
  Melee:
    VHSA E 0 A_FaceTarget
    VHSA E 0 A_Recoil(-8)
    VHSA EEF 2 A_FaceTarget(5,5)
	VHSA A 0 A_CustomMeleeAttack(5,"imp/melee","","NewBullet",1)
    VHSA FGG 2 A_FaceTarget(5,5)
	VHSA A 0 A_CustomMeleeAttack(5,"imp/melee","","NewBullet",1)
    VHSA A 0 A_PlaySoundEx("Maimmary/Wingflap", "SoundSlot7", 0)
	goto see2
  Missile:
//    VHSA A 0 A_JumpIfHigherOrLower ("gohigh","golow", 0,0,1, AAPTR_TARGET)
//  GoHigh:
//  GoLow:
//  GoStraight:
	VHSA AA 0 A_Stop
    VHSA E 0 A_Playsoundex("Maimmary/Laughter", "Voice",0)
	VHSA E 0 A_FaceTarget(0,180)
	TNT1 A 0 A_ChangeVelocity(30, 0, 0, CVF_RELATIVE|CVF_REPLACE)
	VHSA E 2 A_FaceTarget(0,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 30, 0, (-sin(pitch) * -30), CVF_RELATIVE|CVF_REPLACE)
	VHSA E 2 A_FaceTarget(3,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 30, 0, (-sin(pitch) * -30), CVF_RELATIVE|CVF_REPLACE)
	VHSA F 2 A_FaceTarget(3,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 30, 0, (-sin(pitch) * -30), CVF_RELATIVE|CVF_REPLACE)
	VHSA F 2 A_FaceTarget(3,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 30, 0, (-sin(pitch) * -30), CVF_RELATIVE|CVF_REPLACE)
	VHSA G 2 A_FaceTarget(3,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 30, 0, (-sin(pitch) * -30), CVF_RELATIVE|CVF_REPLACE)
	VHSA G 2 A_FaceTarget(3,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 30, 0, (-sin(pitch) * -30), CVF_RELATIVE|CVF_REPLACE)
	VHSA A 0 A_CustomMeleeAttack(10,"imp/melee","","NewBullet",1)
    VHSA A 0 A_PlaySoundEx("Maimmary/Wingflap", "SoundSlot7", 0)
    VHSA HHGGFF 2 A_FaceTarget(20,5)
	TNT1 A 0 A_JumpIf(momx>-1 && momx<1 && momy>-1 && momy<1, "See")
	
    //VHSA E 0 A_Recoil(-15)
	TNT1 A 0 A_ChangeVelocity(15, 0, velz, CVF_RELATIVE|CVF_REPLACE)
	VHSA E 2 A_FaceTarget(45,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 15, 0, (-sin(pitch) * -15), CVF_RELATIVE|CVF_REPLACE)
	VHSA E 2 A_FaceTarget(6,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 15, 0, (-sin(pitch) * -15), CVF_RELATIVE|CVF_REPLACE)
	VHSA F 2 A_FaceTarget(6,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 15, 0, (-sin(pitch) * -15), CVF_RELATIVE|CVF_REPLACE)
	VHSA F 2 A_FaceTarget(6,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 15, 0, (-sin(pitch) * -15), CVF_RELATIVE|CVF_REPLACE)
	VHSA G 2 A_FaceTarget(6,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 15, 0, (-sin(pitch) * -15), CVF_RELATIVE|CVF_REPLACE)
	VHSA G 2 A_FaceTarget(6,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 15, 0, (-sin(pitch) * -15), CVF_RELATIVE|CVF_REPLACE)
	VHSA A 0 A_CustomMeleeAttack(10,"imp/melee","","NewBullet",1)
    VHSA A 0 A_PlaySoundEx("Maimmary/Wingflap", "SoundSlot7", 0)
    VHSA HHGGFF 2 A_FaceTarget(20,5)
	TNT1 A 0 A_JumpIf(momx>-1 && momx<1 && momy>-1 && momy<1, "See")
	
    //VHSA E 0 A_Recoil(-7)
	TNT1 A 0 A_ChangeVelocity(7.5, 0, 0, CVF_RELATIVE|CVF_REPLACE)
	VHSA E 2 A_FaceTarget(45,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 7.5, 0, (-sin(pitch) * -7.5), CVF_RELATIVE|CVF_REPLACE)
	VHSA E 2 A_FaceTarget(10,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 7.5, 0, (-sin(pitch) * -7.5), CVF_RELATIVE|CVF_REPLACE)
	VHSA F 2 A_FaceTarget(10,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 7.5, 0, (-sin(pitch) * -7.5), CVF_RELATIVE|CVF_REPLACE)
	VHSA F 2 A_FaceTarget(10,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 7.5, 0, (-sin(pitch) * -7.5), CVF_RELATIVE|CVF_REPLACE)
	VHSA G 2 A_FaceTarget(10,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 7.5, 0, (-sin(pitch) * -7.5), CVF_RELATIVE|CVF_REPLACE)
	VHSA G 2 A_FaceTarget(10,180)
	TNT1 A 0 A_ChangeVelocity(cos(pitch) * 7.5, 0, (-sin(pitch) * -7.5), CVF_RELATIVE|CVF_REPLACE)
	VHSA A 0 A_CustomMeleeAttack(5,"imp/melee","","NewBullet",1)
    VHSA A 0 A_PlaySoundEx("Maimmary/Wingflap", "SoundSlot7", 0)
    VHSA HHGGFF 2 A_FaceTarget(15,5)
	
	VHSA AA 0 A_Stop
    Goto See
  Pain.Fire:
  	TNT1 AAAA 0 A_SpawnItemEx("imonfire", random(-8,-2),Random(-8,8),random(20, 38), 0, random(-30,30)*0.1, random(10,30)*0.1, 0, 160)
	Goto Pain
  Pain:
	TNT1 A 0 A_ChangeVelocity(momx*0.5,momy*0.5,momz*0.5, CVF_REPLACE)
    VHSA I 2 
    VHSA I 2  A_Pain
    Goto See
  Death.Fire:
	TNT1 A 0 A_Stop
    TNT1 A 0 ACS_ExecuteAlways(926,0, 10,0,0)
	NULL O 0 A_SpawnItemEx ("BurnDeathFX", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM)
	Goto Death
  Death.Plasma:
	TNT1 A 0 A_Stop
    TNT1 A 0 ACS_ExecuteAlways(926,0, 10,0,0)
	NULL O 0 A_SpawnItemEx ("PlasmaDeathFX", 0,0,0, momx,momy,momz, 0, SXF_NOCHECKPOSITION|SXF_CLIENTSIDE|SXF_ABSOLUTEMOMENTUM)
    TROO H 0 A_JumpIfHealthLower(-30,"XDeath")
	goto Death

  Death.Shotgun:
  Death.Rocket:
  Death:
    VHSA J 4 A_changeflag("floatbob",0)
    VHSA K 4 A_Scream
    VHSA LLM 2
  Fall:
    VHSA M 1 A_NoBlocking
    VHSA M 0 A_changeflag("corpse",1)
	VHSA M 0 A_CheckFloor("Crash2") 
	TNT1 A 0 A_JumpIf(momz>-1 && momz<1, "Crash2")
	loop
  Crash2:
    VHSA N 0 A_Playsound("ragdoll/land")
	VHSA NNNN 1 A_SpawnItemEx ("SuperDuperClientsideBloodSpotSpawner", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
    VHSA O -1
    Stop
  Death.Chainsaw:
	VHSA JJJJ 0 A_DropItem("SSTHealthBonus",1,127)
  xDeath.Shotgun:
  xDeath.Rocket:
  XDeath:
    VHSA J 4 A_changeflag("floatbob",0)
    VHSA P 4
    VHSA Q 4 A_XScream
    VHSA R 3 A_NoBlocking
    VHSA S 3 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,8), 0,0,0, 0, 160) 
    VHSA TUV 3 A_SpawnItemEx ("BloodFXSpawner", 0,0,random(0,8), 0,0,0, 0, 160) 
    VHSA W -1
    Stop
  Raise:
    VHSA N 4
    VHSA MLKJI 4
    Goto See
	
  Pain.GreenPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 0,0,0)
	Goto Pain
  Pain.BluePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 1,0,0)
	Goto Pain
  Pain.RedPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 2,0,0)
	Goto Pain
  Pain.OrangePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 3,0,0)
	Goto Pain
  Pain.PurplePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 4,0,0)
	Goto Pain
  Pain.WhitePaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 5,0,0)
	Goto Pain
  Pain.YellowPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 6,0,0)
	Goto Pain
  Pain.BlackPaint:
    TNT1 A 0 ACS_ExecuteAlways(926,0, 7,0,0)
	Goto Pain
    Crush:
	TNT1 A 0 A_SpawnItemEx ("Gibs", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
	TNT1 AAAAAAAA 0 A_SpawnItemEx ("SuperDuperClientsideBloodSpotSpawner", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION|SXF_USEBLOODCOLOR|SXF_CLIENTSIDE)
    TNT1 AAAAAAAA 1 A_SpawnItemEx ("Bloodsquirt3", 0,0,0, 0,0,0, random(-180,180), SXF_USEBLOODCOLOR|SXF_CLIENTSIDE|SXF_NOCHECKPOSITION)
    TNT1 A -1
    Stop
  }
}
