Debian Codegraph @

data/storyline/act1/dialogs/Samson.lua

raw
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
20 PERSONALITY = { "Brilliant", "Smart", "Composed", "Friendly" },
21 MARKERS = { NPCID1 = "Mr. Saves", NPCID2 = "Sorenson"},
22 PURPOSE = "$$NAME$$ teaches Tux programming, but only if Tux have prior knowledge on it. In future he will also give player a quest to unlock sensor-changing on droids.",
23 BACKSTORY = "$$NAME$$ worked with $$NPCID1$$ at Nicholson Inc., where $$NAME$$ did the coding and $$NPCID1$$ came with crazy ideas. $$NPCID1$$ left mysteriously shortly before the Great Assault and haven't been seen since then. $$NAME$$ was then transferred to droid security division, but before assuming the job the droids went crazy. Because that, he wasn't able to patch the security fixes on the 615 droids. $$NAME$$ was also in charge to finish sensor system with $$NPCID1$$, but because the disappearance from the former one, it was never finished. He will also notice the programming knowledge Tux might have acquired from $$NPCID2$$."
24 WIKI]]--
25
26 local Npc = FDrpg.get_npc()
27 local Tux = FDrpg.get_tux()
28
29 return {
30 FirstTime = function()
31 show("node0")
32 Sam_boredom=0
33 end,
34
35 EveryTime = function()
36 Sam_boredom=Sam_boredom + 1
37
38 if (Sam_boredom == 3) then
39 Npc:says(_"I'm bored. Hey, do you want to take a challenge?")
40 show("expertise_intro")
41 end
42 end,
43
44 {
45 id = "node0",
46 text = _"Hi! I'm new here. ",
47 code = function()
48 Npc:says(_"Hello, I am Samson, the Coder. Pleased to meet you.")
49 Npc:says(_"I used to work on Nicholson, Inc. and was supposed to take over security for the 615 project two days after the Great Assault happened. Oh well.")
50 Npc:set_name("Samson, the Coder")
51 hide("node0") show("node1", "training_main")
52 end,
53 },
54
55 {
56 id = "node1",
57 text = _"You used to work at Nicholson, Inc.? How was it there?",
58 code = function()
59 Npc:says(_"Well, it was fun. I got to test a lot of new ideas. There was a man who always came up with crazy ideas, I can't recall his name. Making them reality was my task. It was fun, but time-consuming.")
60 Npc:says(_"About three months before the Great Assault happened, that man vanished. There were no signs of where he could have gone.")
61 Npc:says(_"We were doing a \"sensor\" system. He said that MegaSys command droids used those gadgets to detect invisible things, and if we could replicate, our security droids would be almost invincible.")
62 Npc:says(_"Because of his disappearance, we never finished that. I was thinking though, maybe if someone got me his work, I could finish it, and add those so-called \"sensors\" on the droids you hack...")
63 Npc:says(_"...sorry, I'm just rambling. Please forget everything I've said.") -- Quest is NYI as well as changing sensors via Lua.
64 hide("node1")
65 end,
66 },
67 {
68 id = "shop",
69 text = _"Yes, I would like to trade with you.",
70 code = function()
71 Npc:says_random(_"Yes, please feel free to.",
72 _"I only have some consumables with me.",
73 _"That's all I can do for you now.")
74 trade_with("Samson")
75 end,
76 },
77
78
79 {
80 id = "training_main",
81 text = _"You're a coder. Could you, maybe, teach me programming?",
82 code = function()
83 if (Tux:get_skill("programming") == 0) then
84 Npc:says(_"No, sorry, I cannot.", "NO_WAIT")
85 Npc:says(_"You see, even while I am on vacations right now, I can think on more interesting things to do other than teaching the basics to some overgrown penguin.")
86 Npc:says(_"Maybe if you knew some programming, we could talk...")
87 elseif (Tux:get_skill("programming") == 1) then
88 Npc:says(_"Well, why not? It could be fun.", "NO_WAIT")
89 Npc:says(_"But hey, it's no easy task.")
90 Npc:says(_"For so, I expect you to bring me some money, to be ready of mind, and then you may be my apprentice.")
91 Npc:says(_"Interested?")
92 hide("training_main") show("apprentice")
93 elseif (Tux:get_skill("programming") == 2) then
94 Npc:says(_"Oh, so you want more. I guess you're using a lot of skills, then?", "NO_WAIT")
95 Npc:says(_"Well, sorry to inform, it's not so easy. You'll require much more than just money and training. I want to see your efforts.")
96 Npc:says(_"Interested?")
97 hide("training_main") show("professional")
98 elseif (Tux:get_skill("programming") == 3) then
99 Npc:says(_"Oh, you want to become an expert when doing programs?", "NO_WAIT")
100 Npc:says(_"Then you'll need to bring me, besides the usual, something which shows you're an expert at coding.")
101 Tux:says(_"How can I show you a proof that I am an expert if I want to become an expert in first place?")
102 Npc:says(_"Do not get it wrong, linarian. I want to ensure you know various programming languages and such. What I will teach you, is how to fully use the potential you already have.")
103 Npc:says(_"This will be my last lesson. And the hardest one. Are you interested?")
104 hide("training_main") show("expert")
105 else
106 if (Sorenson:is_dead()) then
107 Npc:says(_"Sorry, there is no human alive that could give you further training. Maybe Sorenson could, but I'm afraid she's dead.")
108 else
109 Npc:says(_"Sorry, there is no human alive that could give you further training.") -- Is Sorenson still human?
110 end
111 Npc:says(_"Maybe I could sell you some consumables to help?")
112 hide("training_main") show("shop")
113 end
114 end,
115 },
116 {
117 id = "apprentice",
118 text = _"Make me your apprentice in programming. (costs 100 circuits, 9 training points)",
119 echo_text = false,
120 code = function()
121 Tux:says(_"Yes, please make me your apprentice in programming.")
122 cost = 100
123 if Tux:train_skill(cost, 9, "programming") then
124 Npc:says(_"Okay, class number 1: A program done entirely on a single language will most likely bring you headache.")
125 Npc:says(_"You should learn early to diverse your program languages if that makes your life easier. Specially when working with teams.")
126 Npc:says(_"For example, see this game done by Arthur, a friend of mine.", "NO_WAIT")
127 Npc:says(_"The mechanics are on specific language and dialogs are on Lua.")
128 Npc:says(_"Lua is a very simple programming language. In fact, you do not need to be a programmer to use basic Lua.")
129 Npc:says(_"This way, you can have a programmer team working on mechanics and a non-programmer team doing content.", "NO_WAIT")
130 Npc:says(_"Not only that, but it makes scripting much easier to read and work with.")
131 Npc:says(_"Good. You are learning quickly. Try splitting the languages on a few programs. Knowledge on multiple programming languages is power.")
132 Npc:says(_"Okay, I think that it is enough for today.")
133 hide("apprentice") show("training_main")
134 else
135 if (Tux:get_gold() < cost ) then next("no_money") else next("no_training") end
136 end
137 end,
138 },
139 {
140 id = "professional",
141 text = _"I want to do coding like a pro! (costs 150 circuits, 13 training points, 1x Peltier Element)",
142 echo_text = false,
143 code = function()
144 Tux:says(_"So let's start the second course?")
145 cost = 150
146
147 if Tux:has_item_backpack("Peltier element") then
148 if Tux:train_skill(cost, 13, "programming") then
149 Tux:del_item_backpack("Peltier element", 1)
150 Npc:says(_"Very well.")
151 Npc:says(_"I shall teach you how to use Git.", "NO_WAIT")
152 Npc:says(_"Programming is not only about coding. It's also about making your work efficient.")
153 Npc:says(_"With Git, you'll have much fewer problems with backups and code mistakes.")
154 Npc:says(_"Try it a little, and you'll be having fewer failures now.")
155 hide("professional") show("training_main")
156 else
157 if (Tux:get_gold() < cost ) then next("no_money") else next("no_training") end
158 end
159 else
160 Npc:says(_"Negative. Any true program's user will know to have Peltier Elements to avoid overheating!")
161 end
162 end,
163 },
164 {
165 id = "expert",
166 text = _"Teach me all you know about programming. (costs 200 circuits, 18 training points, 1x MS Stock Certificate)",
167 echo_text = false,
168 code = function()
169 Tux:says(_"So can you help me become even better with programs?")
170 cost = 200
171
172 if Tux:has_item_backpack("MS Stock Certificate") then
173 if Tux:train_skill(cost, 18, "programming") then
174 Npc:says(_"Oh my, according to this certificate, you made a company learn BASIC. Keep it, I cannot take it from you.", "NO_WAIT")
175 Npc:says(_"Of course it'll be my pleasure to teach you something more.")
176 if (Sorenson:is_dead()) then
177 Npc:says(_"You still haven't realized, but since we've first talked, I already sensed a great coder on you. I just try to help you to harness all your potential. So...")
178 end
179 Npc:says(_"For my next lesson, we will study and do a program together.")
180 Tux:says(_"How will that help?")
181 Npc:says(_"Only practice and study will lead you to the expertise you seek.", "NO_WAIT")
182 Npc:says(_"I'll be here to answer any questions you have. I hope the little I know be of help to you.")
183 hide("expert") show("training_main")
184 else
185 if (Tux:get_gold() < cost ) then next("no_money") else next("no_training") end
186 end
187 else
188 Npc:says(_"No proof, no training.")
189 end
190 end,
191 },
192 {
193 id = "no_money",
194 code = function()
195 Npc:says_random(_"You need more circuits.",
196 _"Please don't bother me if you can't pay me.",
197 _"Come back when you have enough circuits.",
198 _"So come back when you have something of value.")
199 end,
200 },
201 {
202 id = "no_training",
203 code = function()
204 Npc:says_random(_"You are not ready. Go kill some bots and come back.",
205 _"Come back when you are mentally prepared to learn.",
206 _"I don't think you have enough experience for this.",
207 _"Come back when you have a real will to learn.",
208 _"You don't have enough experience. Come here after you see some more action.")
209 end,
210 },
211
212
213 {
214 id = "expertise_intro",
215 text = _"A... challenge?",
216 code = function()
217 Npc:says(_"I call it \"The Expertise Challenge\". It's pretty simple actually, but easy? Definitely not.")
218 Npc:says(_"As you might have noticed, you have three improvements, or this is how I decided to call them: Melee, Ranged and Programming.")
219 Npc:says(_"Basically, you usually decide what you want to master at, and invest money, training points and sweat on them. But why not investing on all of them?!")
220 Npc:says(_"If you achieve the rank of [b]expert[/b] on the three of them, I will teach you a skill I warrant you won't learn it anywhere else.")
221 Npc:says(_"It will [b]increase the time you have to take over a bot[/b]. It will reconfigure your magnetic field to keep connection alive for longer - or something like that. It's not much though, be warned.")
222 Npc:says(_"Come talk to me when you're ready.")
223 hide("expertise_intro") show("expertise_repeat", "expertise_ready")
224 end,
225 },
226 {
227 id = "expertise_repeat",
228 text = _"Could you repeat about the Expertise Challenge?",
229 code = function()
230 next("expertise_intro")
231 end,
232 },
233 {
234 id = "expertise_ready",
235 text = _"I have completed the Expertise Challenge!",
236 code = function()
237 Npc:says(_"Oh, really? Let's see.")
238 local failed=false
239
240 if (Tux:get_skill("melee") < 4) then
241 Npc:says(_"You're no expert at melee.")
242 failed=true
243 end
244
245 if (Tux:get_skill("ranged") < 4) then
246 Npc:says(_"You're no expert at ranged.")
247 failed=true
248 end
249
250 if (Tux:get_skill("programming") < 4) then
251 Npc:says(_"You're no expert at programming.")
252 failed=true
253 end
254
255 if (failed) then
256 Npc:says(_"You must be an expert at the three areas of specialization to receive the reward. Sorry.")
257 else
258 Npc:says(_"Indeed, you're an expert at everything! Congratulations!")
259 Npc:says(_"Let me just upload on you the codes for the skill and you will be able to make slightly longer takeovers.")
260 Tux:improve_program("Animal Magnetism")
261 Tux:says(_"I feel... Great! Thanks, Sam! I can't wait to spend hours hacking the same bot!")
262 Npc:says(_"...I don't think that skill increases your take over for so much time...... Oh well. Have fun, linarian!")
263 hide("expertise_repeat", "expertise_ready", "expertise_intro")
264 end
265 end,
266 },
267 {
268 id = "node99",
269 enabled = true,
270 text = _"See you later.",
271 code = function()
272 Npc:says_random(_"Take care, Linarian.",
273 _"Safe travels, Linarian.",
274 _"Do not get caught by the 615, Linarian.",
275 _"If you have cool ideas, come tell me, Linarian.")
276 end_dialog()
277 end,
278 },
279 }