1---------------------------------------------------------------------
2-- This file is part of Freedroid
3--
4-- Freedroid is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
8--
9-- Freedroid is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14-- You should have received a copy of the GNU General Public License
15-- along with Freedroid; see the file COPYING. If not, write to the
16-- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
17-- MA 02111-1307 USA
18----------------------------------------------------------------------
19--[[WIKI
20PERSONALITY = { "Delusional", "Lonely", "Heartbroken", "Intelligent" },
21MARKERS = {
22	NPCID1 = "Koan",
23	NPCID2 = "SADD",
24	QUESTID1 = "Tania's Escape",
25	ITEMID1 = "Strength Pill",
26},
27PURPOSE = "$$NAME$$\'s entrapment is the subject of the quest $$QUESTID1$$. Tux must rush to prevent $$NPCID2$$ from attacking $$NAME$$.",
28BACKSTORY = "$$NAME$$ is a brilliant biologist who worked in the \'Secret Area\' facility. This facility developed and produced
29	 $$ITEMID1$$s. Since The Great Assault, $$NAME$$ has been living locked up in the facility. Initially, $$NAME$$ had a companion,
30	 Peter, who, after consuming too many $$ITEMID1$$s, became delusional about his increased abilities and perished in an accident.",
31RELATIONSHIP = {
32	{
33		actor = "$$NPCID1$$",
34		text = "The relationship between $$NAME$$ and $$NPCID1$$ is unclear. However, $$NAME$$ will respond badly if Tux
35		 has killed him."
36	},
37}
38WIKI]]--
39
40local Npc = FDrpg.get_npc()
41local Tux = FDrpg.get_tux()
42
43return {
44	FirstTime = function()
45		show("node0")
46	end,
47
48	EveryTime = function()
49		show("end_default")
50		if (Koan_murdered) then
51			Npc:says(_"You just killed him!")
52			Npc:says(_"How could you?")
53			Npc:says(_"You murderer!")
54			npc_faction("crazy", _"Tania - Avenging Koan")
55			end_dialog()
56		end
57
58		if (Tux:has_quest("Tania's Escape")) then
59			hide("node1", "node2", "node3", "node4", "node5", "node6", "node7", "node10", "node11", "node12", "node13", "node14", "node17", "node18", "node19", "end_default")
60			if (not Tania_position) then -- Tania hasn't moved yet - she isn't following Tux.
61				Npc:says_random(_"I long to see the surface.",
62								_"You are the most interesting hallucination yet.")
63				show("end_default")
64				if (not SACD_gunsoff) then --Guns are still on
65					hide("node27")
66					show("node28")
67				elseif (not Tania_guns_off) then --Guns are off, but you haven't told Tania yet
68					hide("node28")
69					show("node27")
70				else --Tania can escape, but you haven't decided to let her follow you yet
71					hide("node27", "node28")
72					show("node40", "node41")
73				end
74			elseif (Tania_position == "underground") then --Tania is following you, but still Underground
75				Npc:says(_"I can't wait to leave this place.")
76				show("end_underground")
77			elseif (Tania_position == "desert") then --in the Western Desert
78				if (not Tania_discussed_surface) then
79					Tania_discussed_surface = true
80					Npc:says(_"It is so very bright and hot out here.") --thirsty dialog
81					show("node45", "node46", "node47")
82				elseif (Npc:get_damage() > 10) then --skip to injury dialog
83					next("node55")
84				else
85					Npc:says_random(_"Are we there yet?",
86									_"How much longer?")
87				end
88				show("end_desert")
89			elseif (Tania_position == "bunker") then --in the Western Desert
90				show("end_desert") --TODO: Tania talks about the bunker and Koan
91			elseif (Tania_position == "town_gate") and (not Spencer_Tania_decision) then --at the Town Entrance, waiting for Spencer's OK
92				hide("node45", "node46", "node47", "node49", "node50", "node51", "node52", "node53", "node56", "node57", "node58", "node59", "end_desert")
93				if (not Tania_met_Pendragon) then
94					Tania_met_Pendragon = true
95					Tux:update_quest("Tania's Escape", _"Pendragon just stopped Tania and I at the town gate. Apparently he won't let her in, unless Spencer gives the go-ahead.")
96					Npc:says(_"It is OK. I'll wait here at the gate.")
97					end_dialog()
98				end
99				show("end_towngate")
100			elseif (Tania_position == "town_gate") then --Town Entrance then (if Doc is alive) send her DocMoore's office, else set free (send to Bar)
101				Npc:says(_"What is the news?")
102				Tux:says(_"I talked to Spencer, and he said you were welcome to enter the town.")
103				Npc:says(_"That is great news!")
104				if (Spencer_Tania_decision == "doc_moore") then
105					Tux:says(_"He said you must first get checked out by Doc Moore though.")
106					Npc:set_destination("DocPatient-Enter")
107				else -- (Spencer_Tania_decision == "free") -- DocMoore is Dead!
108					Tux:says(_"He said you are free to go where you like.")
109					Npc:set_destination("BarPatron-Enter")
110				end
111				Tania_position = "town"
112				Tux:end_quest("Tania's Escape", _"I successfully brought Tania safely to the town. I hope she likes it here.")
113				if (difficulty("hard")) and
114				   (not Tania_mapper_given == true) then
115					Npc:says(_"I'm so glad that I am finally here, take this.")
116					Tux:add_item("Source Book of Network Mapper")
117					Tania_mapper_given = true
118				end
119				start_chat("Pendragon")
120				end_dialog()
121			elseif (Tania_position == "town") then --"Tania's Escape" was a success!
122				if (Spencer_Tania_decision == "doc_moore") then --send to Bar
123					Spencer_Tania_decision = "doc_moore_free"
124					Npc:heal()
125					Npc:says(_"I have good news: the doctor says I'm healthy!")
126					Npc:says(_"Where should I go?")
127					if (Tux:done_quest("Anything but the army snacks, please!")) then
128						show("node70")
129					else
130						show("node71")
131					end
132				end
133				show("end_town")
134			end
135		end
136
137		if (Tania_heal_node8) then
138			show("node8")
139		end
140	end,
141
142	{
143		id = "node0",
144		text = _"Um, hi.",
145		code = function()
146			Npc:says(_"Oh! It happened! I have been waiting for you for 3226 hours!") --@TODO use gametime (hours since game started) instead of 3226 hours ?
147			hide("node0") show("node1", "node3", "node14", "node19")
148		end,
149	},
150	{
151		id = "node1",
152		text = _"You knew I would come?",
153		code = function()
154			Npc:says(_"Of course, my little imaginary friend!")
155			hide("node1") show("node2", "node5")
156		end,
157	},
158	{
159		id = "node2",
160		text = _"Imaginary?! I am as real as you are.",
161		code = function()
162			Npc:says(_"This place is locked. Hermetically sealed and guarded by bots. So you can't possibly be anything more than the product of my imagination.")
163			Tux:says(_"But who are you?")
164			Npc:says(_"A figment of my imagination should know my name: Tania.")
165			Npc:set_name("Tania - lonely scientist")
166			hide("node2") show("node12")
167		end,
168	},
169	{
170		id = "node3",
171		text = _"Where am I?",
172		code = function()
173			Npc:says(_"In a prison, a luxurious prison. I am feeling quite lonely, as you can see. Big room, plenty of food, a waterfall behind the window...")
174			hide("node3") show("node4", "node6")
175		end,
176	},
177	{
178		id = "node4",
179		text = _"All I see through the window are ray emitters. And we are below ground level..",
180		code = function()
181			Npc:says(_"Yes, I know. But I so badly want to see sun, rivers, trees... there definitely is waterfall behind them!")
182			hide("node4")
183		end,
184	},
185	{
186		id = "node5",
187		text = _"It is dark here.",
188		code = function()
189			Npc:says(_"The main power supply is down, so only the emergency lights work. Peter tried to switch it back on, but he didn't succeed.")
190			hide("node5")
191		end,
192	},
193	{
194		id = "node6",
195		text = _"This place doesn't look like a prison.",
196		code = function()
197			Npc:says(_"In the past it was a secret lab. You heard about those strength pills? They were invented here. Other pills too, but I was working on the strength ones.")
198			hide("node6") show("node7", "node8")
199		end,
200	},
201	{
202		id = "node7",
203		text = _"Can you give me some pills then?",
204		code = function()
205			Npc:says(_"No, Peter ate them all. That killed him.")
206			Npc:says(_"*cries*")
207			Tux:says(_"They say that strength pills are absolutely safe!")
208			Npc:says(_"They are like money. Having money is good, but if you have too much, you can decide that you can do anything.")
209			Npc:says(_"Peter became not very strong, but very-very-very strong. He thought he could make an exit with his bare hands.")
210			Npc:says(_"*cries*")
211			Npc:says(_"If you go further down the corridor, you will find debris and a big stone. That is his grave.")
212			hide("node7") show("node10", "node11")
213		end,
214	},
215	{
216		id = "node8",
217		text = _"So you are a biologist? Could you heal me?",
218		code = function()
219			Npc:says(_"That would be something different from what I've done in the last months at least. Some entertainment.")
220			Npc:says_random(_"Let me take a look at that... it's nothing some nanobots couldn't take care of.... You will be all fixed up in a minute.",
221							_"You are now completely healed. You should take better care of yourself.")
222			Tux:heal()
223			Tania_heal_node8 = true
224			hide("node8")
225		end,
226	},
227	{
228		id = "node10",
229		text = _"You loved him?",
230		code = function()
231			Npc:says(_"I still do.")
232			hide("node10")
233		end,
234	},
235	{
236		id = "node11",
237		text = _"But why not go out through the door?",
238		code = function()
239			Npc:says(_"It is locked and very reliable. Even a tank would not be able to smash it! And if a door was broken, SADDs would attack, that's their program.")
240			hide("node11") show("node18")
241		end,
242	},
243	{
244		id = "node12",
245		text = _"Autoguns have made a hole in the wall. I came through this hole.",
246		code = function()
247			Npc:says(_"Do you mean I can go out to the surface?!")
248			Npc:says(_"Oh god! I - I told Peter that he chose the wrong place, but he was so stubborn!")
249			hide("node12") show("node13")
250		end,
251	},
252	{
253		id = "node13",
254		text = _"Yes, you can get to the surface. But the guns are still on.",
255		code = function()
256			Npc:says(_"All hope is lost! I'm a scientist, not a warrior.")
257			hide("node13") show("node15")
258		end,
259	},
260	{
261		id = "node14",
262		text = _"It is strange to see a girl in such a beautiful dress here.",
263		code = function()
264			Npc:says(_"I'm going to spend all my life here! So forgive me some little indulgences.")
265			hide("node14")
266		end,
267	},
268	{
269		id = "node15",
270		text = _"Maybe is it possible to disable the guns?",
271		code = function()
272			Npc:says(_"Theoretically yes, but in practice I'm not sure you would be able to do that.")
273			hide("node15") show("node16")
274		end,
275	},
276	{
277		id = "node16",
278		text = _"How can I disable the guns?",
279		code = function()
280			Npc:says(_"Somewhere in a distant part of the lab should be an SACD - Secret Area Control Datacenter. It controls all the defense systems in the base. If you manage to get to it, you would be able to control the base. However, it's very hard to find and get to the SACD.")
281			hide("node16") show("node17")
282		end,
283	},
284	{
285		id = "node17",
286		text = _"I will disable the guns for you.",
287		code = function()
288			Npc:says(_"Thanks... please be careful. You will not be able to access the control center directly, it is behind a triple hermetic door. Try using the service tunnels.")
289			Tux:add_quest("Tania's Escape", _"I have met a girl locked in a secret area. If I manage to disable the autoguns, she will be able to go to the surface and look at the sun again.")
290			Npc:says(_"It's dangerous to go alone! Take this!")
291			if (difficulty("easy")) and
292			   (not Tania_mapper_given == true) then
293				Tux:add_item("Source Book of Network Mapper")
294				Tania_mapper_given = true
295			end
296			Tux:add_item("EMP Shockwave Generator", 5)
297			hide("node17")
298		end,
299	},
300	{
301		id = "node18",
302		text = _"Why not just open them? There should be a way of unlocking the base.",
303		code = function()
304			Npc:says(_"To open the door you need to know the password. Only the commander of the area and his deputy knew it. The commander was killed by bots as soon as the assault started, and the deputy was in town, I don't know what happened to him.")
305			hide("node18")
306		end,
307	},
308	{
309		id = "node19",
310		text = _"Carpets, sofa, bookshelves. Where did you get all this?",
311		code = function()
312			Npc:says(_"Peter did all he could to make this room comfortable. The sofa and armchair are from the commanders cabinet, the books are from the lounge...")
313			hide("node19")
314		end,
315	},
316	{
317		id = "node27",
318		text = _"The sentry guns are off. You can go now!",
319		code = function()
320			Npc:says(_"Thanks, thanks a lot! Now I will be able to see the sun, trees, rivers... I missed those so much!")
321			Npc:says(_"I hope these books will help you.")
322			display_big_message(_"Tania is now free!")
323			Tux:add_xp(1500)
324			if (difficulty("normal")) and
325			   (not Tania_mapper_given == true) then
326				Tux:add_item("Source Book of Network Mapper")
327				Tania_mapper_given = true
328			end
329			Tux:add_item("Source Book of Check system integrity",1)
330			Tux:add_item("Source Book of Sanctuary",1)
331			Tux:update_quest("Tania's Escape", _"Tania is free now, I got some books as reward.")
332			Tux:says(_"You could always come back with me to the town. There are people there.")
333			Npc:says(_"I'd love to, but you'll have to escort me.")
334			Tania_guns_off = true
335			hide("node27") show("node40", "node41")
336		end,
337	},
338	{
339		id = "node28",
340		text = _"Where can I find that SACD?",
341		code = function()
342			Npc:says(_"To the right from the entrance of the area, there is a hall. In the south part of this hall you will find a triple hermetic door. The control center is behind that door. But it is locked, so you will have to find another way there. The cable collectors may help you.")
343			hide("node28")
344		end,
345	},
346	{
347		id = "node40",
348		text = _"I'm not ready to escort you to the town.",
349		code = function()
350			next("end_default")
351		end,
352	},
353	{
354		id = "node41",
355		text = _"I'm ready to escort you to the town.",
356		code = function()
357			Tania_position = "underground"
358			Tux:update_quest("Tania's Escape", _"I have agreed to escort Tania to the town. Once I'm there, I'll introduce her to Spencer.")
359			Npc:set_state("follow_tux")
360			hide("node8", "node40", "node41") next("end_underground")
361		end,
362	},
363	{
364		id = "node45",
365		text = _"It isn't all like this, the town is very nice.",
366		code = function()
367			hide("node45", "node46", "node47") next("node48")
368		end,
369	},
370	{
371		id = "node46",
372		text = _"I got lost in this desert once.",
373		code = function()
374			hide("node45", "node46", "node47") next("node48")
375		end,
376	},
377	{
378		id = "node47",
379		text = _"It must be hard adjusting to the bright sunlight.",
380		code = function()
381			Npc:says(_"I was underground for so long.")
382			Npc:says(_"It is all so bright on my eyes.")
383			hide("node45", "node46", "node47") next("node48")
384		end,
385	},
386	{
387		id = "node48",
388		code = function()
389			number_of_liquid_items = 0
390			if (Tux:has_item_backpack("Bottled ice")) then
391				number_of_liquid_items = number_of_liquid_items + 1
392				show("node49")
393			end
394			if (Tux:has_item_backpack("Industrial coolant")) then
395				number_of_liquid_items = number_of_liquid_items + 1
396				show("node50")
397			end
398			if (Tux:has_item_backpack("Liquid nitrogen")) then
399				number_of_liquid_items = number_of_liquid_items + 1
400				show("node51")
401			end
402			if (Tux:has_item_backpack("Barf's Energy Drink")) then
403				number_of_liquid_items = number_of_liquid_items + 1
404				show("node52")
405			end
406			if (number_of_liquid_items > 0) then
407				Npc:says(_"I hope we get there soon. I'm very thirsty.")
408			else
409				next("node54")
410			end
411			show("node53")
412		end,
413	},
414	{
415		id = "node49",
416		text = _"Would you like some bottled ice?",
417		code = function()
418			Npc:says(_"Thank you very much.")
419			Npc:says(_"I feel very refreshed!")
420			Npc:heal()
421			Tux:del_item_backpack("Bottled ice")
422			Tux:update_quest("Tania's Escape", _"Tania wasn't prepared for the desert heat. I gave her some bottled ice, and she looked much more healthy.")
423			hide("node49", "node50", "node51", "node52", "node53")
424		end,
425	},
426	{
427		id = "node50",
428		text = _"I have some industrial coolant you could have.",
429		code = function()
430			Npc:says(_"I can't drink this.")
431			if Tux:has_met("Ewald") then
432				Tux:says(_"I've seen the town bartender put it in drinks.")
433				Npc:says(_"I guess I'll give it a try then.")
434				Tux:del_item_backpack("Industrial coolant")
435				Npc:heal()
436				Npc:says(_"I feel very cold, but better.") --TODO: freeze her here
437				Tux:update_quest("Tania's Escape", _"Tania wasn't prepared for the desert heat. I gave her some Industrial coolant. At first she was hesitant, but she tried it.")
438				hide("node49", "node50", "node52", "node53")
439			else
440				next("node54")
441			end
442			hide("node51")
443		end,
444	},
445	{
446		id = "node51",
447		text = _"Can I offer you some liquid nitrogen?",
448		code = function()
449			Npc:says(_"I can't drink this.")
450			next("node54") hide("node51")
451		end,
452	},
453	{
454		id = "node52",
455		text = _"You could have a bottle of Barf's Energy Drink if you are thirsty?",
456		code = function()
457			Npc:says(_"Thank you very much.")
458			Npc:says(_"I feel very energetic!")
459			Npc:heal()
460			Tux:del_item_backpack("Barf's Energy Drink")
461			Tux:update_quest("Tania's Escape", _"Tania wasn't prepared for the desert heat. I gave her a bottle of Barf's Energy Drink. After downing it in a couple seconds, she looked much more energetic!")
462			hide("node49", "node50", "node51", "node52", "node53")
463		end,
464	},
465	{
466		--THIS WILL BE A LIE
467		id = "node53",
468		text = _"Sorry, I have nothing to offer you.",
469		code = function()
470			Npc:says(_"I feel very ill.")
471			Tux:update_quest("Tania's Escape", _"Tania wasn't prepared for the desert heat, but I decided not to share any of my liquids with her.")
472			Npc:drop_dead()
473			hide("node49", "node50", "node51", "node52", "node53")
474		end,
475	},
476	{
477		id = "node54",
478		code = function()
479			number_of_liquid_items = number_of_liquid_items - 1
480			if (number_of_liquid_items < 1) then
481				if (Npc:get_damage() > 10) then
482					next("node55")
483				else
484					Npc:says(_"I feel a little faint, but I think I will survive.")
485				end
486				hide("node53")
487			end
488		end,
489	},
490	{
491		id = "node55",
492		code = function()
493			injured_level = 0
494			if (Npc:get_damage() > 10) then
495				Npc:says(_"I am injured!")
496				injured_level = 1
497			elseif (Npc:get_damage() > 40) then
498				Npc:says(_"I am badly injured!")
499				injured_level = 2
500			elseif (Npc:get_damage() > 60) then
501				Npc:says(_"I am seriously injured!")
502				injured_level = 3
503			end
504
505			if (Tux:has_item_backpack("Doc-in-a-can")) then
506				show("node59")
507			end
508			if (Tux:has_item_backpack("Antibiotic") and
509			   (injured_level < 3)) then
510				show("node58")
511			end
512			if (Tux:has_item_backpack("Diet supplement") and
513			   (injured_level < 2)) then
514				show("node57")
515			end
516			show("node56")
517		end,
518	},
519	{
520		id = "node56",
521		text = _"There is nothing I can do about your injuries right now.",
522		code = function()
523			Npc:says(_"I hope we get to the town soon.")
524			hide("node56", "node57", "node58", "node59")
525		end,
526	},
527	{
528		id = "node57",
529		text = _"Here, take this Diet supplement.",
530		code = function()
531			Npc:says(_"I feel better now.")
532			Tux:del_item_backpack("Diet supplement")
533			Npc:heal()
534			hide("node56", "node57", "node58", "node59")
535		end,
536	},
537	{
538		id = "node58",
539		text = _"I'm prescribing you some antibiotics.",
540		code = function()
541			Npc:says(_"I feel much better.")
542			Tux:del_item_backpack("Antibiotic")
543			Npc:heal()
544			hide("node56", "node57", "node58", "node59")
545		end,
546	},
547	{
548		id = "node59",
549		text = _"I have a Doc-in-a-can. It should heal you right up.",
550		code = function()
551			Npc:says(_"I feel fit as new!")
552			Tux:del_item_backpack("Doc-in-a-can")
553			Npc:heal()
554			hide("node56", "node57", "node58", "node59")
555		end,
556	},
557	{
558		id = "node70",
559		text = _"I think you would enjoy some of Michelangelo's cooking at the restaurant.",
560		code = function()
561			Npc:set_destination("BarPatron-Enter")
562			Tania_at_Ewalds_Bar = true
563			Npc:says(_"It has been so long since I've had a nice meal.")
564			hide("node70")
565		end,
566	},
567	{
568		id = "node71",
569		text = _"You might try the bar. But stay away from the food. It is horrible.",
570		code = function()
571			Npc:set_destination("BarPatron-Enter")
572			Tania_at_Ewalds_Bar = true
573			Npc:says(_"I really miss good food, especially lemon meringue pie.")
574			Npc:says(_"Oh well.")
575			hide("node71")
576		end,
577	},
578	{
579		--Pre-"Tania's Escape" Quest
580		id = "end_default",
581		text = _"I think I have to go.",
582		code = function()
583			Npc:says_random(_"That's OK. But please, please, come back. I'm so lonely.",
584							_"Please come back again and get me out of here.")
585			hide("end_default") end_dialog()
586		end,
587	},
588	{
589		--"Tania's Escape" Quest (Underground)
590		id = "end_underground",
591		text = _"Follow me to the Surface!",
592		code = function()
593			Npc:says(_"Lead on, my little penguin.")
594			hide("end_underground") end_dialog()
595		end,
596	},
597	{
598		--"Tania's Escape" Quest (Western Desert)
599		id = "end_desert",
600		text = _"Follow me to the Town!",
601		code = function()
602			Npc:says(_"Lead on, my little penguin.")
603			hide("end_desert") end_dialog()
604		end,
605	},
606	{
607		--"Tania's Escape" Quest (Western Town Gate)
608		id = "end_towngate",
609		text = _"Wait here.",
610		code = function()
611			Npc:says(_"OK. But please, come back soon.")
612			hide("end_towngate") end_dialog()
613		end,
614	},
615	{
616		--"Tania's Escape" Quest (Western Town Gate to Doctor's Office)
617		id = "end_town",
618		text = _"See you later.",
619		code = function()
620			Npc:says_random(_"Please be safe!",
621							_"Thanks again.",
622							_"Please come back again, my little penguin.")
623			hide("end_town") end_dialog()
624		end,
625	},
626}
627