// Town 53: Under the Temple
begintownscript;

variables;

short choice,i,j,k;
string dlgstr;

body;

beginstate INIT_STATE;
	set_crime_tolerance(2);
	
	set_name(6,"Zektoth");
	char_give_item(6,378);
	
	change_blocked(12,7,1);
	change_blocked(13,7,1);
	change_blocked(12,8,1);
	change_blocked(13,8,1);
	
	change_blocked(16,7,1);
	change_blocked(16,7,1);
	change_blocked(17,8,1);
	change_blocked(17,8,1);
	
	change_blocked(19,13,1);
	change_blocked(19,14,1);
	change_blocked(20,13,1);
	change_blocked(20,14,1);
	
	change_blocked(21,4,1);
	change_blocked(21,5,1);
	change_blocked(22,4,1);
	change_blocked(22,5,1);
	
	change_blocked(23,15,1);
	change_blocked(23,16,1);
	change_blocked(24,15,1);
	change_blocked(24,16,1);
	
	change_blocked(12,11,1);
	change_blocked(12,12,1);
	change_blocked(13,11,1);
	change_blocked(13,12,1);
	
	put_object_on_space(14,16,5);
	put_object_on_space(28,4,5);
	
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10;
	reset_dialog();
	add_dialog_str(0,"You find a ladder here. What do you do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Climb it.");
	if (run_dialog(1) == 1)
		block_entry(1);
	else
		move_to_new_town(52,6,3);
break;

beginstate 11;
	reset_dialog();
	add_dialog_str(0,"You find a ladder here. What do you do?",0);
	add_dialog_choice(0,"Leave.");
	add_dialog_choice(1,"Climb it.");
	if (run_dialog(1) == 1)
		block_entry(1);
	else
		move_to_new_town(52,6,22);
break;

beginstate 12;
	reset_dialog();
	add_dialog_str(0,"This book appears to be a record of offerings and rituals performed at this altar. It is hardly in complete sentences, much less does it provide a narrative of events, but you can discern a certain pattern in it nonetheless.",0);
	add_dialog_str(1,"It appears that Zektoth built this altar originally some years ago for the purpose of worshipping Sothana in private. However, some time ago, his prayers begin to change, and he notes having a vision of a very beautiful, dark woman as he prays.",0);
	add_dialog_str(2,"He sees this lady slith over and over again, and eventually he speaks with her. She teaches him a new prayer, one to herself. Soon he prays to her instead of to Sothana.",0);
	add_dialog_str(3,"One day he learns her name: she is Hathnazriakh, the Dark Temptress, the most evil goddess in the sliths' pantheon. By this time, he is so rapt that he does not hesitate to shift his loyalties.",0);
	add_dialog_str(4,"He came down here not long ago, intending to worship Hathnazriakh and create a magical army. Eventually he would arise and destroy the temple of Sothana, enslaving its inhabitants and transforming it into a temple of Hathnazriakh.",0);
	set_flag(53,3,run_dialog(1));
	if (get_flag(52,7))
		message_dialog("Very peculiar. The ancient book you read upstairs also mentioned a cult of Hathnazriakh among the worker sliths here. This cannot merely be coincidence.","");
break;

beginstate 13;
	message_dialog("You have triggered a trap! The ground beneath your feet explodes violently!","");
	kill_char(get_ran(1,0,3),2,1);
break;

beginstate 14;
	if (get_flag(53,1) == 0) {
		message_dialog("There is a brick in the wall here that, when pushed, makes a small section of the wall slide away. You pass through, and you can hear someone or something in the dark tunnel on the other side. As you do, you feel a hostile presence: you are under attack!","In the dark, you can see the glint of steel, and it moves rapidly, more rapidly than any normal being could. Your enemy has artificially enhanced himself in some terribly powerful way.");
		set_flag(53,1,1);
		}
break;

beginstate 15;
	if (get_flag(53,2) == 0) {
		message_dialog("When you step on these runes, you feel a magical scan rapidly passing over you. Before you can react, it is gone.","You have experienced such things elsewhere to make sure that only authorized persons could get enter a location. You are definitely not authorized. That presumably means that some nastiness awaits you.");
		set_flag(53,2,1);
		}
break;

beginstate 16;
	message_dialog("Zektoth's terrible power starts to fluctuate out of control, and his body flashes with a bright light. While you watch, he disintegrates! His body soon vanishes, leaving behind only the mighty gauntlets he wore and a small, silver key.","Sasha said that she not only wanted Zektoth dealt with but also wanted to know why he turned evil. His attack upon you has left you with no information about the cause of his corruption. Perhaps that evidence is elsewhere down here.");
	set_flag(52,3,1);
	change_spec_item(9,1);
break;