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 = { "Friendly", "Mentally Diminished" },
21MARKERS = { NPCID1 = "DocMoore" },
22PURPOSE = "$$NAME$$ is the village idiot, strong but dumb",
23BACKSTORY = "Just after The Great Assault, $$NAME$$ took all the strength pills
24	 present in the town to become the strongest man. Later, he received advertising
25	 for brain enlargement pills (from a automated spamming bot). Despite warnings,
26	 $$NAME$$ buys and consumes brain enlargement pills becoming sick.",
27RELATIONSHIP = {
28	{
29		actor = "$$NPCID1$$",
30		text = "$$NAME$$ is angry with $$NPCID1$$ for refusing to give the brain
31			 enlargement pill antidote."
32	},
33}
34WIKI]]--
35
36local Npc = FDrpg.get_npc()
37local Tux = FDrpg.get_tux()
38
39return {
40	FirstTime = function()
41		if (not HF_Spencer_teleported) then
42			Tux:says(_"Hello! I'm new here.")
43			Npc:says(_"Hey, man! I'm Bender, the dead man of this town. And you?")
44			Npc:set_name("Bender")
45			--; TRANSLATORS: %s = Tux:get_player_name()
46			Tux:says(_"I'm %s. I'm fine, thank you.", Tux:get_player_name(), "NO_WAIT")
47			show("node0")
48		else
49			Tux:says(_"Hello there!")
50			--; TRANSLATORS: %s = Tux:get_player_name()
51			Npc:says(_"Hey, you're the new guy! I mean penguin! Uh, %s, right?", Tux:get_player_name())
52			Tux:says(_"Yes, I-", NO_WAIT)
53			Npc:says(_"Holy wow! Wow, man!")
54			next("node60")
55		end
56	end,
57
58	EveryTime = function()
59		if (Tux:has_met("Bender")) then -- to avoid displaying 2 "hello"s etc when we talk to Bender for the first time
60			Tux:says(_"Hello!")
61			Npc:says(_"Hey, man!")
62			Tux:says(_"How are you doing?")
63			if (Tux:has_quest("Bender's problem")) then
64				if (not Tux:done_quest("Bender's problem")) then
65					if (HF_Spencer_teleported) then
66						if (not Bender_go_talk_to_doc) then
67							Npc:says(_"Man, it's the end of the apocalypse... And I feel fine!")
68							Npc:says(_"I mean, I still didn't get the medicine from the doc. I didn't get the chance to really pound him.")
69							Npc:says(_"But right now everyone's so happy that the bots are all down, I think I'll give him a break.")
70							Tux:says(_"Maybe you should talk to him soon. He might be in a good mood and give it to you anyway.")
71							Npc:says(_"Hey, that sounds like a smart idea! Thanks, man, I'll do that!")
72							Tux:update_quest("Bender's problem", _"Since the killer bots around the town got a taste of my firmware, I think the Doc won't mind giving Bender his medicine now... I should talk to him when I see him.")
73							Bender_go_talk_to_doc = true
74							Npc:says(_"Now, I have something I want to say to you...")
75							Tux:says(_"And what's that?")
76							Npc:says(_"Holy wow! Wow, man!")
77							next("node60")
78						else
79							Npc:says(_"I still need to go talk to the doc, but just thinking about feeling less sick makes me feel less sick.")
80							Npc:says(_"It's confusing me a little...")
81							Tux:says(_"Well, hurry up and get it over with!")
82						end
83						hide("node1", "node2", "node3", "node4", "node5", "node6", "node7", "node8", "node9", "node10", "node50")
84					else
85						Npc:says(_"Too bad. I have never felt so sick.", "NO_WAIT")
86						Npc:says(_"Let me die, man!")
87						if (Tux:has_item_backpack("Brain Enlargement Pills Antidote")) then
88							hide("node11", "node12") show("node9")
89						else
90							hide("node9") show("node12")
91						end
92
93						hide("node1", "node2", "node3", "node4", "node5", "node6", "node7", "node8", "node10", "node11", "node50")
94					end
95				elseif (Bender_go_talk_to_doc) then
96					Npc:says(_"I still need to go talk to the doc, but just thinking about feeling less sick makes me feel less sick.")
97					Npc:says(_"It's confusing me a little...")
98					Tux:says(_"Well, hurry up and get it over with!")
99				elseif (not tux_has_joined_guard) then
100					Npc:says(_"Much better. I'm cured. You're a good guy, man!", "NO_WAIT")
101					Npc:says(_"What was your name again?")
102					Tux:says(Tux:get_player_name())
103					--; TRANSLATORS: %s = Tux:get_player_name()
104					Npc:says(_"Thanks %s, I owe you one.", Tux:get_player_name(), "NO_WAIT")
105					Npc:says(_"And I'll sure vote for you, if you want into the Red Guard!")
106				elseif (not Bender_congrats) then
107					Npc:says(_"Much better. I'm cured. You're a good guy, man!", "NO_WAIT")
108					Npc:says(_"Congratulations on getting into the Red Guard!", "NO_WAIT")
109					Npc:says(_"I voted for you and that was what got you in!", "NO_WAIT")
110					if (not HF_Spencer_teleported) then
111						Npc:says(_"I said we'd be buddies, didn't I? Want to stand guard at the gate with me? It gets boring with just that 614 to talk to.")
112						Npc:says(_"I could tell you all the secrets of the Red Guard.")
113						show("node30") -- @TODO add another way to get this node post-firmware update
114					else
115						Npc:says(_"Oh, and congratulations on beating all the bots!")
116						Npc:says(_"I mean, wow...")
117						next("node60")
118					end
119					Bender_congrats = true
120				else
121					if (HF_Spencer_teleported) then
122						if (Bender_post_firmware_update) then
123							Npc:says(_"Man, it's the end of the apocalypse... And I feel fine!")
124						else
125							Npc:says(_"Oh man, this is so cool! Wow, man!")
126							next("node60")
127						end
128					else
129						Npc:says(_"Much better. I'm cured. You're a good guy, man!", "NO_WAIT")
130					end
131				end
132			elseif (not HF_Spencer_teleported) then
133				Npc:says(_"Too bad. I have never felt so sick.", "NO_WAIT")
134				Npc:says(_"Let me die, man!")
135
136				if (refused_to_help_bender) then
137					show("node8")
138				end
139			else
140				if (Bender_post_firmware_update) then
141					Npc:says(_"Man, it's the end of the apocalypse... And I feel fine!")
142				else
143					Npc:says(_"I'm good! Man, a few days ago I was feeling really down... I was really sick.")
144					Npc:says(_"But now I stopped feeling not-awesome! And it's all thanks to you and all the bots being dead!")
145					Npc:says(_"Maybe it's also because I pummelled the doc until he gave me some pills.")
146					Tux:says("...")
147					Npc:says(_"But I'm really sure it's also because all the bots are gone.")
148					Npc:says(_"I mean, look around!")
149					next("node60")
150				end
151				-- we hide any nodes that might lead to the player getting Bender's quest after this
152				hide("node0", "node1", "node2", "node3", "node4", "node5", "node6", "node7", "node8", "node10", "node11", "node50")
153				pop_topic("Sick Bender")
154			end
155		end
156
157		if (Bender_gave_elbow_grease) then
158			hide("node40")
159		elseif (Bender_elbow_grease or Tux:has_item_backpack("Manual of the Automated Factory")) then
160			show("node40")
161		end
162
163		if (Bender_at_Spencer) then
164			Bender_at_Spencer = false
165			Npc:set_destination("BenderStartGameSquare")
166		end
167		show("node99")
168	end,
169
170	{
171		id = "node0",
172		text = _"What's wrong? You seem to be in pretty good shape for a dead man.",
173		code = function()
174			Npc:says(_"Yeah. I'm the strongest man in all the world. That's 'cause I took ALL of the strength pills.")
175			Npc:says(_"And yet, I might be dead soon. The doc warned me, but I didn't listen. GRAH!")
176			Npc:set_name("Bender - The strongest one")
177			show("node1", "node2")
178			push_topic("Sick Bender")
179		end,
180	},
181	{
182		id = "node1",
183		text = _"You took too many strength pills and now you're sick?",
184		topic = "Sick Bender",
185		code = function()
186			Npc:says(_"Nah. The strength pills were fine. They made me strong. The doc said so.")
187			Npc:says(_"It was the brain enlargement pills. They did me no good, man.")
188			hide("node1", "node2") show("node3", "node10")
189		end,
190	},
191	{
192		id = "node2",
193		text = _"What made you so sick?",
194		topic = "Sick Bender",
195		code = function()
196			Npc:says(_"It was the brain enlargement pills. They did me no good, man.")
197			hide("node1", "node2") show("node3", "node10")
198		end,
199	},
200	{
201		id = "node3",
202		text = _"Brain enlargement pills? Sounds ridiculous!",
203		topic = "Sick Bender",
204		code = function()
205			Npc:says(_"You know man, I got those offers everybody gets.")
206			Npc:says(_"They offer some brain enlargement pills to enhance brain performance.")
207			Npc:says(_"'Enlarg3 your brain! Bu.y pi11s! Che4p!!11!!!'")
208			Npc:says(_"And everybody in the town said I was dumb, which by the way IS NOT TRUE.")
209			Npc:says(_"So I thought these pills might make them think differently about me.")
210			hide("node3") show("node4", "node5")
211		end,
212	},
213	{
214		id = "node4",
215		text = _"But if you aren't dumb, why the brain enlargement pills?",
216		topic = "Sick Bender",
217		code = function()
218			Npc:says(_"Because they said I was dumb. So I had to do something about it, eh?")
219			hide("node4")
220		end,
221	},
222	{
223		id = "node5",
224		text = _"Isn't there some doctor in town who could cure you?",
225		topic = "Sick Bender",
226		code = function()
227			Npc:says(_"Yeah, the doc could help. But he won't. I've threatened him, but he won't.")
228			Npc:says(_"He's so angry cause I didn't listen. He warned me about the brain enlargement pill offers.")
229			Npc:says(_"They can cause some awful forms of cancer. But I didn't listen. And now he refuses to help me, man.")
230			hide("node5") show("node6", "node7")
231		end,
232	},
233	{
234		id = "node6",
235		text = _"Maybe I can help you somehow?",
236		topic = "Sick Bender",
237		code = function()
238			Npc:says(_"Man, if you could do that, I'd give you everything. I still got some of those strength pills left.")
239			if (not tux_has_joined_guard) then
240				Npc:says(_"Also, I could vote for you if you seek to join the guard of the town.")
241			end
242			Npc:says(_"Just get me a cure, and I'll be forever grateful!")
243			Tux:add_quest("Bender's problem", _"I met a Red Guardsman named Bender. He poisoned himself with some brain enlargement pills, which turned out to be highly carcinogenic. The town doctor will not give him the antidote, so it is up to me to save him.")
244			refused_to_help_Bender = false
245			hide("node0", "node6", "node7", "node8") show("node11")
246			pop_topic()
247		end,
248	},
249	{
250		id = "node7",
251		text = _"I'm sorry, but it looks like there's nothing I could do for you.",
252		topic = "Sick Bender",
253		code = function()
254			Npc:says(_"Of course not. You're not a doctor. Only the doctor has the right medicine.")
255			Npc:says(_"But this rat would rather let me die!")
256			Npc:says(_"I'll rip his guts out as soon as I get my hands on him, man!")
257			refused_to_help_Bender = true
258			hide("node0")
259			pop_topic()
260		end,
261	},
262	{
263		id = "node8",
264		text = _"Have you found a way to cure yourself?",
265		code = function()
266			Npc:says(_"No, the doc still refuses. I've tried to fetch the medicine by force with little luck.")
267			Npc:says(_"No matter how hard I shake him, the rat has never accepted. He's so angry 'cause I didn't listen.")
268			Npc:says(_"Nobody else has the right medicine. I need a way to get it from him!")
269			hide("node8")
270			push_topic("Sick Bender")
271		end,
272	},
273	{
274		id = "node9",
275		text = _"I've got your medicine. With best wishes from the doctor.",
276		code = function()
277			Npc:says(_"Wow, you really did it! I guess you beat the hell out of him.")
278			Npc:says(_"He wouldn't help me even after I pounded him a bit. A big bit.")
279			Npc:says(_"Man, you are the greatest hero!")
280			if (not tux_has_joined_guard) then
281				Npc:says(_"Here, take this as a reward - and you can be sure that I'll vote for you if you seek membership in the Red Guard!")
282			else
283				Npc:says(_"Here, take this as a reward.")
284			end
285			Npc:says(_"Thanks, man!")
286			change_obstacle_state("TownDocBackdoor", "opened") -- Allows Bender to do something useful instead of just keeping watch outside the Docs after healed.
287			Tux:add_xp(150)
288			Tux:del_item_backpack("Brain Enlargement Pills Antidote", 1)
289			Tux:add_item("Strength Pill", 2)
290			Tux:end_quest("Bender's problem", _"Bender is fine now. He gave me some muscle enlargement pills in return for my help. Hmm...")
291			Npc:set_destination("NewSpencer")
292			Bender_at_Spencer = true --have Bender go "talk" to Spencer
293			hide("node9", "node10", "node50") show("node20")
294		end,
295	},
296	{
297		id = "node10",
298		text = _"Maybe taking the brain enlargement pills really was stupid.",
299		topic = "Sick Bender",
300		code = function()
301			Npc:says(_"WHAT? Did you just say I'm stupid?")
302			Npc:says(_"Don't say it, man.")
303			Npc:says(_"I can kill you so much, that no one will recognize you!")
304			hide("node10") show("node50")
305		end,
306	},
307	{
308		id = "node11",
309		text = _"Where can I find this doctor?",
310		code = function()
311			Npc:says(_"He's right inside this building. I'm waiting here for him, man.")
312			Npc:says(_"When he comes out, maybe I can pound him some more. Maybe then he'll help me at last!")
313			Npc:says(_"Yes, he'll get a good beating. That will make him reconsider! That rat!")
314			hide("node11")
315		end,
316	},
317	{
318		id = "node12",
319		text = _"About that medicine that you need...",
320		code = function()
321			Npc:says(_"Did you get it?")
322			Npc:says(_"What? You didn't get it?")
323			Npc:says(_"Man, what are you doing here? Get the medicine! I need it now!")
324			hide("node12")
325		end,
326	},
327	{
328		id = "node20",
329		text = _"Did you take all the Brain Enlargement Pills?",
330		code = function()
331			Npc:says(_"No. I have one left.")
332			Npc:says(_"Here, take it. I don't want it.")
333			Tux:add_item("Brain Enlargement Pill", 1)
334			hide("node20")
335		end,
336	},
337	{
338		id = "node30",
339		text = _"What secrets? Like a secret handshake?",
340		code = function()
341			Npc:says(_"Nah. But that is a totally awesome idea.")
342			Npc:says(_"Let's work it out -- just, uh, be sure not to let the Doc in on it.")
343			hide("node30") show("node31")
344		end,
345	},
346	{
347		id = "node31",
348		text = _"Do you actually know any *real* secrets?",
349		code = function()
350			Npc:says(_"Yeah, sure.")
351			Npc:says(_"I know the shop keeper Lily's password.")
352			Npc:says(_"I sometimes login to her account and mess with it for the LULZ.")
353			Npc:says(_"It's the end of the world as we know it, and I... am so incredibly bored.")
354			Tux:says(_"Erm... excuse me?")
355			Npc:says(_"Just a song my mother used to sing to me.")
356			hide("node31") show("node32", "node33")
357		end,
358	},
359	{
360		id = "node32",
361		text = _"Hey, could you tell me Lily's password?",
362		code = function()
363			Npc:says(_"Sure, but we will have to shake on it.")
364			Tux:says(_"OK...")
365			Npc:says(_"It is an asterisk repeated four times.")
366			know_lily_password = true
367			Tux:says(_"Wow.")
368			Npc:says(_"I am the most awesome hacker ever.")
369			Tux:says(_"Sure...")
370			hide("node32")
371		end,
372	},
373	{
374		id = "node33",
375		text = _"What are you doing now?",
376		code = function()
377			Npc:says(_"I'm killing time. Guard work is very boring.")
378		end,
379	},
380	{
381		id = "node40",
382		text = _"Can you spare some elbow grease?",
383		code = function()
384			Npc:says(_"Yes, you are talking to the right guy, man.")
385			if (not Tux:done_quest("Bender's problem")) then
386				Npc:says(_"But now, I'm no good. I can't make you any elbow grease, sorry man.")
387				Npc:says(_"Maybe if I was feeling better...")
388			else
389				Npc:says(_"Elbow grease just takes a bit of hard work. I'm not a fan of hard work, so I keep a can with me at all times.")
390				Npc:says(_"But since you helped me out with the Doctor, I'll give it to you.")
391				Bender_gave_elbow_grease = true
392				Tux:add_item("Elbow Grease Can", 1)
393				Tux:says(_"Thanks man!")
394			end
395			hide("node40")
396		end,
397	},
398	{
399		id = "node50",
400		text = _"Yeah, it was a totally idiotic idea to take those pills.",
401		topic = "Sick Bender",
402		code = function()
403			Npc:says(_"What? I'm not an idiot! Understood?")
404			Npc:says(_"No one says I'm stupid! I'm NOT STUPID!")
405			Npc:says(_"I'LL BEAT YOU TO SPLINTERS!")
406			Npc:says(_"I WILL KILL YOU SO HARD, YOU WILL DIE TO DEATH YOU FAT DUCK!")
407			npc_faction("crazy", _"Bender - Homicidal")
408			end_dialog()
409			hide("node50")
410		end,
411	},
412	{
413		id = "node60",
414		text = "BUG, REPORT ME! Bender node60 -- Post Firmware Update",
415		code = function()
416			Npc:says(_"Did you really just totally beat up all the bots in the world at once? Wow!")
417			Tux:says(_"Well, not all the bots in the world... And I didn't actually beat them all up...")
418			Npc:says(_"Oh, come on, man. We need this story. Don't do this.")
419			Tux:says(_"Uh, sorry? Do what?")
420			Npc:says(_"It doesn't matter what you did, dude. It matters what I think you did, and what I can tell others you did. You just beat up all the bots in the world.")
421			Tux:says(_"But it's only the ones that get their updates from this factory...")
422			Npc:says(_"And you did it with one hand tied behind your back! Or your wing, or flipper. You know, man.")
423			Bender_post_firmware_update = true
424			show("node61", "node62", "node63")
425		end,
426	},
427	{
428		id = "node61",
429		text = _"Well, I think I rather like that story.",
430		code = function()
431			Npc:says(_"Yeah, and you can bet everyone in town is gonna go crazy about it!")
432			Npc:says(_"I know I will, as soon as I get back I'll make a bet with Ewald about it.")
433			Npc:says(_"Everyone's been holed up in the town for so long, and I was really starting to run out of good stories to tell.")
434			hide("node61", "node62")
435		end,
436	},
437	{
438		id = "node62",
439		text = _"But that's not what happened!",
440		code = function()
441			Npc:says(_"Sure, not yet, because I didn't tell anyone about it yet.")
442			Tux:says(_"No, that didn't happen at all, and you saying it happened won't make it happen!")
443			Npc:says(_"But that's not what everyone will say after I tell them that's what happened.")
444			Tux:says(_"But... I... Arrrgh!")
445			Tux:heat(10)
446			Npc:says(_"Dude, it's not so hard to understand.")
447			Npc:says(_"Hey, you know, I saw an ad for brain enlargement pills that might do you good.")
448			Tux:says(_"No, I... I just need to cool off a bit...")
449			Npc:says(_"Oh, sure, ok. But I can fix you up with some if you change your mind. It's 100%% satisfaction guaranteed, cheap, AND free.")
450			hide("node62", "node61")
451		end,
452	},
453	{
454		id = "node63",
455		text = _"That was a nice entrance you made there.",
456		code = function()
457			Npc:says(_"Hey, thanks, dude. I'm still not so sure what happened.")
458			Npc:says(_"It all went really fast, Spencer just pulled me out of the pool and said to dry up and meet him at the teleporter.")
459			Npc:says(_"Then he just rushed off. He was really excited, he didn't even tell me off for cannonballing.")
460			Tux:says(_"So I guess that means you teleported in here.")
461			Npc:says(_"I guess we did! Wow, this was my first teleport! This makes it so much more awesome!")
462			hide("node63")
463		end,
464	},
465	{
466		id = "node99",
467		text = _"See you later.",
468		code = function()
469			if (not HF_Spencer_teleported) then
470				Npc:says_random(_"Later, man!",
471								_"Stay cool dude.")
472			else
473				Npc:says_random(_"Oh, ok, go beat up some more bots! Swish! Woosh! Ka-POW!",
474								_"See you, and thanks for the story!")
475			end
476			end_dialog()
477		end,
478	},
479}
480