Debian Codegraph @

data/storyline/act1/dialogs/Ewald.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 = { "Friendly", "Mentally Diminished" },
21 PURPOSE = "$$NAME$$ can play two gambling games in an attempt to improve Tux\'s finances. He gives some cooling drinks for free when Tux begs for it.",
22 BACKSTORY = "$$NAME$$ is a former drug addict who now runs the town bar. His brain is damaged heavily because of drug Use. Now he always smiles.",
23 WIKI]]--
24
25 local Npc = FDrpg.get_npc()
26 local Tux = FDrpg.get_tux()
27
28 return {
29 FirstTime = function()
30 Npc:says(_"Welcome to this Bar! First time here, eh? Here, take this Mug for FREE!")
31 Npc:says(_"You are required to bring it any time you want something to drink! Don't lose it, or you'll need to buy a new one!")
32 Tux:add_item("Mug", 1)
33 show("node0", "node3")
34 end,
35
36 EveryTime = function()
37 if (Tania_at_Ewalds_Bar) and
38 (not Ewald_got_told_Tanias_story) then
39 Ewald_got_told_Tanias_story = true
40 Npc:says(_"Your lady friend just told me the epic story of how you rescued her.")
41 Npc:says(_"That was really something.")
42 Npc:says(_"I'd give you a drink on the house, but unfortunately I'm still out.")
43 end
44
45 if (drank_all_Ewald_had) then
46 show("node14")
47 end
48
49 if (Ewald_gambling) then
50 show("node30")
51 end
52
53 show("node99")
54 end,
55
56 {
57 id = "node0",
58 text = _"Hi. You look really happy.",
59 code = function()
60 Npc:says(_"Hey! I'm Ewald. I'm a bartender.")
61 Npc:says(_"I used to do a lot of drugs, and I destroyed my brain.")
62 Npc:says(_"I'm not too smart now, but I'm very happy all the time!")
63 Npc:says(_"Want something to drink?")
64 Npc:set_name("Ewald - Barkeeper")
65 hide("node0") show("node1", "node2", "node13")
66 end,
67 },
68 {
69 id = "node1",
70 text = _"How is your business doing?",
71 code = function()
72 if (guard_follow_tux) then
73 Npc:says(_"Can't complain at the moment...")
74 else
75 Npc:says(_"Nah, no darn good at all.")
76 Npc:says(_"The bots ruined it for me. Now the supplies are very low and I had to make the prices high.")
77 Npc:says(_"No one wants to pay 499 circs for bottom shelf swill that even Bender would not drink...")
78 Npc:says(_"The tax is quite brutal as well. And the Red Guard always demands discounts too.")
79 Npc:says(_"Life is tough. I am still happy though.")
80 hide("node1")
81 end
82 end,
83 },
84 {
85 id = "node2",
86 text = _"Are you selling something other than drinks?",
87 code = function()
88 Npc:says(_"Yeah, I have some junk here... Want to see?")
89 trade_with("Ewald")
90 end,
91 },
92 {
93 id = "node3",
94 text = _"I could use a drink. What is there to be had?",
95 code = function()
96 Npc:says(_"Well... We are a bit short on supplies right now... Erm... AH! I know!")
97 Npc:says(_"I have WATER!")
98 if (not Tux:has_item_backpack("Mug")) and
99 (not Tux:has_item_backpack("Cup")) then
100 Npc:says(_"But you'll need a mug or a cup for me to put it in.")
101 else
102 hide("node3") show("node4", "node5", "node6")
103 end
104 end,
105 },
106 {
107 id = "node4",
108 text = _"I want double water on the rocks. Stirred, not shaken.",
109 code = function()
110 Npc:says(_"Here you go. That one is on the house. And if the water is not enough, just ask me for more.")
111 Tux:heat(-20)
112 hide("node4", "node5", "node6") show("node9")
113 end,
114 },
115 {
116 id = "node5",
117 text = _"Long Island iced water please.",
118 code = function()
119 Npc:says(_"Here you go.")
120 Tux:heat(-30)
121 hide("node4", "node5", "node6") show("node8")
122 end,
123 },
124 {
125 id = "node6",
126 text = _"I want something cheap... Give me some fortified water.",
127 code = function()
128 Npc:says(_"Eh... Sure, as you wish. Here you go.")
129 Tux:heat(-50)
130 hide("node4", "node5", "node6") show("node7")
131 end,
132 },
133 {
134 id = "node7",
135 text = _"Ugh... Ahh... I like it. Give me some more of that.",
136 code = function()
137 Npc:says(_"Uh... Sure...")
138 Tux:heat(-1000)
139 hide("node7") show("node10")
140 end,
141 },
142 {
143 id = "node8",
144 text = _"Ahh... Fresh water! Give me some more of that.",
145 code = function()
146 Npc:says(_"Yeah, I thought you would like it. Here is more.")
147 Tux:heat(-1000)
148 hide("node8") show("node10")
149 end,
150 },
151 {
152 id = "node9",
153 text = _"Hmm... Lots of ice. Give me one more double water, but now without any ice.",
154 code = function()
155 Npc:says(_"One double water coming up.")
156 Tux:heat(-1000)
157 hide("node9") show("node10")
158 end,
159 },
160 {
161 id = "node10",
162 text = _"MORE! I want more water!",
163 code = function()
164 Npc:says(_"Erm... Ok... Here, have some of my special, water colada.")
165 Tux:heat(-1000)
166 hide("node10") show("node11")
167 end,
168 },
169 {
170 id = "node11",
171 text = _"I am really thirsty! I want water.",
172 code = function()
173 Npc:says(_"Well, you drank all my water, so you cannot have any more. There is none left.")
174 Npc:says(_"I heard Linarians can drink a lot of water, but seven liters...")
175 hide("node11") show("node12")
176 end,
177 },
178 {
179 id = "node12",
180 text = _"MORE! MORE! MORE! I WANT MORE WATER. NOW!",
181 code = function()
182 Npc:says(_"Eh... I think you've had enough... Maybe you should just go for a walk for now?")
183 Npc:says(_"You have had everything that I had.")
184 drank_all_Ewald_had = true
185 hide("node12")
186 end,
187 },
188 {
189 id = "node13",
190 text = _"Any idea where I can find some entertainment here?",
191 code = function()
192 if (tux_has_joined_guard) then
193 Npc:says(_"I thought that shooting bots with those big guns was fun...?")
194 Npc:says(_"*sigh*")
195 Npc:says(_"I wish I could once use such a gun.")
196 Npc:says(_"You are a Guard member, right?")
197 if (Tux:has_item("Barrett M82 Sniper Rifle") or
198 Tux:has_item("The Super Exterminator!!!") or
199 Tux:has_item("Exterminator")) then
200 Tux:says(_"Yes, I am a Guard member. No, it is not allowed to give guns to people who are high.")
201 Npc:says(_"Pleeeeaaaase.")
202 Tux:says(_"No exceptions. I apologize. Please think responsibly; there is a good reason for this rule.")
203 Npc:says(_"Hmm. You're right, I better ask again later.")
204 Npc:says(_"Well, since you won't let me play with your big guns, we could always try a gambling game or two.")
205 else
206 Tux:says(_"The fact that I am a Red Guard member does not necessarily mean that I have a big gun with me.")
207 Npc:says(_"Really?")
208 Npc:says(_"Stop kidding me. I know you have big a gun somewhere.")
209 Npc:says(_"Every Guard has one.")
210 Tux:says(_"Look at me! Do you see any gun here at my belt or in my hands?")
211 Npc:says(_"Hmm... You are right. No gun, indeed.")
212 Npc:says(_"Sorry.")
213 Npc:says(_"Since there are no big guns to shoot, how about shooting some dice? Would you like to gamble?")
214 end
215 else
216 Npc:says(_"Well... Erm... No.")
217 Npc:says(_"What the bots did not smash, the Red Guard taxed.")
218 Npc:says(_"Fun is kinda dead right now.")
219 Npc:says(_"Well, unless you are in the Red Guard itself, of course. They have those big guns that can destroy a dozen bots with one shot...")
220 Npc:says(_"Now THAT'S fun, if you ask me.")
221 Npc:says(_"If you are really bored, you can try gambling with me.")
222 end
223 hide("node13") show("node30")
224 end,
225 },
226 {
227 id = "node14",
228 text = _"Hey, I could use a refreshing drink!",
229 code = function()
230 if (not Tux:has_item_backpack("Mug")) and
231 (not Tux:has_item_backpack("Cup")) then
232 Npc:says(_"You'll need a mug or a cup for me to put it in.")
233 else
234 Npc:says(_"Here, have a Watery Mary.")
235 Tux:heat(-1000)
236 hide("node14")
237 end
238 end,
239 },
240 {
241 id = "node30",
242 text = _"Ok, let's gamble a bit.",
243 code = function()
244 Ewald_gambling = true
245 Npc:says(_"I play a dice game and a coin-flipping game.")
246
247 -- Initialize some variables here
248 next_gamble_node = 0
249 bet, next_bet, total_bet = 0, 0, 0
250 tux1, tux2, tux3 = 0, 0, 0
251 ewd1, ewd2, ewd3, ewd4, ewd5 = 0, 0, 0, 0, 0
252
253 hide("node30") show("node31", "node32", "node33", "node34", "node69")
254 push_topic("Gambling")
255 end,
256 },
257 {
258 id = "node31",
259 text = _"Tell me the rules for your 'dice game'.",
260 topic = "Gambling",
261 code = function()
262 Npc:says(_"It is simple. We both get three six sided dice.")
263 Npc:says(_"You bet. Then you throw one die.")
264 Npc:says(_"Then you decide on a betting multiplier, up to 3x.")
265 Npc:says(_"Then you throw two more dice and I throw three dice. If the sum of your three dice is better than my three dice, you win twice your bet, minus a tax for the Red Guard.")
266 Npc:says(_"Remember: the odds are slightly against you, so don't gamble anything you can't afford to lose.")
267 ------------------------------------------------
268 -- Assuming optimal playing then
269 -- Expected payout: 103,5 % (easy), 98.27% (normal), 95.61% (hard)
270 end,
271 },
272 {
273 id = "node32",
274 text = _"Tell me the rules for your 'coin-flip game'.",
275 topic = "Gambling",
276 code = function()
277 Npc:says(_"It is simple. Five coin flips.")
278 Npc:says(_"You bet. Then you tell me if I will flip more 'heads' or 'tails'.")
279 Npc:says(_"I flip one coin.")
280 Npc:says(_"Then you tell me if there will be an 'odd' or 'even' number of flips for what you chose.")
281 if (difficulty() == "easy") then
282 Npc:says(_"I flip the other four coins. If you were completely right, I give you twice what you bet, if wrong, you get your bet back.")
283 elseif (difficulty() == "normal") then
284 Npc:says(_"I flip the other four coins. If you were completely right, I give you twice what you bet, if completely wrong, you get 3/4 of your bet back.")
285 else
286 Npc:says(_"I flip the other four coins. If you were completely right, I give you twice what you bet, if completely wrong, you get half of your bet back.")
287 end
288 Npc:says(_"But if you are only partially wrong... well, then you get nothing.")
289 Npc:says(_"Remember: the odds are slightly against you, so don't gamble anything you can't afford to lose.")
290 ------------------------------------------------
291 -- Assuming optimal playing:
292 -- Winning both: 11/32 expected payout: 88/128 (easy/normal/hard)
293 -- Losing both: 11/32 expected payout: 44/128 (easy), 33/128 (normal), 22/128 (hard)
294 -- Intermediate: 10/32 expected payout: 0/128 (easy/normal/hard)
295 -- Expected payout: 132/128 = 103.1% (easy), 121/128 = 94.5% (normal), 110/128 = 85.9% (hard)
296 end,
297 },
298 {
299 id = "node33",
300 text = _"Let's go for a game of dice.",
301 topic = "Gambling",
302 code = function()
303 next_gamble_node = 40
304 hide("node31", "node32", "node33", "node34") next("node35")
305 end,
306 },
307 {
308 id = "node34",
309 text = _"I want to play coin-flipping.",
310 topic = "Gambling",
311 code = function()
312 next_gamble_node = 50
313 hide("node31", "node32", "node33", "node34") next("node35")
314 end,
315 },
316 {
317 id = "node35",
318 topic = "Gambling",
319 code = function()
320 -- Ewald forces you to gamble semi-responsibly ;-)
321 max = Tux:get_gold()
322
323 if (max > 40) then
324 show("node36")
325 for k,v in pairs({[37] = 120, [38] = 400, [39] = 1200}) do
326 if (max > v) then
327 show("node" .. k)
328 end
329 end
330 Npc:says(_"Then, how many are you going to bet?")
331 else
332 Npc:says(_"You should come back when you have more to gamble with.")
333 pop_topic()
334 end
335 end,
336 },
337 {
338 id = "node36",
339 text = _"How about a bet of 10 circuits?",
340 topic = "Gambling",
341 code = function()
342 bet, next_bet = 10, 10
343 hide("node36", "node37", "node38", "node39", "node69") next("node" .. next_gamble_node)
344 end,
345 },
346 {
347 id = "node37",
348 text = _"I'm feeling a bet of 30 circuits.",
349 topic = "Gambling",
350 code = function()
351 bet, next_bet = 30, 30
352 hide("node36", "node37", "node38", "node39", "node69") next("node" .. next_gamble_node)
353 end,
354 },
355 {
356 id = "node38",
357 text = _"I will place a bet of 100 circuits.",
358 topic = "Gambling",
359 code = function()
360 bet, next_bet = 100, 100
361 hide("node36", "node37", "node38", "node39", "node69") next("node" .. next_gamble_node)
362 end,
363 },
364 {
365 id = "node39",
366 text = _"I want to bet 300 circuits.",
367 topic = "Gambling",
368 code = function()
369 bet, next_bet = 300, 300
370 hide("node36", "node37", "node38", "node39", "node69") next("node" .. next_gamble_node)
371 end,
372 },
373 {
374 id = "node40",
375 code = function()
376 Npc:says(_"Dice it is. Roll your first die.")
377 tux1=math.random(1,6)
378 Tux:says(_"I rolled a %d.", tux1)
379 Npc:says(_"What multiplier are you going to bet?")
380 show("node41", "node42", "node43")
381 end,
382 },
383 {
384 id = "node41",
385 text = _"1x",
386 topic = "Gambling",
387 code = function()
388 next("node44")
389 end,
390 },
391 {
392 id = "node42",
393 text = _"2x",
394 topic = "Gambling",
395 code = function()
396 bet=bet*2
397 next("node44")
398 end,
399 },
400 {
401 id = "node43",
402 text = _"3x",
403 topic = "Gambling",
404 code = function()
405 bet=bet*3
406 next("node44")
407 end,
408 },
409 {
410 -- finish game here
411 id = "node44",
412 code = function()
413 Npc:says(_"You've bet %d valuable circuits.", bet)
414 ewd1,ewd2,ewd3 = math.random(1,6),math.random(1,6),math.random(1,6)
415 Npc:says(_"My rolls are %d, %d and %d.", ewd1, ewd2, ewd3)
416 tux2,tux3 = math.random(1,6),math.random(1,6)
417 Tux:says(_"I rolled a %d and a %d.", tux2, tux3)
418
419 Npc:says(_"It looks like I scored %d and you scored %d.", ewd1 + ewd2 + ewd3, tux1 + tux2 + tux3)
420
421 if ((ewd1+ewd2+ewd3) < (tux1+tux2+tux3)) then --Tux wins!
422 Npc:says_random(_"You won! Good job.",
423 _"You won! Man you are lucky!",
424 _"You won!")
425 local bet_gain = {easy = 0.95, normal = 0.85, hard = 0.8}
426 bet = math.floor(bet * bet_gain[difficulty()])
427 Tux:add_gold(bet)
428 total_bet = total_bet + bet
429 --; TRANSLATORS: %d = amount of valuable circuits
430 display_console_message(string.format(_"You won %d valuable circuits by gambling dice with Ewald.", bet))
431 else -- House Wins!
432 Npc:says_random(_"You lost. Bad luck.",
433 _"You lost. Better luck next time.",
434 _"You lost, try again?",
435 _"You lost. Maybe you might like coin-flipping better?")
436 Tux:del_gold(bet)
437 total_bet = total_bet - bet
438 --; TRANSLATORS: %d = amount of valuable circuits
439 display_console_message(string.format(_"You lost %d valuable circuits by gambling dice with Ewald.", bet))
440 end
441 hide("node41", "node42", "node43") next("node60")
442 end,
443 },
444 {
445 id = "node50",
446 code = function()
447 -- Constant for the coin-flipping game
448 coin_str = {_"heads", _"tails"}
449
450 Npc:says(_"Coin flipping it is.")
451 Npc:says(_"So. What do you think? Heads or tails?")
452 show("node51", "node52")
453 end,
454 },
455 {
456 id = "node51",
457 text = _"Heads",
458 topic = "Gambling",
459 code = function()
460 Npc:says_random(_"Heads, eh? I always like heads.",
461 _"Heads? Sometimes I pick heads... when I don't pick tails.",
462 _"When I think too much about it, I end up picking heads.",
463 _"Just the other day I found out that 'obverse' was the fancy name for 'heads'. Trippy.",
464 _"I think I would have picked tails this time.")
465 tux1 = 0
466 hide("node51", "node52") next("node53")
467 end,
468 },
469 {
470 id = "node52",
471 text = _"Tails",
472 topic = "Gambling",
473 code = function()
474 Npc:says_random(_"Tails? Fits, since you've got one.",
475 _"Tails? I always liked that game... good times.",
476 _"Tails. When I don't pick heads, I always pick tails.",
477 _"Just the other day I found out that 'reverse' was the fancy name for 'tails'. Trippy.",
478 _"I think I would have picked heads this time.")
479 tux1 = 1
480 hide("node51", "node52") next("node53")
481 end,
482 },
483 {
484 id = "node53",
485 topic = "Gambling",
486 code = function()
487 Npc:says(_"Here goes nothing.")
488 ewd1=math.random(0,1)
489 Npc:says(_"Looks like it is '%s'.", coin_str[ewd1 + 1])
490
491 Npc:says(_"So do you think there will be an even or odd number of '%s' flips?", coin_str[tux1 + 1])
492
493 show("node54", "node55")
494 end,
495 },
496 {
497 id = "node54",
498 text = _"Even number",
499 topic = "Gambling",
500 code = function()
501 tux2 = 0 -- Set to 'even'
502
503 local random_says = {_"Even, eh? I always like even. It is so symmetric.",
504 _"Even? Sometimes I pick even... when I don't pick odd.",
505 _"When I think too much about it, I end up picking even.",
506 _"I think I would have picked even this time."}
507
508 if (ewd1 ~= tux1) then
509 table.insert(random_says, _"Hoping to guess them all wrong, eh?")
510 else
511 table.insert(random_says, _"Bucking the statistics. I like that.")
512 end
513
514 Npc:says_random(table.unpack(random_says))
515 hide("node54", "node55") next("node56")
516 end,
517 },
518 {
519 id = "node55",
520 text = _"Odd number",
521 topic = "Gambling",
522 code = function()
523 tux2 = 1 -- Set to 'odd'
524
525 local random_says = {_"Odd? Fits, since you're pretty odd yourself.",
526 _"Odd? Well that is odd... I was thinking of odd.",
527 _"Odd. When I don't pick even, I always pick odd, too.",
528 _"I think I would have picked even this time."}
529
530 if (ewd1 == tux1) then
531 table.insert(random_says, _"Honing up on your math, eh?")
532 else
533 table.insert(random_says, _"Betting against the game. I like that.")
534 end
535
536 Npc:says_random(table.unpack(random_says))
537 hide("node54", "node55") next("node56")
538 end,
539 },
540 {
541 id = "node56",
542 topic = "Gambling",
543 code = function()
544 local function flip_coin()
545 result = math.random(0, 1)
546 Npc:says(_"%s.", coin_str[result + 1]:gsub("%a", string.upper, 1))
547 return result
548 end
549
550 Npc:says(_"The last four coin flips:")
551 ewd2, ewd3, ewd4 = flip_coin(), flip_coin(), flip_coin()
552 Tux:says(_"Last flip. I hope it is the one I want!")
553 ewd5 = flip_coin()
554
555 ewald_sum = ewd1 + ewd2 + ewd3 + ewd4 + ewd5
556 Npc:says(_"Looks like that is %d tails, and %d heads.", ewald_sum, 5 - ewald_sum)
557
558 local win = 0 -- find if tux won...
559 if (ewald_sum > 2) then
560 Npc:says(_"Tails won...")
561 win = 0.5 * tux1
562 else
563 Npc:says(_"Heads won...")
564 win = 0.5 * (1 - tux1)
565 end
566
567 if (math.fmod(ewald_sum, 2) == tux1) then
568 Npc:says(_"...and there were an odd number of %s.", coin_str[tux1 + 1])
569 win = win + 0.5 * tux2
570 else
571 Npc:says(_"...and there were an even number of %s.", coin_str[tux1 + 1])
572 win = win + 0.5 * (1 - tux2)
573 end
574
575 if (win == 1) then -- WIN
576 Npc:says_random(_"Looks like another winning combination! Good job!",
577 _"You have the best luck! You won!",
578 _"Too many of these and I'll go out of business. You won!",
579 _"You will have to tell me how you did it. You Won!",
580 _"Let me be even with you: I can't make heads or tails of how you won this odd game. Good Job!")
581 display_console_message(string.format(_"You won %d valuable circuits in the coin-flip game with Ewald.", bet))
582 elseif (win == 0) then --LOSS
583 Npc:says_random(_"Looks like you got everything wrong... here is some of your bet back.",
584 _"Well, close, but exactly wrong. Here is some of your bet back.",
585 _"You need to do exactly opposite of what you did here. Here is part of your bet back.",
586 _"Close, but no cigar. Here is some of your money back.",
587 _"Next time pick the opposite of what you did this time... or something.",
588 _"Close only counts in hand grenades and horseshoes. But some money back.")
589
590 local bet_loss = {easy = 1, normal = 0.75, hard = 0.5} -- easy: 100% back normal: 75% back, hard: 50% back
591 bet = math.floor(bet * bet_loss[difficulty()])
592
593 display_console_message(string.format(_"You lost %d valuable circuits in the coin-flip game with Ewald.", bet))
594 elseif (win == 0.5) then -- COMPLETE LOSS (0% back)
595 Npc:says_random(_"You lost. You were half right, but half wrong. Pick one and stay with it.",
596 _"You lost. You were all messed up. Better luck next time.",
597 _"You lost. Maybe you should try something else for a while?",
598 _"You lost.",
599 _"You lost. You might try the dice game next time.")
600 bet = -bet
601
602 display_console_message(string.format(_"You lost %d valuable circuits in the coin-flip game with Ewald.", bet))
603 else -- ERROR:
604 Npc:says(_"THIS IS AN ERROR! REPORT IT PLEASE! E-MAIL: [email protected]")
605 end
606
607 if (not running_benchmark()) then -- dialog validator reports errors here sometimes when "bet" > gold we have
608 Tux:add_gold(bet)
609 end
610
611 total_bet = total_bet + bet
612
613 next("node60")
614 end,
615 },
616 {
617 id = "node60",
618 code = function()
619 -- Re Initialize variables here
620 tux1, tux2, tux3 = 0, 0, 0
621 ewd1, ewd2, ewd3, ewd4, ewd5 = 0, 0, 0, 0, 0
622
623 show("node61", "node62", "node63", "node64", "node69")
624 end,
625 },
626 {
627 id = "node61",
628 text = _"Let us start again with the same bet.",
629 topic = "Gambling",
630 code = function()
631 Npc:says(_"Sure.")
632 local max = Tux:get_gold()
633 if (max > 4 * next_bet) then
634 bet = next_bet
635 next("node" .. next_gamble_node)
636 else
637 Npc:says(_"You do not have enough bucks to bet the same.")
638 next("node35")
639 end
640 hide("node61", "node62", "node63", "node64", "node69")
641 end,
642 },
643 {
644 id = "node62",
645 text = _"I prefer to bet another sum.",
646 topic = "Gambling",
647 code = function()
648 hide("node61", "node62", "node63", "node64") next("node35")
649 end,
650 },
651 {
652 id = "node63",
653 text = _"What other games are you playing?",
654 topic = "Gambling",
655 code = function()
656 Npc:says(_"I play just a dice game and a coin-flipping game.")
657 hide("node61", "node62", "node63", "node63", "node64") show("node31", "node32", "node33", "node34")
658 end,
659 },
660 {
661 id = "node64",
662 text = _"What did I win or lose?",
663 topic = "Gambling",
664 code = function()
665 if (total_bet > 0) then
666 Npc:says(_"You have won %d circuits.", total_bet)
667 else
668 Npc:says(_"You have lost %d circuits.", -total_bet)
669 end
670 end,
671 },
672 {
673 id = "node69",
674 text = _"I'll stop gambling.",
675 topic = "Gambling",
676 code = function()
677 Npc:says_random(_"We can play again whenever you want!",
678 _"You are right, I'm going to clean you out!",
679 _"The house always wins; sooner or later...")
680 -- end any partial gambling node
681 hide("node31", "node32", "node33", "node34") -- Choose game
682 hide("node35", "node36", "node36", "node37", "node38", "node39") -- Choose bet
683 hide("node40", "node41", "node43", "node44") -- Dice game
684 hide("node50", "node51", "node52", "node53", "node54", "node55", "node56") -- Coin-flipping game
685 hide("node60", "node61", "node62", "node63", "node63", "node64") -- After game
686 pop_topic()
687 end,
688 },
689 {
690 id = "node99",
691 text = _"See you later.",
692 code = function()
693 Npc:says_random(_"Goodbye and remember: My bar is always open.",
694 _"Come back soon!",
695 _"You are welcome to unwind with old Ewald any time. Come back soon.",
696 _"Remember, you can always come back here to relax and kick back.")
697 end_dialog()
698 end,
699 },
700 }