// author: TheKandiman, input from Jenalya and Pjotr Orial
// simple quest for headless man in gy inn
// state 0: first contact
// state 1: quest accepted
// state 2: items delivered, return for reward and followup story
// state 3: quest completed
027-2.gat,22,76,0|script|Thurstan|318,{
if (Sex == 0) set @madamsir$, "Madam";
if (Sex == 1) set @madamsir$, "Sir";
set @Graveyard_Inn_MASK, NIBBLE_6_MASK;
set @Graveyard_Inn_SHIFT, NIBBLE_6_SHIFT;
set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT);
set @Wisp_Powder, 50;
set @Polt_Powder, 50;
set @Spec_Powder, 50;
set @Iron_Pot, 50;
set @Conc_Pot, 30;
set @Red_Dye, 50;
set @Yellow_Dye, 50;
set @LB_Dye, 50;
set @Glue_Exp, 50000;
if (@state >= 3) goto L_Final;
if (@state == 2) goto L_Quest_finished;
if (@state == 1) goto L_Quest_progress;
mes "You see a man, propped up against the foot of the bed.";
mes "In his hand, he is holding what you assume to be his own head.";
next;
mes "You jump back a bit, startled, as the head starts talking to you!";
mes "It's a little strange watching him talk, but it's better than looking at what's left of his neck.";
next;
if (baselevel < 85) goto L_greet;
mes "[Headless Man]";
mes "\"Hello " + @madamsir$ + ". My name is Thurstan. Could I ask your assistance with something? I seem to be in a spot of difficulty.\"";
menu
"I'll listen, just keep that thing from dripping on me.", L_Quest_ask,
"Ack, a bloody talking head! Gross, no way!", L_Quest_close;
L_greet:
mes "[Headless Man]";
mes "\"Greetings " + @madamsir$ + "! Do you have any duck tape?\"";
close;
L_Quest_ask:
mes "[Thurstan]";
mes "\"A little while ago there was a patron visiting the inn...I can't remember his name now. He noticed this predicament I am in and offered to help me. He told me that he was an alchemist and that he had a recipe for an adhesive that would keep my head where it's supposed to be. Unfortunately, he wasn't able to stay long enough to gather all the ingredients for the spell, so he gave me the recipe instead. However, it's rather hard to gather things when I have to carry it around all day.\"";
next;
mes "[Thurstan]";
mes "\"I have a list of items and how many of each are needed. Would you mind gathering them for me?\"";
menu
"Lay it on me, Mr. Noggin!", L_Quest_start,
"Sorry, I'm kinda busy with, you know, living.", L_Quest_no;
L_Quest_close:
close;
L_Quest_start:
mes "[Thurstan]";
mes "\"Great! I will need the following things.\"";
mes "\"" + @Wisp_Powder + " Wisp Powder,\"";
mes "\"" + @Polt_Powder + " Poltergeist Powder,\"";
mes "\"" + @Spec_Powder + " Spectre Powder,\"";
mes "\"" + @Iron_Pot + " Iron Potion,\"";
mes "\"" + @Conc_Pot + " Concentration Potion,\"";
mes "\"" + @Red_Dye + " vials of Red Dye,\"";
mes "\"" + @Yellow_Dye + " vials of Yellow Dye,\"";
mes "\"and...\"";
mes "\"" + @LB_Dye + " vials of Light Blue Dye,\"";
next;
mes "[Thurstan]";
mes "\"My friend also said that I should use a metal bowl instead of a wooden one. I don't have one and I think a cauldron from the kitchen would be too big. Perhaps we could use an Infantry Helmet to serve that task.\"";
next;
mes "[Thurstan]";
mes "\"I know it probably doesn't seem like that much to you, but it is a really big deal for me. I will try to find something to compensate you for your efforts.\"";
set @state, 1;
callsub S_Update_Mask;
close;
L_Quest_no:
mes "[Thurstan]";
mes "\"Very well. Just don't come looking to me when your own head falls off!\"";
close;
L_Quest_progress:
mes "[Thurstan]";
mes "Have you managed to find those items yet?\"";
menu
"Yes, here you go!", L_Quest_check,
"What was I supposed to get again?", L_Quest_items,
"No, I'm still working on it.", L_Quest_close;
L_Quest_check:
if (countitem("WispPowder") < @Wisp_Powder ||
countitem("PoltergeistPowder") < @Polt_Powder ||
countitem("SpectrePowder") < @Spec_Powder ||
countitem("IronPotion") < @Iron_Pot ||
countitem("ConcentrationPotion") < @Conc_Pot ||
countitem("RedDye") < @Red_Dye ||
countitem("YellowDye") < @Yellow_Dye ||
countitem("LightBlueDye") < @LB_Dye ||
countitem("InfantryHelmet") < 1) goto L_Quest_notenough;
delitem "WispPowder", @Wisp_Powder;
delitem "PoltergeistPowder", @Polt_Powder;
delitem "SpectrePowder", @Spec_Powder;
delitem "IronPotion", @Iron_Pot;
delitem "ConcentrationPotion", @Conc_Pot;
delitem "RedDye", @Red_Dye;
delitem "YellowDye", @Yellow_Dye;
delitem "LightBlueDye", @LB_Dye;
delitem "InfantryHelmet", 1;
getexp @Glue_Exp, 0;
mes "[Thurstan]";
mes "\"Excellent, excellent!\"";
mes "";
mes "Thurstan takes your ingredients and seperates them into little piles according to some complex formula he is reading, seemingly from the tops of his shoes.";
next;
mes "[Thurstan]";
mes "\"Now if I could prevail upon you to mix the ingredients according to the instructions I have here, I would be greatly indebted.\"";
next;
mes "You mix the powders together in the Infantry bowl, adding potions and dyes as instructed. Gradually, the concoction starts to get tacky and takes on a hue similar to Thurstan's skin.";
mes "You can see him starting to get excited beside you...";
next;
mes "[Thurstan]";
mes "\"Oh this is perfect! I'll be back in action in no time!\"";
next;
mes "Thurstan covers the base of his neck with a thick coat of the glue using his free hand. He then lifts his head in both hands, places it on the layer of adhesive, and makes some minor adjustments to the position. He mutters an incantation that you can't make out and the wound across his neck seems to fade away.";
misceffect sfx_magic_transmute;
next;
mes "Thurstan is practically jumping for joy now.";
mes "";
mes "[Thurstan]";
mes "\"Thank you so much! That is such a weight on my shoulders! Now that I have some mobility back, let me see what I can do to repay you. Would you mind coming back in a few minutes?\"";
set @state, 2;
callsub S_Update_Mask;
close;
L_Quest_notenough:
mes "Thurstan quickly looks through the items you've brought.";
mes "[Thurstan]";
mes "\"It seems you are missing a few things. Please come back once you have everything on the list.\"";
close;
L_Quest_items:
mes "[Thurstan]";
mes "\"" + @Wisp_Powder + " Wisp Powder,\"";
mes "\"" + @Polt_Powder + " Poltergeist Powder,\"";
mes "\"" + @Spec_Powder + " Spectre Powder,\"";
mes "\"" + @Iron_Pot + " Iron Potion,\"";
mes "\"" + @Conc_Pot + " Concentration Potion,\"";
mes "\"" + @Red_Dye + " vials of Red Dye,\"";
mes "\"" + @Yellow_Dye + " vials of Yellow Dye,\"";
mes "\"" + @LB_Dye + " vials of Light Blue Dye,\"";
mes "\"We'll also need 1 Infantry Helmet to use as a bowl for mixing everything together.\"";
close;
L_Quest_finished:
mes "[Thurstan]";
mes "\"Thank you for all your help.\"";
next;
mes "[Thurstan]";
mes "\"It worked well and the bond seemed to be holding for a while. Then I started feeling a strange tingling in my neck. I suppose that was the adhesive starting to dissolve. I was leaned over my trunk digging around for something appropriate to give you..Aaaand once again my head left it's proper place.\"";
next;
getinventorylist;
if (@inventorylist_count == 100) goto L_Full_Inv;
mes "[Thurstan]";
mes "\"Please take this for your efforts. I got it in payment of some work I did protecting the pinkie population from a terrible scourge some time ago.\"";
getitem "pinkiehelmet", 1;
set @state, 3;
callsub S_Update_Mask;
close;
L_Full_Inv:
mes "[Thurstan]";
mes "\"I'd like to give you something for your efforts, but you're carrying too much stuff.\"";
close;
L_Final:
mes "[Thurstan]";
mes "\"I guess I will need to find another way to re-attach my cranium. If you come across any good alchemists who might be able to help, please let me know.\"";
close;
S_Update_Mask:
set QUEST_Graveyard_Inn,
(QUEST_Graveyard_Inn & ~(@Graveyard_Inn_MASK))
| (@state << @Graveyard_Inn_SHIFT);
return;
}