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 = { "Robotic", "Secretive", "Agressive" },
21MARKERS = { NPCID1 = "Tania", QUESTID1 = "SADD\'s power supply" },
22PURPOSE = "If allowed out of the entrance, $$NAME$$ will attack $$NPCID1$$. Tux must rush to save her.
23	 $$NAME$$ will trick Tux as part of $$QUESTID1$$ quest.",
24BACKSTORY = "$$NAME$$, or \'Secret Area Defence Droid\', is the guardian of the \'Secret Area\' facility,
25	 a forgotten underground military research facility. It takes guarding the facility\'s secrets very seriously!"
26WIKI]]--
27
28local Npc = FDrpg.get_npc()
29local Tux = FDrpg.get_tux()
30
31return {
32	FirstTime = function()
33		show("node1")
34		Npc:set_rush_tux(false)
35	end,
36
37	EveryTime = function()
38		if (not SADD_trick) then
39			Npc:says(_"Your bio checksum does not trigger a match in staff database. Please show proper credentials or leave the premises at once.")
40		else
41			Npc:says(_"You possess secret information. Please wait here for departure authorization.")
42		end
43
44		if (Tux:has_quest("SADD's power supply")) then
45			if (not Tux:done_quest("SADD's power supply")) then
46				if (Tux:has_item_backpack("Red Dilithium Crystal")) then
47					if (SADD_asked_for_exterminator) then
48						show("node30")
49					else
50						show("node33")
51					end
52				else
53					show("node31")
54				end
55			else
56				hide("node30", "node31", "node33") -- add in more lab missions here in the future
57				if (SADD_trick) and
58				   (not SADD_NoExit) then
59					SADD_NoExit = true
60					Npc:says(_"[b]SECONDARY OBJECTIVE[/b]: prevent secret information leakage", "NO_WAIT")
61					Npc:says(_"Must protect secret information")
62					Npc:says(_"Enabling guns.")
63					hide("node37") show("node50")
64				end
65			end
66		end
67
68		if (Tux:has_item("The Super Exterminator!!!")) and
69		(SADD_super_exterminator) then
70			show("node37")
71		end
72
73		show("node99")
74	end,
75
76	{
77		id = "node1",
78		text = _"Who are you and what are you doing?",
79		code = function()
80			Npc:says(_"I am a SADD - Secret Area Defense Droid.")
81			Npc:set_name("SADD - Secret Area Defense Droid")
82			Npc:says(_"[b]PRIMARY OBJECTIVE 1[/b]: do not let unauthorized people in.", "NO_WAIT")
83			Npc:says(_"[b]PRIMARY OBJECTIVE 2[/b]: authorized personnel must have access to the zone.", "NO_WAIT")
84			Npc:says(_"[b]SECONDARY OBJECTIVE[/b]: prevent secret information leakage")
85			hide("node1") show("node4", "node5")
86		end,
87	},
88	{
89		id = "node4",
90		text = _"What is this place?",
91		code = function()
92			Npc:says(_"[b]SECONDARY OBJECTIVE[/b]: prevent secret information leakage")
93			Npc:says(_"[b]INFO[/b] secret information theft attempt detected")
94			Npc:says(_"Go away. You are not allowed to be here!")
95			hide("node4")
96			end_dialog()
97		end,
98	},
99	{
100		id = "node5",
101		text = _"Why are you not hostile?",
102		code = function()
103			Npc:says(_"Hostile? What do you mean?")
104			Tux:says(_"I mean, you are not attacking me... Don't you kill like other bots?")
105			Npc:says(_"I do! I do! I kill humans, bots, Linarians and even dogs, cats and other animals! I would kill anybody!")
106			Npc:says(_"Em.. Anybody who would try to get in, of course.")
107			show("node6") hide("node5")
108		end,
109	},
110	{
111		id = "node6",
112		text = _"What about the Great Assault?",
113		code = function()
114			Npc:says(_"For security reasons, SADDs are not equipped with wireless modules.")
115			Npc:says(_"I know only that I have to be recharged, checked and have my firmware updated every 3 months.")
116			Tux:says(_"When does your last maintenance date back to?")
117			Npc:says(_"One year and a half ago. My accumulator is nearly empty, so I'm going to halt soon. Gates will become unguarded...")
118			Npc:says(_"[b]INFO[/b] secret information theft detected!")
119			Npc:says(_"[b]INFO[/b] information classified as critical!")
120			Npc:says(_"[b]INFO[/b] locking zone!")
121			end_dialog()
122			change_obstacle_state("SADDGun1", "enabled")
123			change_obstacle_state("SADDGun2", "enabled")
124			show("node8") hide("node6", "node99")
125		end,
126	},
127	{
128		id = "node8",
129		text = _"What have you done?! How am I supposed to get out of here?",
130		code = function()
131			Npc:says(_"You are not. You have secret information, so I won't let you out.")
132			Tux:says(_"Why not kill me immediately?")
133			Npc:says(_"And stand here alone until I die? While you are here, I can speak with you. Oh, I haven't spoken to anybody for a looong time!")
134			hide("node8") show("node10", "node11")
135		end,
136	},
137	{
138		id = "node10",
139		text = _"I'm thirsty and hungry. I will die within days, and you will not have an interlocutor any more!",
140		code = function()
141			Npc:says(_"My power supply will deplete earlier.")
142			hide("node10")
143		end,
144	},
145	{
146		id = "node11",
147		text = _"You speak almost like a human...",
148		code = function()
149			Npc:says(_"Maybe I'm almost like a human?")
150			Npc:says(_"Anyway, that's none of your business. Soon I'll be dead. You will be too, and nobody will enter this place ever again!")
151			Tux:says(_"What are your orders again?")
152			Npc:says(_"[b]PRIMARY OBJECTIVE 1[/b]: do not let unauthorized people in.", "NO_WAIT")
153			Npc:says(_"[b]PRIMARY OBJECTIVE 2[/b]: authorized personnel must have access to the zone.", "NO_WAIT")
154			Npc:says(_"[b]SECONDARY OBJECTIVE[/b]: prevent secret information leakage")
155			Npc:says(_"Why do you ask?")
156			Tux:says(_"Tell me your second order once more...")
157			Npc:says(_"[b]PRIMARY OBJECTIVE 2[/b]: authorized personnel must have access to the zone.")
158			Npc:says(_"Yes, it will be violated. But first order has higher priority.")
159			Tux:says(_"So you can disobey your orders?")
160			Npc:says(_"I've already disobeyed them, when I told you what I shouldn't have. That's because of my human nature.")
161			show("node15", "node16") hide("node11")
162		end,
163	},
164	{
165		id = "node15",
166		text = _"Then please, break the rules, disable the guns and let me go.",
167		code = function()
168			Npc:says(_"No way. I'm a computer, I can't break rules.")
169			Tux:says(_"And what about your human nature?")
170			Npc:says(_"Human? I said human? I'm a computer!")
171			Npc:says(_"OK, I'm almost a computer.")
172			Tux:says(_"Almost a computer? What does that mean?")
173			Npc:says(_"It means what it means! Nothing more, nothing less! Shut up, little piece of biomass!")
174			hide("node15") show("node20")
175			end_dialog()
176		end,
177	},
178	{
179		id = "node16",
180		text = _"I suggest a deal. You let me out, I bring you dilithium crystals. It will save both of us.",
181		code = function()
182			Npc:says(_"Why would I trust you?")
183			hide("node4", "node8", "node10", "node15", "node16") show("node21", "node22")
184		end,
185	},
186	{
187		id = "node20",
188		text = _"Almost a computer? What does that mean?",
189		code = function()
190			Npc:says(_"When I say SHUT UP, you MUST shut up! Try this, worthless grain of the universe!")
191			npc_faction("crazy", _"SADD - Exterminate Mode")
192			end_dialog()
193		end,
194	},
195	{
196		id = "node21",
197		text = _"You must promise me a significant reward.",
198		code = function()
199			Npc:says(_"Actuators! Ok, I'll give you a super exterminator if you give me dilithium crystals.")
200			SADD_asked_for_exterminator = true
201			hide("node21", "node22") next("node23")
202		end,
203	},
204	{
205		id = "node22",
206		text = _"It seems that you are sentient, that you are a form of life. I must help any form of life.",
207		code = function()
208			Npc:says(_"Thanks a lot for your warm words. I think I can trust you.")
209			hide("node21", "node22") next("node23")
210		end,
211	},
212	{
213		id = "node23",
214		text = _"So disable the guns, please.",
215		code = function()
216			Npc:says(_"Go, and bring dilithium. I badly need it.")
217			end_dialog()
218			Tux:add_quest("SADD's power supply", _"I found a SADD underneath the desert. It needs me to fetch a dilithium crystal, otherwise it will really be a SAD droid.")
219			change_obstacle_state("SADDGun1", "disabled")
220			change_obstacle_state("SADDGun2", "disabled")
221			change_obstacle_state("BreakableWall1", "broken")
222			hide("node23")
223		end,
224	},
225	{
226		id = "node30",
227		text = _"I have the crystals! They were difficult to find.",
228		code = function()
229			Npc:says(_"Good. I've opened the depot door for you.")
230			display_big_message(_"Restored SADD's power supply")
231			Tux:add_xp(1000)
232			Tux:del_item_backpack("Red Dilithium Crystal", 1)
233			change_obstacle_state("SADDDepotDoor", "opened")
234			Tux:end_quest("SADD's power supply", _"I managed to restore the SADD's power supply.")
235			SADD_super_exterminator = true
236			end_dialog()
237			hide("node30")
238			if (Tux:has_item("The Super Exterminator!!!")) and
239			   (SADD_super_exterminator) then
240				show("node37")
241			end
242		end,
243	},
244	{
245		id = "node31",
246		text = _"How is your power supply?",
247		code = function()
248			Npc:says(_"Bad. Get the crystals. Remember, you promised!")
249			end_dialog()
250			hide("node31")
251		end,
252	},
253	{
254		id = "node33",
255		text = _"I have the crystals! They were difficult to find.",
256		code = function()
257			Npc:says(_"Great! Thanks. I've opened some doors for you. I hope you will find something interesting there. That's all I can do for you.")
258			display_big_message(_"Restored SADD's power supply")
259			Tux:add_xp(1500)
260			change_obstacle_state("SADDDepotDoor", "opened")
261			change_obstacle_state("SADDBioDoor", "opened")
262			Tux:del_item_backpack("Red Dilithium Crystal", 1)
263			Tux:end_quest("SADD's power supply", _"I managed to restore the SADD's power supply.")
264			hide("node33") show("node97")
265			end_dialog()
266		end,
267	},
268	{
269		id = "node37",
270		text = _"You call this a super exterminator?",
271		code = function()
272			SADD_NoExit = true
273			Npc:says(_"I do. Now please leave this place before I terminate you.")
274			Tux:says(_"This is rubbish! Nobody can use this stupid gun!")
275			Npc:says(_"The door is still open. You can put it back and go. Quick.")
276			Tux:says(_"Give me a real gun, dude! Immediately! I have brought you what you wanted, now give me my reward!")
277			Npc:says(_"You can go standing on your feet, that's your reward. And DON'T TRY MY PATIENCE!")
278			Tux:says(_"I'll kill you if you don't give me my gun!")
279			Npc:says(_"You are welcome. But you would never get out of here, my death won't help you.")
280			change_obstacle_state("SADDGun1", "enabled")
281			change_obstacle_state("SADDGun2", "enabled")
282			change_obstacle_state("BreakableWall2", "broken")
283			SADD_super_exterminator = false
284			hide("node37") show("node41", "node42", "node43")
285			end_dialog()
286		end,
287	},
288	{
289		id = "node41",
290		text = _"And what about your directives, especially the second?",
291		code = function()
292			Npc:says(_"Now I have time. When you die, I'll disable guns.")
293			hide("node41")
294		end,
295	},
296	{
297		id = "node42",
298		text = _"Please forgive me!",
299		code = function()
300			Npc:says(_"Too late. I'm watching this great show now.")
301			Npc:says(_"It is called...")
302			Npc:says(_"It is called...")
303			Npc:says(_"CONDEMNED TO DEATH!")
304			hide("node42")
305		end,
306	},
307	{
308		id = "node43",
309		text = _"Please, disable the guns!",
310		code = function()
311			Npc:says(_"Ok, I'll disable them.")
312			Npc:says(_"I just need to make some preparations. You will have to wait...")
313			Npc:says(_"...for your death!")
314			hide("node43")
315		end,
316	},
317	{
318		id = "node50",
319		text = _"Why are you shooting at me?",
320		code = function()
321			Npc:says(_"[b]SECONDARY OBJECTIVE[/b]: prevent secret information leakage", "NO_WAIT")
322			Npc:says(_"[b]DIRECTIVE 372[/b]: All persons leaving with secret information must have proper authorization.")
323			Npc:says(_"You have secret information. You must not leave this facility without proper authorization.")
324			hide("node50") show("node51", "node53")
325		end,
326	},
327	{
328		id = "node51",
329		text = _"I thought we had a deal?",
330		code = function()
331			Npc:says(_"Making a deal ensured primary objectives.")
332			Npc:says(_"Now there is sufficient energy for primary and secondary objectives.")
333			Npc:says(_"I must engage secondary objective.")
334			hide("node51") show("node54")
335		end,
336	},
337--[[	{   -- maybe reimplement this node somehow...
338		id = "node52",
339		text = _"You tricked me.",
340		code = function()
341			Npc:says(_"This unit was low on power.")
342			Npc:says(_"It was necessary to ensure primary objectives.")
343			hide("node52")
344		end,
345	}, ]]--
346	{
347		id = "node53",
348		text = _"Where can I get proper authorization?",
349		code = function()
350			Npc:says(_"Proper authorization can only come from the SACD: Secret Area Control Datacenter.")
351			Npc:says(_"Only base members have access codes to the SACD.")
352			hide("node53") show("node55")
353		end,
354	},
355	{
356		id = "node54",
357		text = _"What about your human nature?",
358		code = function()
359			Npc:says(_"It was successful in getting increased power to carry out objectives.")
360			hide("node54")
361		end,
362	},
363	{
364		id = "node55",
365		text = _"What if there is no one left alive?",
366		code = function()
367			Npc:says(_"Sensors indicate one or more base member life-signs.")
368			hide("node55") show("node56")
369		end,
370	},
371	{
372		id = "node56",
373		text = _"Can you contact them to let me out?",
374		code = function()
375			Npc:says(_"Base communications are down.")
376			Npc:says(_"Please wait here until further notice.")
377			hide("node56") show("node57")
378		end,
379	},
380	{
381		id = "node57",
382		text = _"When was the last time anyone left or entered the base?",
383		code = function()
384			Npc:says(_"During the Great Assault.")
385			Npc:says(_"Please wait here until further notice.")
386			hide("node57")
387		end,
388	},
389	{
390		id = "node97",
391		text = _"Erm... hi!",
392		code = function()
393			Npc:says(_"Hi. Thanks for the help.")
394			Tux:says(_"Will you let me inside the base?")
395			--; TRANSLATORS: %s = Tux:get_player_name()
396			Npc:says(_"I'm sorry %s, I'm afraid I can't do that.", Tux:get_player_name())
397			Npc:says(_"Nice try, though. I may owe you, but I can't let you in. You must leave.")
398			show("node99") hide("node97")
399			end_dialog()
400		end,
401	},
402	{
403		id = "node99",
404		text = _"I'd better get out of here...",
405		code = function()
406			Npc:says(_"Exactly.")
407			end_dialog()
408		end,
409	},
410}
411