// Script by Zippy_Zolton. Contact me on Discord - Zolton#4312

// freeslot is to prevent errors if the supported mod is not loaded

freeslot("MT_ANTISHRIMP")

addHook("BossThinker", function(mo)
if not (mo.valid and mo.health != 0) return end
// Null PinchMusic :3
	if mo.type == MT_CYBRAKDEMON and mo.health == mo.info.damage and mo.pinchmusic != true
		P_StartQuake(9*FRACUNIT, 30)
		S_StartSound(nil, sfx_kc67)
		S_ChangeMusic("PNNULL", true)
		mo.pinchmusic = true
// Anti-Shrimp plays it on his final attack
	elseif mo.type == MT_ANTISHRIMP and mo.health == 1 and mo.pinchmusic != true
		P_StartQuake(9*FRACUNIT, 30)
		S_StartSound(nil, sfx_kc67)
		S_ChangeMusic("VSPNCH", true)
		mo.pinchmusic = true
// generic function if all else fails
	elseif (mo.health == mo.info.damage or (mo.health == 3 and mo.info.damage == 0)) and mo.pinchmusic != true and mo.type != MT_ANTISHRIMP
		P_StartQuake(9*FRACUNIT, 30)
		S_StartSound(nil, sfx_kc67)
		S_ChangeMusic("VSPNCH", true)
		mo.pinchmusic = true
	end
end)