/*
================================================================================
	Dollmaykr
	
	Class: Sacrifical angel
	
"Emotionless, unblinking, smol, the Dollmaykr is an elusive angel who uses 
the souls of the dead to power her army of dolls. While her body appears more 
doll-like than her toys, her wings are strong and let her fly in 
unpredictable patterns."

A combination of arch-vile and pain elemental, the Dollmaykr is one of more
challenging angels heaven has to offer. She has two attacks, the first is to 
stab her voodoo doll which does significantly less damage than a vile attack. 
She does this attack twice in a row, the second attack will always launch the 
player into the air. Each time she attacks, she will summon in a doll. Much like
the arch-vile, damage can be avoided by taking cover when she stabs the doll.
Her second ability is to summon four balls of yarn that bounce around the 
arena and eventually turn into a random type of  Turbo doll. Turbo dolls are 
faster and stronger than dolls found in the wild.
	Dollmaykrs have the ability to fly and will occasionally fly in odd patterns,
making her hard to hit. When she attacks, she will come to a complete stop which
is the best time to attack her. She is a high priority target due to her ability
to spawn in dolls, but not as high as the Arch-vile. In most situations, 
red eggs, Joy Elementals and Putto should be targeted before her.
	If enabled, the Dollmaykr has the ability to curse the player, lowering 
their speed for 5 seconds.
	She is totally not a reference to Alice Margatroid.

================================================================================
*/

Actor DollmaykrSpawner replaces Archvile // Spawns the Dollmaykr or the Quiet Dollmaykr.
{
  +NOBLOCKMAP
  +NOSECTOR
  +THRUACTORS
  
  States
  {
  Spawn:
  	TNT1 A 0
// 	TNT1 A 0 A_JumpIf(Getcvar("AA_DollmaykrShutUp") == 2, "SummonQuietDollmaykr")
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEX("Dollmaykr",0,0,0, 0, 0,0,0, SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG )
	Stop
	SummonQuietDollmaykr:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEX("QuietDollmaykr",0,0,0, 0, 0,0,0, SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG )
	Stop
	}
}

