// Town 8: Barbarian Altar
begintownscript;

variables;

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

body;

beginstate INIT_STATE;
	set_crime_tolerance(2);
	
	set_name(6,"Sss-Khsss");
	
	if (get_flag(8,1) == 0) {
		force_instant_terrain_redraw();
		set_flag(8,1,1);
		message_dialog("Nearly blind in the darkness, wandering amidst the trees, you stop short suddenly. You hear the hissing of more barbaric sliths just in front of you. You can also feel the crackle of magical energy, tainted with a dark oily humidity.","The sliths before you are engaged in the worship of some foul god.");
		}
		
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
break;

beginstate 10; // barbarian chief dying
	set_flag(8,0,1);
	message_dialog("Terribly wounded, Sss-Khsss finally succumbs. He attempts to utter more words of magic, but the power has left him. He falls, saying as he dies, _You cannot stop the Thkhi! We will continue... continue...._","You take note of this word. It must be important.");
break;

beginstate 11;
if (get_flag(8,2) == 0) {
	reset_dialog();
	add_dialog_str(0,"In this chest, you find a small, black book with runes across the front. It is a spellbook, perhaps a powerful one!",0);
	add_dialog_str(1,"Reading strange spellbooks can be dangerous: they can carry curses or other terrible effects. However, they can also have great spells recorded within.",0);
	add_dialog_str(2,"What do you do?",0);
	add_dialog_choice(0,"Leave it alone.");
	add_dialog_choice(1,"Attempt to read it.");
	if (run_dialog(1) == 2) {
		reset_dialog();
		// Requires Arcane Lore of 10.
		if (get_skill_total(42) >= 10) {
			set_flag(8,2,1);
			add_dialog_str(0,"The book is written in a strange rune script, but fortunately, due to your knowledge of Arcane Lore, you can read it.",0);
			if (get_flag(292,18) == 0) // flag for spell
				add_dialog_str(1,"The book describes an interesting new spell, one that blasts your enemies with a furious cold. (You learn a level of Bonechill.)",0);
			else
				add_dialog_str(1,"It's a spellbook describing how to cast Bonechill more efficiently. You read over it carefully.",0);
			inc_flag(292,18,run_dialog(1)); // flag for spell
			set_flag(292,0,1);
			}
		else
			message_dialog("The book is written in a strange rune script, and unfortunately, you can't read it. Perhaps if you knew more about Arcane Lore, you would be able to.","");
		}
	}
else
	message_dialog("You find the book on Bonechill again, but you don't learn anything new from it.","");
break;