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 = { "Exhausted", "Haunted", "Trapped" },
21BACKSTORY = "$$NAME$$ is a mine worker and former member of the Red Guard. He is haunted by the loss of comrades at Hell Fortress."
22WIKI]]--
23
24local Npc = FDrpg.get_npc()
25local Tux = FDrpg.get_tux()
26
27return {
28	FirstTime = function()
29		show("node0")
30		Bruce_helmet_sell = -1
31		-- -1: deal not initiated
32		-- 0, 20, 100: sell prices
33		-- -1000: deal failed (the "lost" case is handled separately)
34	end,
35
36	EveryTime = function()
37		if (tux_has_joined_guard) then
38			Npc:says(_"I am tired.")
39			Npc:says(_"Go away.")
40			end_dialog()
41		elseif (Bruce_wants_helmet) then
42			next("node30")
43			push_topic("Bruce wants Dixon's helmet")
44		else
45			if (not Bruce_hurt) and
46			(Tux:has_item_equipped("Dixon's Helmet")) then
47				if (Bruce_Dixons_helmet_lost) then
48					Npc:says(_"So, you've 'lost' the helmet, heh?")
49					Npc:says(_"Then, what's that on your head?")
50					Npc:says(_"Leave me alone!")
51					Bruce_hurt = true
52					hide("node0", "node1", "node2", "node3", "node4", "node5", "node6", "node7", "node10", "node11", "node12")
53				elseif (Bruce_helmet_sell == -1) then
54					next("node20")
55					push_topic("Bruce wants Dixon's helmet")
56				end
57			end
58		end
59		hide("node29") show("node99")
60	end,
61
62	{
63		id = "node0",
64		text = _"Are you all right? You don't look too good.",
65		code = function()
66			if (guard_follow_tux) then
67				Npc:says(_"I don't have time to talk: I'm far too busy working! I'm normally at the mines this time of day but I forgot something and that's...")
68				Npc:says(_"That's why I'm here. Now I must get back to the mines.")
69				end_dialog()
70			else
71				Npc:says(_"Good day. I am Bruce.")
72				Npc:says(_"I am unwell.")
73				Npc:set_name("Bruce - Mine Worker")
74				hide("node0") show("node1")
75			end
76		end,
77	},
78	{
79		id = "node1",
80		text = _"How is it going?",
81		code = function()
82			Npc:says(_"I am very tired, but otherwise well.")
83			hide("node1") show("node2")
84		end,
85	},
86	{
87		id = "node2",
88		text = _"You don't talk much, eh?",
89		code = function()
90			Npc:says(_"No, I am just too tired right now. I have been working in the mine for two weeks now.")
91			Npc:says(_"I feel totally wiped, so maybe it would be better if you came some other day.")
92			hide("node2") show("node3")
93		end,
94	},
95	{
96		id = "node3",
97		text = _"Why do you work so hard in the mine?",
98		code = function()
99			Npc:says(_"Because I must! The Red Guard makes everyone work up to their limits!")
100			Npc:says(_"If you do not work for a full work period, you will be in trouble.")
101			Npc:says(_"But I have no choice. I do not want to be a soldier again.")
102			hide("node3") show("node4")
103		end,
104	},
105	{
106		id = "node4",
107		text = _"You were a soldier before?",
108		code = function()
109			Npc:says(_"Yes. I would rather not talk about it.")
110			hide("node4") show("node5", "node6")
111		end,
112	},
113	{
114		id = "node5",
115		text = _"I have some bad memories too. I know how hard it can be to talk about them. Keep your stories for yourself.",
116		code = function()
117			Npc:says(_"Yes. And now I would like to go to sleep. Good night Linarian.")
118			hide("node5", "node6", "node7")
119			end_dialog()
120		end,
121	},
122	{
123		id = "node6",
124		text = _"I said, I want to know about your life as a soldier.",
125		code = function()
126			Npc:says(_"And I said that I do not want to talk about it. It hurts too much. Please, stop asking about it and leave me alone.")
127			hide("node6") show("node7")
128		end,
129	},
130	{
131		id = "node7",
132		text = _"You don't understand. I wasn't asking. Now, tell me about your life as a soldier, or I will tell the guards you are slacking off.",
133		code = function()
134			Npc:says(_"No! Please... I will do anything, just don't call the Red Guard! They do not like people who left the service. They do not like me.")
135			Npc:says(_"I will tell you everything.")
136			Bruce_hurt = true
137			hide("node5", "node7") show("node10")
138		end,
139	},
140	{
141		id = "node10",
142		text = _"Good. Start talking. Now.",
143		code = function()
144			Npc:says(_"Those are pretty painful and distant memories.")
145			Npc:says(_"After the Great Assault, I joined the Red Guard. They needed help and were looking for volunteers.")
146			Npc:says(_"I served there for a short while, and they even let me use an exterminator. But then after a failed mission, I resigned and never wore a uniform again.")
147			hide("node10") show("node11", "node12")
148		end,
149	},
150	{
151		id = "node11",
152		text = _"You mentioned an exterminator. What is it?",
153		code = function()
154			Npc:says(_"It is the best weapon that the Red Guard has against the bots.")
155			Npc:says(_"A direct hit from one of those guns is enough to turn most bots into scrap metal.")
156			Npc:says(_"Many of the great victories of the Red Guard are thanks to the exterminator.")
157			Npc:says(_"Of course, because of its small clip and terribly long reloading time, equally many deaths can be attributed to it.")
158			hide("node11")
159		end,
160	},
161	{
162		id = "node12",
163		text = _"A failed mission?",
164		code = function()
165			Npc:says(_"There were six of us. Me, Wilbert, Anderson and three others. I do not remember the names anymore. We were team number nine.")
166			Npc:says(_"It was a routine scout mission. We saw an interesting building which was not there before, and decided to take a look.")
167			Npc:says(_"It was a terrible fortress, many stories high. It had guns everywhere. When we got close the shooting started.")
168			Npc:says(_"They were waiting for us. Came in endless swarms. More and more and more. We stood our ground and kept firing, but it was no use. More of them came.")
169			Npc:says(_"Our ammunition ran out. They got close. It was the end of team number nine. The Hell Fortress took their lives. I ran. I survived.")
170			Npc:says(_"After that I decided that I am not fit to be one of the Red Guard. I resigned and started to work in the mine shortly after.")
171			Npc:says(_"I do not want to face the rage of the Hell Fortress ever again. Never again.")
172			hide("node12")
173		end,
174	},
175	{
176		id = "node20",
177		topic = "Bruce wants Dixon's helmet",
178		code = function()
179			Npc:says(_"What do you have there?")
180			Tux:says(_"What do you mean?")
181			Npc:says(_"That helmet. I could make good use of it, it looks quite solid.")
182			Npc:says(_"Can I buy it from you?")
183			Bruce_wants_helmet = true
184			hide("node20") show("node40", "node45", "node49")
185		end,
186	},
187	{
188		id = "node29",
189		text = _"Let's talk about the helmet.",
190		code = function()
191			hide("node29") next("node30")
192			push_topic("Bruce wants Dixon's helmet")
193		end,
194	},
195	{
196		id = "node30",
197		topic = "Bruce wants Dixon's helmet",
198		code = function()
199			Npc:says(_"So, what about the helmet now?")
200			if (Bruce_helmet_deal) then
201				Npc:says(_"I offered you 20 circuits for it.")
202			end
203			if (Bruce_helmet_sell == 20) then
204				Npc:says(_"You agreed.")
205				Tux:says(_"Indeed.")
206			elseif (Bruce_helmet_sell == 100) then
207				Npc:says(_"You suggested 100 circuits as a price.")
208				Npc:says(_"That is acceptable to me.")
209				Tux:says(_"Excellent.")
210			elseif (Bruce_helmet_sell == 0) then
211				Npc:says(_"You said you would give me the helmet for free.")
212				Tux:says(_"Yes, that's true.")
213			end
214			if (Tux:has_item_equipped("Dixon's Helmet")) then
215				Npc:says(_"Please unequip it, so we can proceed.")
216				Npc:says(_"I want to see your face as we talk.")
217				end_dialog()
218			elseif (Tux:has_item("Dixon's Helmet")) then
219				if (Bruce_helmet_sell == 0) then
220					Tux:says(_"Here you go.")
221					Npc:says(_"Oh, thank you!")
222					Npc:says(_"Here, take this Lamp, as a token of my esteem.")
223					Tux:says(_"Oh, thank you very much!")
224					Npc:says(_"You're welcome.")
225					Tux:add_item("Desk Lamp")
226				elseif (Bruce_helmet_sell == 20) then
227					Npc:says(_"Fine.")
228					Npc:says(_"Here are your 20 circuits.")
229					Tux:says(_"Here's your new helmet.")
230					Npc:says(_"Thank you.")
231					Tux:says(_"You're welcome.")
232					Tux:add_gold(20)
233				elseif (Bruce_helmet_sell == 100) then
234					Npc:says(_"Hmm...")
235					Npc:says(_"OK.")
236					Npc:says(_"Here, take the hundred bucks.")
237					Npc:says(_"Now give me that helmet!")
238					Tux:says(_"Here, take it.")
239					Tux:add_gold(100)
240				end
241				if (Bruce_helmet_sell > -1) then
242					Tux:del_item("Dixon's Helmet")
243					Bruce_wants_helmet = false
244					pop_topic() -- "Bruce wants Dixon's helmet"
245				end
246			else
247				Npc:says(_"Where is it?")
248				Npc:says(_"Did you lose it?")
249				Npc:says(_"Come back to me when you have it.")
250				show("node47", "node48")
251				push_topic("Lost Dixon's Helmet Y/N")
252			end
253		end,
254	},
255	{
256		id = "node40",
257		text = _"Yes, sure.",
258		topic = "Bruce wants Dixon's helmet",
259		code = function()
260			Npc:says(_"Good.")
261			Npc:says(_"Let's say, 20 circuits?")
262			Bruce_helmet_deal = true
263			if (Tux:has_item_equipped("Dixon's Helmet")) then
264				Npc:says(_"Please take off the helmet, so we can proceed trading.")
265				end_dialog()
266			end
267			hide("node40") show("node41", "node42", "node43", "node44")
268		end,
269	},
270	{
271		id = "node41",
272		text = _"You can have it for free.",
273		echo_text = false,
274		topic = "Bruce wants Dixon's helmet",
275		code = function()
276			Tux:says(_"I changed my mind.")
277			Tux:says(_"You can have it. For free.")
278			Npc:says(_"Oh... Oh my! Thanks!")
279			Npc:says(_"Wait, let me go get something first.")
280			Tux:says(_"Sure.")
281			Bruce_helmet_sell = 0
282			hide("node41", "node42", "node43", "node44", "node45")
283			Npc:set_destination("Bruce-move-target-label")
284			end_dialog()
285		end,
286	},
287	{
288		id = "node42",
289		text = _"20 circuits? OK.",
290		topic = "Bruce wants Dixon's helmet",
291		code = function()
292			Npc:says(_"Okay.")
293			Npc:says(_"Let me quickly go get the money.") --excuse for need to restart the dialog
294			Npc:says(_"Talk to me again in a moment.")
295			Bruce_helmet_sell = 20
296			hide("node41", "node42", "node43", "node44", "node45")
297			Npc:set_destination("Bruce-move-target-label")
298			end_dialog()
299		end,
300	},
301	{
302		id = "node43",
303		text = _"20 circuits? I'll sell it for... a hundred.",
304		topic = "Bruce wants Dixon's helmet",
305		code = function()
306			Npc:says(_"Well... okay.")
307			Npc:says(_"Let me get the money.") --excuse for need to restart the dialog
308			Npc:says(_"Come back to me after that.")
309			Bruce_helmet_sell = 100
310			hide("node41", "node42", "node43", "node44", "node45")
311			Npc:set_destination("Bruce-move-target-label")
312			end_dialog()
313		end,
314	},
315	{
316		id = "node44",
317		text = _"20 circuits? Do you think I'm stupid? I'll sell it for 1000!",
318		topic = "Bruce wants Dixon's helmet",
319		code = function()
320			Npc:says(_"That's way too expensive.")
321			Tux:says(_"Fine, I'll keep it then.")
322			Npc:says(_"You're the greediest penguin I've ever met.")
323			Npc:says(_"Forget about the deal!")
324			Bruce_helmet_sell = -1000
325			Bruce_wants_helmet = false
326			hide("node41", "node42", "node43", "node44", "node45")
327			pop_topic() -- "Bruce wants Dixon's helmet"
328		end,
329	},
330	{
331		id = "node45",
332		text = _"I'm sorry, but I'd like to keep it.",
333		topic = "Bruce wants Dixon's helmet",
334		code = function()
335			Npc:says(_"Bummer!")
336			Bruce_helmet_sell = -1000
337			Bruce_wants_helmet = false
338			hide("node40", "node41", "node42", "node43", "node44", "node45")
339			pop_topic() -- "Bruce wants Dixon's helmet"
340		end,
341	},
342	{
343		id = "node47",
344		text = _"No, it's alright. I have it.",
345		topic = "Lost Dixon's Helmet Y/N",
346		code = function()
347			Npc:says(_"OK, so please fetch it and bring it to me.")
348			hide("node47", "node48")
349			end_dialog()
350		end,
351	},
352	{
353		id = "node48",
354		text = _"I lost it.",
355		topic = "Lost Dixon's Helmet Y/N",
356		code = function()
357			Npc:says(_"That's too sad!")
358			Npc:says(_"So, please leave. I want to take a rest.")
359			Bruce_Dixons_helmet_lost = true
360			Bruce_wants_helmet = false
361			hide("node40", "node41", "node42", "node43", "node44", "node45", "node47", "node48", "node49")
362			end_dialog()
363		end,
364	},
365	{
366		id = "node49",
367		text = _"I'll think about that, but right now let's talk about something else.",
368		topic = "Bruce wants Dixon's helmet",
369		code = function()
370			Npc:says(_"OK, but please don't forget the helmet deal!")
371			show("node29")
372			pop_topic() -- "Bruce wants Dixon's helmet"
373		end,
374	},
375	{
376		id = "node99",
377		text = _"I'll be going then.",
378		code = function()
379			if (Bruce_hurt) then
380				Npc:says(_". . .")
381			elseif (Bruce_wants_helmet) then
382				Npc:says(_"Hang tight, I'll be right back for that helmet!")
383			else
384				Npc:says(_"Good. I need sleep.")
385			end
386			end_dialog()
387		end,
388	},
389}
390