//===========================================================================
//
// Dogbox (Real name is Cartdog, but I like to call it dogbox)
//
//===========================================================================
ACTOR Dogbox 
{
	//$Category Doosk Monsters
	//$Sprite DGBXA0
	//$Title Dogbox (Cartdog)
	//$Color 6
	var int user_chargecooldown;
	Game Doom
	SpawnID 9
	Health 528//440//300
	GibHealth 75
	PainChance 255
	+QUICKTORETALIATE
	
	+NOPAIN

	Speed 4
	Radius 30
	Height 56
	Mass 400

	Monster
	+FLOORCLIP
	SeeSound "dogbox/sight"
//	AttackSound "dogbox/melee"
	PainSound "dogbox/pain"
	DeathSound "dogbox/death"
	ActiveSound "dogbox/active"//empty
	Obituary "$DGBX_DTH"

//Adding ammo drop since monster have almost 4x the amount of health of the monster that is replacing.

    DropItem "ClipReplacer",  85
    DropItem "ShellReplacer", 170


MaxTargetRange 256

Gravity 0.75

	Scale 0.25
	States
	{
	Spawn:
        DGBX A 0 A_StopSoundEx("soundslot5")
		DGBX A 10 A_Look
		Loop


	See:
		D4DW A 0 A_JumpIf(user_chargecooldown<1,"See_Charge")


	See_Nocharge:
        DGBX A 0 A_PlaySoundEx("dogbox/loop","soundslot5",1)
		DGBX AABBCDDEEFGHHIIJKLLMNNOOPQRRS 1 A_Chase("Melee","")
TNT1 A 0 A_SetUserVar(user_chargecooldown,user_chargecooldown-1)
		Goto See

	See_Charge:
        DGBX A 0 A_PlaySoundEx("dogbox/loop","soundslot5",1)
		DGBX AABBCDDEEFGHHIIJKLLMNNOOPQRRS 1 A_Chase
TNT1 A 0 A_SetUserVar(user_chargecooldown,user_chargecooldown-1)
		Goto See



	Melee:
	Missile:
//        TNT1 A 0 A_StopSoundEx("soundslot5")
TNT1 A 0 A_PlaySound("dogbox/attack")
		D4DN A 0 A_SetUserVar(user_chargecooldown,1)
		TNT1 A 0 A_FaceTarget
	TNT1 A 0 A_Recoil(-25)

		DGBX AABB 1 Fast //A_FaceTarget
	TNT1 A 0 A_Recoil(-15)
	
		DGBX CDDEEFGHHIIJKLLMNNOOPQRRS 1 Fast A_JumpIf(velx==0 && vely==0,"CrashedSomewhere")//A_FaceTarget
TNT1 A 0 A_PlaySound("dogbox/melee")
		TNT1 A 0 Fast A_CustomBulletAttack(1, 1, 1, 15,"BulletPuff",128)
//A_SargAttack
		DGBX PQQRR 1 Fast //A_FaceTarget
		Goto See


	CrashedSomewhere:
        TNT1 A 0 A_StopSoundEx("soundslot5")
		TNT1 A 0 Fast A_CustomBulletAttack(1, 1, 1, 15,"BulletPuff",128)
		DGBX R 35 Fast //A_FaceTarget
		Goto See



	Pain:
		DGBX S 2 Fast A_Pain
		Goto See
	Death:
		BPLZ A 0 A_ChangeFlag("noclip",true)
        WNDB A 0 A_StopSoundEx("soundslot5")
//        TNT1 A 0 A_SpawnItemEx("dogbox_Death",0,0,0,0,0,0,0,0)

		TNT1 A 2 A_ScreamAndUnblock

        TNT1 A 1 A_SpawnItemEx("Dusk_GenericMonsterGore",0,0,0,0,0,0,0,32)
		TNT1 AAAAAAAAAA 0 A_CustomMissile("Doosk_WoodParticle",32,0,random(0,359))

		TNT1 A -1 A_ChangeFlag("NoBlockmap",0)

		Stop
	}
}

