//===== rAthena Script =======================================
//= Nightmare Biolabs
//===== Description: =========================================
//= Nightmare Biolabs Monster Spawn Script.
//===== Additional Comments: =================================
//= 1.0 First version. Boss and slaves spawn are assumptions
//		based on lhz_dun.txt monsters spawn. [Capuche]
//= 1.1 Changed MvP spawn based on the amount of
//		monsters killed. [Capuche]
//============================================================

lhz_dun_n,0,0	monster	Eremes Guille	3208,20,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Magaleta Sorin	3209,10,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Catherine Cheiron	3210,15,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Shecil Damon	3211,20,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Harword Alt-Eisen	3212,10,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Seyren Windsor	3213,10,5000,0,"lhz_dun_n::OnRegularDead"

lhz_dun_n,0,0	monster	Randel Lawrence	3226,10,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Flamel Emule	3227,10,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Celia Alde	3228,15,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Chen Liu	3229,15,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Gertie Wie	3230,15,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Alphoccio Basil	3231,10,5000,0,"lhz_dun_n::OnRegularDead"
lhz_dun_n,0,0	monster	Trentini	3232,10,5000,0,"lhz_dun_n::OnRegularDead"

lhz_dun_n,0,0,0	script	lhz_dun_n	-1,{
	end;
OnRegularDead:
	.@mob_id = killedrid;
	if (getd( ".lhz_dun_n" + .@mob_id ) < 100 && .lhz_dun_n_boss == 0) {
		setd ".lhz_dun_n" + .@mob_id, getd( ".lhz_dun_n" + .@mob_id ) + 1;
		if (getd( ".lhz_dun_n" + .@mob_id ) == 100) {
			.@mini_boss = .@mob_id + 6 + (.@mob_id > 3213);	// mini boss version ID: regular ID +6 for non-transcendent, +7 for others
			monster "lhz_dun_n",0,0,"--en--",.@mini_boss,1, "lhz_dun_n::OnMiniDead";
		}
	}
	end;
OnMiniDead:
	.@mob_id = killedrid;
	if (getd( ".lhz_dun_n" + .@mob_id ) < 10 && .lhz_dun_n_boss == 0) {
		setd ".lhz_dun_n" + .@mob_id, getd( ".lhz_dun_n" + .@mob_id ) + 1;
		.@regular = .@mob_id - 6 - (.@mob_id > 3219);
		if (getd( ".lhz_dun_n" + .@mob_id ) < 10)
			setd ".lhz_dun_n" + .@regular, 0;	// note: mini boss version can re-spawn when the count of mini boss dead is reached? (currently they don't)
		else {
			setarray .@mini_boss_list[0], 3214,3215,3216,3217,3218,3219,3233,3234,3235,3236,3237,3238,3239;
			for ( .@i = 0; .@i < 13; ++.@i ) {	
				if (getd( ".lhz_dun_n" + .@mini_boss_list[.@i] ) < 10)
					end;
			}
			// MvP monster seems to only spawn at 12 o'clock
			monster "lhz_dun_n",140,230,"--en--", F_Rand(3220,3221,3222,3223,3224,3225,3240,3241,3242,3243,3244,3245,3246),1, "lhz_dun_n::OnMyMVPDead";
			mapannounce "lhz_dun_n", "Voice of Reaper: It's been a while.", bc_map;	// unknown message
			.lhz_dun_n_boss = 1;
			for ( .@i = 0; .@i < 13; ++.@i ) {	
				.@regular = .@mini_boss_list[.@i] - 6 - (.@mini_boss_list[.@i] > 3219);
				setd ".lhz_dun_n" + .@regular, 0;
				setd ".lhz_dun_n" + .@mini_boss_list[.@i], 0;
			}
		}
	}
	end;
OnMyMVPDead:
	initnpctimer;
	.lhz_dun_n_delay = 0;
	killmonster "lhz_dun_n", "lhz_dun_n::OnMyMVPDead";
	mapannounce "lhz_dun_n", "Voice of Reaper: See you soon.", bc_map, "0x00FF00";
	end;
OnTimer60000:
	.lhz_dun_n_delay++;
	if (.lhz_dun_n_delay < 100) // unknown delay (currently 100 mins)
		initnpctimer;
	else {
		stopnpctimer;
		.lhz_dun_n_delay = 0;
		.lhz_dun_n_boss = 0;
	}
	end;
}
