// Adorable and deadly.
class MiniDestructinator : SquareMonster
{
	int rocketchance;

	Default
	{
		Health 1500;
		Height 88;
		Mass 2000;
		Radius 24;
		PainChance 32;
		Speed 12;
		FastSpeed 18;
		ReactionTime 12;

		MaxTargetRange 2048;

		DamageFactor "Vacuum", 0.0;
		DamageFactor "HellDamage", 2.5;
		DamageFactor "MarbazookaBlast", 3.0;

		Obituary "$OB_MINIDESTRUCTINATOR";

		Monster;
		+DONTBLAST;
		+NOBLOOD;
		+FLOORCLIP;
		+DONTRIP;
		+NORADIUSDMG;

		SeeSound "minidestructinator/sight";
		ActiveSound "minidestructinator/active";
		PainSound "minidestructinator/pain";
		DeathSound "minidestructinator/death";
	}
	States
	{
	Spawn:
		MDST A 0 { self.rocketchance = 0; }
		// fall through
	Look:
		MDST A 10 A_Look();
		Loop;
	See:
		MDST A 20;
	SeeLoop:
		MDST B 0 A_PlaySound("minidestructinator/hoof", CHAN_ITEM);
		MDST BB 2 A_Chase();
		MDST CC 2 A_Chase();
		MDST D 0 A_PlaySound("minidestructinator/hoof", CHAN_ITEM);
		MDST DD 2 A_Chase();
		MDST EE 2 A_Chase();
		Loop;
	Missile:
		MDST F 0 A_Jump(128, "MachinegunOpen");
		MDST F 0 A_JumpIfCloser(384, "GrenadeOpen");
		MDST F 0 A_JumpIfCloser(1024, "RocketFire");
		Goto MachinegunOpen;
	GrenadeOpen:
		MDST F 0 A_PlaySound("minidestructinator/attack/grenade", CHAN_VOICE);
		MDST F 0 A_PlaySound("minidestructinator/attack/grenade/open", CHAN_ITEM);
		MDST FGHIIII 4 A_FaceTarget();
	GrenadeFire:
		MDST J 0 A_PlaySound("minidestructinator/attack/grenade/fire", CHAN_ITEM);
		MDST J 0 A_FaceTarget();
		MDST J 6 A_SpawnProjectile("BloodnadeProjectile", 32, 18, 0);
		MDST II 6 A_FaceTarget();
		Goto SeeLoop;
	MachinegunOpen:
		MDST K 0 A_PlaySound("minidestructinator/attack/repeater", CHAN_VOICE);
		MDST K 0 A_PlaySound("minidestructinator/attack/repeater/open", CHAN_ITEM);
		MDST KLMNNNN 4 A_FaceTarget();
	MachinegunFire:
		MDST O 0 A_FaceTarget();
		MDST O 4 Bright A_SpawnProjectile("MiniLaser", 44, -26, random(-1,1));
		MDST N 4 A_MonsterRefire(10, "SeeLoop");
		Goto MachineGunFire;
	RocketFire:
		MDST P 0 { self.rocketchance = 0; }
		MDST P 0 A_PlaySound("minidestructinator/attack", CHAN_VOICE);
		MDST P 0 { self.bNoPain = true; }
		MDST P 13 A_FaceTarget();
		MDST P 0 A_VileTarget("MiniDestructinatorCrosshair");
		MDST PPPP 10 Bright A_FaceTarget();
		MDST P 0 A_PlaySound("minidestructinator/attack/rocket", CHAN_VOICE);
		MDST QP 6 A_FaceTarget();
		MDST Q 0 A_SpawnProjectile("MiniDestructinatorMissile", 62, -6, -10);
		MDST QP 7 A_FaceTarget();
		MDST P 0 { self.bNoPain = false; }
		MDST Q 0 A_SpawnProjectile("MiniDestructinatorMissile", 62, -6, 10);
		MDST QP 7 A_FaceTarget();
		MDST A 8;
		Goto SeeLoop;
	Pain:
		MDST S 5;
		MDST S 5 A_Pain();
		MDST S 0 { self.rocketchance += 64; }
		MDST S 0 A_CheckSight("SeeLoop");
		MDST S 0 A_Jump(rocketchance, "RocketFire");
		Goto SeeLoop;
	Death:
		MDST S 0 { self.bNoPain = false; }
		MDST S 5 A_Scream();
		MDST S 18 A_SpawnItemEx("ExplosionAlt", random(-20,20), random(-20,20), random(40,60));
		MDST S 18 A_SpawnItemEx("ExplosionAlt", random(-20,20), random(-20,20), random(40,60));
		MDST T 6 A_NoBlocking();
		MDST U 6;
		MDST V 12;
		MDST W 5;
		MDST X 5;
		MDST Y 0 A_SpawnItemEx("CrystalGibSpawner");
		MDST YY 0 A_SpawnItemEx("MibSpawnerDestructinator", random(-30,30), random(-35,35), random(0, 24));
		MDST YYY 1 A_SpawnItemEx("Explosion", random(-20,20), random(-20,20), random(16, 32));
		MDST Y 3;
		MDST Z 3;
		MDST [ 12;
		Stop;
	}
}