ACTOR Dollmaykr
{
  Health 700
  Radius 20
  Height 56
  Mass 100
  Speed 14
  PainChance 10
  Tag "Dollmaykr"
  Monster
  Species "DollMakyr_Pet"
  Damagetype "DollDamage"
  DamageFactor "UndeadGoHomeImpact", 0
  DamageFactor "Judgement", 0
  DamageFactor "Holy", 0
  DamageFactor "CABladeBeam", 0.25 //Combine arms pistol
  DamageFactor "PlayerVoid", 0.1
  DamageFactor "KissMagic", 4
  MaxTargetRange 896
  +QUICKTORETALIATE 
  +FLOORCLIP
  +NOTARGET
  +THRUSPECIES
  +NODROPOFF
  +FLOATBOB
  +DONTRIP
//   FloatBobStrength -0.2
  SeeSound "dollmaykr/sight"
  PainSound "dollmaykr/pain"
  DeathSound "dollmaykr/death"
  ActiveSound "dollmaykr/active"
  Obituary "%o became the Dollmaykr's best friend... Forever and ever."
    DropItem "AngelHealthSpawner", 256
	DropItem "AngelHealthSpawner", 256
	DropItem "AngelHealthSpawner", 256
	DropItem "AngelHealthSpawner", 128
	DropItem "AngelHealthSpawner", 64
	DropItem "AngelHealthSpawner", 32
	DropItem "AngelHealthSpawner", 16
	DropItem "GreenArmor", 8
	DropItem "BlueArmor", 1
	DropItem "DoomguyDoll" ,1
	
		var int user_haloactive;
			
  States
  {
  Spawn:
  	DMYR A 0 NoDelay A_SpawnItemEx ("DollMaykrHalo", 0,0,55, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER)
// 	TNT1 A 0 A_JumpIf (user_haloactive == 1, "SpawnLoop")
// 	TNT1 A 0 A_SetUserVar (user_haloactive, 1)
    TNT1 A 0 
// 	TNT1 A 0 A_JumpIf(Getcvar("AA_Dropoff") == 2, "Aggressive")
	TNT1 A 0 A_Changeflag("NODROPOFF",FALSE)
	TNT1 A 0 A_Jump(256, "SpawnLoop")
	Goto SpawnLoop
//   Aggressive:
// 	TNT1 A 0
// 	TNT1 A 0 A_Changeflag("NODROPOFF",FALSE)
// 	Goto SpawnLoop
  Idle:
  Spawnloop:
    DMYR AB 10 A_Look
    Loop
  See:  
    DMYR AABBCCDD 2 A_Chase
	DMYR AABB 2 A_FastChase
	DMYR CC 2 A_Chase
	TNT1 A 0 A_Playsound("bird/flap")
	DMYR DD 2 A_Chase
	TNT1 A 0 A_JumpIfHealthLower(699,"Flight")
    Loop
  Flight:
	TNT1 A 0
	TNT1 A 0 A_Changeflag("FLOAT",TRUE)
	TNT1 A 0 A_Changeflag("NOGRAVITY",TRUE)
    DMYR AABB 2 A_Chase
	DMYR CC 2 A_FastChase
	TNT1 A 0 A_Playsound("bird/flap")
	DMYR DDAA 2 A_FastChase
	DMYR BBCC 2 A_Chase
	TNT1 A 0 A_Playsound("bird/flap")
	DMYR DD 2 A_Chase
	Loop
  Missile:
	TNT1 A 0 A_Changeflag("FLOAT",TRUE)
	TNT1 A 0 A_Changeflag("NOGRAVITY",TRUE)
	TNT1 A 0 A_Changeflag("NODROPOFF",FALSE)
	TNT1 A 0 A_Stop
  	TNT1 A 0 A_jump (96, "Summon01" )
    DMYR E 0 Bright A_Playsound ("dollmaykr/summon3")
    DMYR E 4 Bright A_FaceTarget
    DMYR F 4 Bright A_VileTarget
    DMYR GHIJKL 8 Bright A_FaceTarget
	DMYR M 16 Bright A_FaceTarget
    DMYR N 8 Bright A_VileAttack("dollmaykr/summon4",random(15,30),0,0,0,"DollDamage")
	TNT1 A 0 A_spawnitemex("DollYarn",random(-50,50),0,62,random(-10,10),random(-10,10),random(5,10))
	DMYR M 8 Bright
	DMYR N 8 Bright A_VileAttack ("dollmaykr/summon4",random(15,30),0,0,1,"DollDamage")
	TNT1 A 0 A_spawnitemex("DollYarn",random(-50,50),0,62,random(-10,10),random(-10,10),random(5,10))
	DMYR LKJ 5 Bright
	Goto Flight
  Summon01: // Spawns 4 dolls
	TNT1 A 0 ThrustThingZ(0,1,0,0)
	DMYR O 1 Bright A_playsound ("dollmaykr/summon1")
    DMYR O 9 Bright
	DMYR PQR 3 Bright
	TNT1 A 0 A_Stop
	TNT1 A 0 Bright A_playsound ("dollmaykr/summon2")
	TNT1 A 0 a_spawnitemex("DollYarn",random(-50,50),0,62,random(-10,10),random(-10,10),random(5,10))
	DMYR ST 4 Bright
	TNT1 A 0 Bright A_playsound ("dollmaykr/summon2")
	TNT1 A 0 A_spawnitemex("DollYarn",random(-40,50),0,62,random(-10,10),random(-10,10),random(5,10))
	DMYR ST 4 Bright
	TNT1 A 0 Bright A_playsound ("dollmaykr/summon2")
	TNT1 A 0 a_spawnitemex("DollYarn",random(-50,50),0,62,random(-10,10),random(-10,10),random(5,10))
	DMYR ST 4 Bright
	TNT1 S 0 Bright A_playsound ("dollmaykr/summon2")
	TNT1 A 0 a_spawnitemex("DollYarn",random(-40,50),0,62,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 A_Recoil (-4)
	DMYR RQP 3
	Goto Flight
  Pain:
    DMYR U 5   
	TNT1 A 0 A_SpawnItemEx("WhiteFeather",random(-20,20),random(-20,20),30,random(-5,5),random(-5,5),random(-5,5))
	TNT1 A 0 A_SpawnItemEx("YellowFeather",random(-20,20),random(-20,20),30,random(-5,5),random(-5,5),random(-5,5))
	TNT1 A 0 A_SpawnItemEx("YellowFeather",random(-20,20),random(-20,20),30,random(-5,5),random(-5,5),random(-5,5))
    DMYR U 5 A_Pain
    Goto Flight
  Death:
	TNT1 A 0 A_SetUserVar (user_haloactive, 0)
	TNT1 A 0 A_Changeflag("FLOATBOB",False)
	TNT1 AAAAA 0 A_SpawnItemEx("WhiteFeather",random(-30,30),random(-30,30),20,random(-5,5),random(-5,5))
	TNT1 AAA 0 A_SpawnItemEx("WhiteFeather",random(-30,30),random(-30,30),20,random(-5,5),random(-5,5))
    TNT1 AAA 0 A_SpawnItemEx("YellowFeather",random(-30,20),random(-30,30),20,random(-5,5),random(-10,10),random(-15,15))
    TNT1 A 0 A_Scream
	DMYR UV 6
    DMYR W 6 
	TNT1 A 0 A_NoBlocking
    DMYR XY 6
	DMYR Z -1
	Wait
   Crash:
    TNT1 A 0 A_playsound("body/fall",7,0.5)
	TNT1 AAA 0 A_SpawnItemEx("WhiteFeather",random(-30,30),random(-30,30),20,random(-5,5),random(-5,5))
	TNT1 AAAAA 0 A_SpawnItemEx("WhiteFeather",random(-30,30),random(-30,30),20,random(-5,5),random(-5,5))
	TNT1 AAA 0 A_SpawnItemEx("WhiteFeather",random(-30,30),random(-30,30),20,random(-5,5),random(-5,5))
    TNT1 AAA 0 A_SpawnItemEx("YellowFeather",random(-30,20),random(-30,30),20,random(-5,5),random(-10,10),random(-15,15))
	TNT1 AA 0 A_SpawnItemEx("YellowFeather",random(-20,20),random(-20,20),20,random(-5,5),random(-5,5),random(-5,5))
	TNT1 AAA 0 A_SpawnItemEx("YellowFeather",random(-30,20),random(-30,30),20,random(-5,5),random(-10,10),random(-15,15))
	DM2R A 3
	TNT1 AA 0 A_SpawnItemEx("WhiteFeather",random(-30,30),random(-30,30),20,random(-5,5),random(-5,5))
    TNT1 AAA 0 A_SpawnItemEx("YellowFeather",random(-30,20),random(-30,30),20,random(-5,5),random(-10,10),random(-15,15))
	DM2R B 3 
	TNT1 A 0 A_NoBlocking
	DM2R CD 4
	DM2R EFG 3
    DM2R H -1
    Stop
  }
}

ACTOR QuietDollmaykr : Dollmaykr
{
  Tag "Dollmaykr"
  SeeSound "bird/flock"
  DeathSound "body/altgib"
  PainSound "virgin/pain"
  ActiveSound "angel/blink"
}