//===========================================================================
//
// Wendy Go!
//
//===========================================================================
ACTOR Wendy //500//replaces spectre
{
	//$Category Doosk Monsters
	//$Sprite WNDZA0
	//$Title Wendigo
	//$Color 6
	Game Doom
	SpawnID 9
	Health 440//440//300
	GibHealth 75
	PainChance 255
	+QUICKTORETALIATE
	
	+invisible//Starts invisible, deactivated on pain state.
	+FORCEPAIN//Forces violin sound once, then disables forcepain to never execute it again.

	Speed 8
	Radius 30
	Height 56
	Mass 400

	Monster
	+FLOORCLIP
	SeeSound "wendy/sight"
//	AttackSound "wendy/melee"
	PainSound "wendy/pain"//Loud violin
	DeathSound "wendy/death"
	ActiveSound "wendy/active"//empty
	Obituary "$WENDY_DTH"

//Adding ammo drop since monster have 3x the amount of health of the monster that is replacing.
    DropItem "Clip",  170
    DropItem "Shell", 85


Gravity 0.75

	Scale 0.4
	States
	{
	Spawn:
        WNDZ A 0 A_StopSoundEx("soundslot5")
		WNDZ A 10 A_Look
		Loop
	See:
        WNDA A 0 A_PlaySoundEx("wendy/loop","soundslot5",1)
		WNDA AABBCDDEEFGHHIIJKLLMNNOOPQRRS 1 Fast A_Chase
	TNT1 A 0 A_SpawnItem("Blood")
		Loop

	Melee:
        WNDB A 0 A_StopSoundEx("soundslot5")
TNT1 A 0 A_PlaySound("wendy/pre_melee")
		WNDB AABCDDEFFGGHIJJKLLMMNOO 1 A_FaceTarget
TNT1 A 0 A_PlaySound("wendy/melee")
		WNDB P 0 A_CustomBulletAttack(1, 1, 1, 15,"BulletPuff",128)//Using this, so melee activates at 64px while making effect up to 128 px. Silly, but it works.
//A_SargAttack
		WNDB PQQRR 1 A_FaceTarget
		Goto See

	Pain:
		WNDA Q 1 A_ChangeFlag("NoPain",1)
		WNDA R 1 A_ChangeFlag("invisible",0)
		WNDA S 1 A_Pain
		Goto See
	Death:
		TNT1 A 0 A_SpawnItemEx(DestroyableBodyThing,0,0,0,0,0,0,0,SXF_NOCHECKPOSITION|SXF_SETMASTER)
		BPLZ A 0 A_ChangeFlag("noclip",true)
TNT1 A 0 A_ChangeVelocity(0.0, 0.0, 7.0,CVF_RELATIVE)
        WNDB A 0 A_StopSoundEx("soundslot5")
		WNDC A 2 A_ChangeFlag("invisible",0)
//        TNT1 A 0 A_SpawnItemEx("Wendy_Death",0,0,0,0,0,0,0,0)

		WNDC B 1 A_ScreamAndUnblock//A_Scream
		WNDC D 2 //A_NoBlocking
WNDC EFFGGHIJJKLLMNNOPQQRSS 1

		WNDC T -1 A_ChangeFlag("NoBlockmap",0)

		Stop
	}
}


//Done this way because of messed up models death offset
actor Wendy_Death
{
	Game Doom
	+NOBLOCKMAP
	+NOCLIP

Gravity 0.75
	Scale 0.4
	States
	{
	Spawn:
WNDC A 1
TNT1 A 0 A_ChangeVelocity(0.0, 0.0, 7.0,CVF_RELATIVE)

WNDC BCDDEFFGGHIJJKLLMNNOPQQRSS 1

		WNDC T -1 A_ChangeFlag("NoBlockmap",0)
		Stop
	}
}

