// Recolour by Bouncy, new (edited) sprites by Phobus
// Decorate by Phobus, edited by Bouncy, revamped by Ghastly

//Spawn and use SetActorState(tid, FadeIn, true) to get them to fade in.
//This can be used very nicely to ambush the player without using loud
//teleporting sprites and sounds.

Actor Shadowclaw 10301
{ 
  //$Category Monsters
  //$Title Shadowclaw
  Health 250
  Height 64
  Radius 30
  Mass 300
  Speed 14
  PainChance 32
  Monster
  +NoBlood
  +Ghost
  SeeSound "Shadowclaw/sight"
  DeathSound "Shadowclaw/death"
  PainSound "Shadowclaw/pain"
  ActiveSound "Shadowclaw/active"
  MeleeSound "clink/attack"
  MeleeDamage 4
  MeleeThreshold 96
  Renderstyle Translucent
  Alpha 0.8
  HitObituary "$OB_SHADOWCLAW"
  Tag "$FN_SHADOWCLAW"
  States
  {
  Spawn:
    SCLW E 0 A_JumpIfInventory("ShadowclawTeleporting", 1, "FadeIn")
    SCLW E 0 A_UnsetInvulnerable
    SCLW E 0 A_UnsetReflective
    SCLW E 0 A_SetTranslucent(0.6, 0)
    SCLW AB 10 A_Look
    Loop
  See:
    SCLW E 0 A_UnsetInvulnerable
    SCLW E 0 A_UnsetReflective
    SCLW E 0 A_SetTranslucent(0.6, 0)
    SCLW AAABBBCCCDDD 2 A_Chase
    Loop
  Melee:
    SCLW E 0 A_JumpIfInventory("ShadowclawTeleporting", 1, "Melee2")
    SCLW E 0 A_SetTranslucent(0.6, 0)
    SCLW EF 8 A_FaceTarget
    SCLW G 8 A_MeleeAttack
    Goto See
  Melee2:
    SCLW E 0 A_TakeInventory("ShadowclawTeleporting", 1)
    SCLW E 1 A_SetTranslucent(0.1, 0)
    SCLW E 1 A_SetTranslucent(0.2, 0)
    SCLW E 1 A_SetTranslucent(0.3, 0)
    SCLW E 1 A_SetTranslucent(0.4, 0)
    SCLW E 1 A_SetTranslucent(0.5, 0)
    SCLW E 2 A_SetTranslucent(0.6, 0)
    SCLW E 2 A_SetTranslucent(0.7, 0)
    TNT1 A 0 A_ChangeFlag("NonShootable", 0)
    TNT1 A 0 A_ChangeFlag("Shootable", 1)
    SCLW E 1 A_SetTranslucent(0.8, 0)
    SCLW F 4 A_FaceTarget
    SCLW G 8 A_MeleeAttack
    Goto See
  Missile:
    SCLW E 8 A_FaceTarget
    SCLW E 0 A_SpawnItemEx("ShadowclawGhost", 0, 0, 0, 0, 0, 0, 0, 128)
    SCLW E 0 A_SetTranslucent(0.0, 0)
    TNT1 A 0 A_ChangeFlag("NonShootable", 1)
    TNT1 A 0 A_ChangeFlag("Shootable", 0)
    TNT1 A 0 A_GiveInventory("ShadowclawTeleporting", 1)
    TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Chase("Melee", "")
    TNT1 A 1 A_Chase("Melee", "")
    SCLW E 1 A_SetTranslucent(0.1, 0)
    SCLW E 1 A_SetTranslucent(0.2, 0)
    SCLW E 1 A_SetTranslucent(0.3, 0)
    SCLW E 1 A_SetTranslucent(0.4, 0)
    SCLW E 1 A_SetTranslucent(0.5, 0)
    SCLW E 2 A_SetTranslucent(0.6, 0)
    SCLW E 2 A_SetTranslucent(0.7, 0)
    TNT1 A 0 A_TakeInventory("ShadowclawTeleporting", 1)
    TNT1 A 0 A_ChangeFlag("NonShootable", 0)
    TNT1 A 0 A_ChangeFlag("Shootable", 1)
    SCLW E 1 A_SetTranslucent(0.8, 0)
    SCLW E 4 A_FaceTarget
    Goto See
  FadeIn: //Can be used with SetActorState after spawning, as an ambush state.
    TNT1 A 0 A_ChangeFlag("NonShootable", 1)
    TNT1 A 0 A_ChangeFlag("Shootable", 0)
    TNT1 A 0 A_ChangeFlag("NoPain", 1)
    TNT1 A 0 A_SetTranslucent(0.0, 0)
    TNT1 A 0 A_GiveInventory("ShadowclawTeleporting", 1)
    SCLW E 2 A_SetTranslucent(0.1, 0)
    SCLW E 2 A_SetTranslucent(0.2, 0)
    SCLW E 2 A_SetTranslucent(0.3, 0)
    SCLW E 2 A_SetTranslucent(0.4, 0)
    SCLW E 2 A_SetTranslucent(0.5, 0)
    SCLW E 2 A_SetTranslucent(0.6, 0)
    SCLW E 2 A_SetTranslucent(0.7, 0)
    SCLW A 0 A_TakeInventory("ShadowclawTeleporting", 1)
    SCLW A 0 A_ChangeFlag("NonShootable", 0)
    SCLW A 0 A_ChangeFlag("Shootable", 1)
    SCLW A 0 A_SetTranslucent(0.8, 0)
    SCLW E 12
    SCLW A 0 A_ChangeFlag("NoPain", 0)
    Goto Spawn
  Pain:
    SCLW H 5
    SCLW H 5 A_Pain
    Goto See
  Death:
    SCLW I 6 A_SetTranslucent(0.8, 0)
    SCLW J 6 A_Scream
    SCLW K 5
    SCLW L 5 A_NoBlocking
    SCLW MN 5
    SCLW O -1 A_Die
    Stop
  Raise:
    SCLW ONMLK 5
    SCLW JI 6
    Goto See
  }
}

Actor ShadowclawGhost
{
  -Solid
  +NoClip
  RenderStyle Translucent
  Alpha 0.7
  States
  {
  Spawn:
    SCLW E 0
    SCLW E 2 A_SetTranslucent(0.7, 0)
    SCLW E 2 A_SetTranslucent(0.6, 0)
    SCLW E 1 A_SetTranslucent(0.5, 0)
    SCLW E 1 A_SetTranslucent(0.4, 0)
    SCLW E 1 A_SetTranslucent(0.3, 0)
    SCLW E 1 A_SetTranslucent(0.2, 0)
    SCLW E 1 A_SetTranslucent(0.1, 0)
    Stop
  }
}

Actor ShadowclawTeleporting : Inventory { Inventory.MaxAmount 1 }