//============================================//
//                                            //
//  Agathodemon                               //
//                                            //
//  DECORATE/Recolors By: jimmy91             //
//  Projectile Sprites by: Eriance, Vader     //
//                                            //
//============================================//

actor Agathodemon : RGAMonster
{
  MONSTER
  +FLOAT
  +NOGRAVITY
  +MISSILEMORE
  Radius 31
  Height 64
  Health 1400
  Mass 1000
  Speed 16
  PainChance 160
  SeeSound "caco/sight"
  PainSound "caco/pain"
  DeathSound "caco/death"
  ActiveSound "caco/active"
  AttackSound "caco/melee"
  MeleeSound "imp/claw"
  MeleeDamage 12
  MissileType AgathoDemonFireBall
  MissileHeight 24
  Obituary "%o was blasted by an agathodemon."
  HitObituary "%o got caught in an agathodemon's jaws."
  States
  {
  Spawn:
	AGAH A 0 
	AGAH A 0 Thing_SetSpecial(0,226,613,0,random(40,60))
	POSS A 0 A_GiveInventory("XPAmount", random(40, 60))
	POSS P 0 ACS_ExecuteAlways(651,0,0,0,0)
	AGAH A 1 A_Look
    goto Spawn+4
  See:
    AGAH A 3 A_Chase
    Loop
  Melee:
    AGAH BC 5 A_FaceTarget
    AGAH D 6 A_MeleeAttack
    Goto See
  Missile:
    AGAH D 0 A_Jump(55,"Stealth")
    AGAH D 0 A_Jump(128,"Fireball")
    Goto Tracer
  Stealth:
    AGAH D 0 A_JumpIfInventory("AgathodemonStealthCheck",1,16)
    AGAH BC 5 Bright A_FaceTarget
    AGAH D 2 Bright A_PlaySound("agatho/stealth")
    AGAH D 0 A_UnSetShootable
    AGAH DDDDDDDDD 2 Bright A_FadeOut(0.1)
    AGAH D 0 A_SetShootable
    AGAH D 0 A_GiveInventory("AgathodemonStealthCheck",1)
    Goto See
    AGAH BC 5 Bright A_FaceTarget
    AGAH D 2 Bright A_PlaySound("agatho/stealth")
    AGAH D 0 A_UnSetShootable
    AGAH DDDDDDDDD 2 Bright A_FadeIn(0.1)
    AGAH D 0 A_SetShootable
    AGAH A 0 A_TakeInventory("AgathodemonStealthCheck",1)
    Goto See
  Fireball:
    AGAH BC 4 A_FaceTarget
    AGAH D 5 Bright A_MissileAttack
    AGAH D 0 A_Jump(70,1)
    Goto See
    AGAH D 0
    Goto Tracer
  Tracer:
    AGAH BC 4 A_FaceTarget
    AGAH D 0 A_CustomMissile("AgathoDemonTracer",22,0,-30,0)
    AGAH D 5 A_CustomMissile("AgathoDemonTracer",22,0,30,0)
    AGAH D 0 A_Jump(90,1)
    Goto See
    AGAH D 0
    Goto Fireball
  Pain:
    AGAH E 3
    AGAH E 1 A_Pain
    AGAH F 4
    Goto See
  Death:
    AGAH G 8
    AGAH H 8 A_Scream
    AGAH I 8
    AGAH J 8 A_SetTranslucent(1.0,0)
    AGAH K 8 A_Fall
    AGAH K 0 ACS_ExecuteAlways(648,0,0,0,0)
    AGAH L -1 A_SetFloorClip
    Stop
  Raise:
    AGAH L 8 A_UnSetFloorClip
    AGAH KJIHG 8
    Goto See
  }
}

actor AnotherAgathodemon : Agathodemon
{
  Health 500
  States
  {
  Missile:
    AGAH D 0 A_Jump(70,"Stealth")
    AGAH D 0 A_Jump(128,"Fireball")
    Goto Tracer
  Stealth:
    AGAH D 0 A_JumpIfInventory("AgathodemonStealthCheck",1,16)
    AGAH BC 5 Bright A_FaceTarget
    AGAH D 2 Bright A_PlaySound("agatho/stealth")
    AGAH D 0 A_UnSetShootable
    AGAH DDDDDDDDD 2 Bright A_FadeOut(0.1)
    AGAH D 0 A_GiveInventory("AgathodemonStealthCheck",1)
    Goto See
    AGAH BC 5 Bright A_FaceTarget
    AGAH D 2 Bright A_PlaySound("agatho/stealth")
    AGAH D 0 A_SetShootable
    AGAH DDDDDDDDD 2 Bright A_FadeIn(0.1)
    AGAH A 0 A_TakeInventory("AgathodemonStealthCheck",1)
    Goto See
  }
}

actor AgathodemonStealthCheck : Inventory
{
  Inventory.Amount 1
  Inventory.MaxAmount 1
}

actor AgathoDemonFireBall : DoomImpBall //trail projectile
{
  Speed 20
  Damage 9
  Decal DoomImpScorch
  States
  {
  Spawn:
    TNT1 A 2 Bright A_SpawnItemEx("AgathoDemonFX", 0, 0, 0, 0, 0, 0, 0, 128)
    Loop
  Death:
    AGFX GHIJKL 3 Bright
    Stop
  }
}

actor AgathoDemonFX //trail effect
{
  Scale 0.75
  RenderStyle Add
  +NOGRAVITY
  States
  {
  Spawn:
    AGFX ABCDEF 2 Bright
    Stop
  }
}

actor AgathoDemonTracer : DoomImpBall //homing fireball
{
  +SEEKERMISSILE
  Speed 15
  Damage 4
  Decal BaronScorch
  States
  {
  Spawn:
    AGFB ABCABCABCABCABCABCABCABCABCABCABCABC 4 Bright A_Tracer2
  Death:
    AGFB DEFG 4 Bright
    Stop
  }
}
