summary refs log tree commit diff stats
path: root/res/scripts/hallucination_interior.lua
blob: 5d313d4533dc63e5bbf7a6f084cb2910b08dc1b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
hallucination_interior = {}

function hallucination_interior.off_left()
  ChangeMap("hallucination_beach", "fromRight")
end

function hallucination_interior.off_top()
  ChangeMap("hallucination_cliff", "fromBottom")
end

function hallucination_interior.off_right()
  ChangeMap("hallucination_mirror", "fromLeft")
end

function hallucination_interior.talk_to_magic()
  StartCutscene()
  SetAnimation("magic_dcmc", "talk")
  DisplayMessage("* Blah blah blah you should come to the show!", "Magic", SpeakerType.MAN)
  WaitForEndOfMessage()

  SetAnimation("magic_dcmc", "still")
  Delay(1000)

  UnpauseSprite("magic_dcmc")
  SetMovementSpeed("magic_dcmc", 1)
  DirectSpriteToLocation("magic_dcmc", "magic_walkaway", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
  WaitForSpritePath("magic_dcmc")

  DisableSprite()

  HideCutsceneBars()
end

function hallucination_interior.mailbox1()
  StartCutscene()
  DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE)
  ShowChoice("Yes", "No")
  WaitForEndOfMessage()

  if GetChoiceSelection() == 0 then
    DisplayMessage("* There are lots of postcards inside.\n* Read them?", "", SpeakerType.NONE)
    ShowChoice("Yes", "No")
    WaitForEndOfMessage()

    if GetChoiceSelection() == 0 then
      DisplayMessage("* The boy named Lucas is crying at a grave.\n\f* The boy named Lucas and his dog are loitering in the forest.\n\f* The boy named Lucas is getting into trouble in the mountains.\n\f* The boy named Lucas stole Beanoff from our garden.\n\f* The boy named Lucas is bullying animals.\n\f* The boy named Lucas learned some bad magic.\n\f* The boy named Lucas ......\n\f* The boy named Lucas ......\n\f* The boy named Lucas ......\n\f* The boy named Lucas .........\n\f* The mailbox let out a tremendous scream.", "", SpeakerType.NONE)
      WaitForEndOfMessage()
    end
  end

  HideCutsceneBars()
end

function hallucination_interior.join_claus()
  StartCutscene()
  SetAnimation("join_claus", "talk")
  DisplayMessage("* Say, Lucas. Whatcha up to?\n\f* It looks so fun! Let me join you!", "Claus", SpeakerType.MAN)
  ShowChoice("Yes", "No")
  WaitForEndOfMessage()

  if GetChoiceSelection() == 0 then
    DisplayMessage("* Yes!\n\f* Okay, then I'll be at the very end!\n* Thanks!", "Claus", SpeakerType.MAN)
    WaitForEndOfMessage()

    local clausId = getSpriteByAlias("join_claus")
    character():addSpriteToParty(getPlayerSprite(), clausId)
    transform():undoCollision(clausId)

    local clausSprite = getSprite(clausId)
    clausSprite.persistent = true

    gamestate.claus_joined = true
    gamestate.still_has_claus = true
  else
    DisplayMessage("* You won't let me join in?\nWhy not? Why not?\n\f* Why won't you let me join in?", "Claus", SpeakerType.MAN)
    WaitForEndOfMessage()
  end

  SetAnimation("join_claus", "still")
  HideCutsceneBars()
end

function hallucination_interior.mailbox_lightning()
  StartCutscene()
  DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE)
  ShowChoice("Yes", "No")
  WaitForEndOfMessage()

  if GetChoiceSelection() == 1 then
    HideCutsceneBars()
    return
  end

  FadeMap(500, 0.5)
  WaitForMapFade()

  DisplayMessage("* ...?", "", SpeakerType.NONE)
  WaitForEndOfMessage()

  PlaySound("lightning_crackle.wav")
  Delay(1196)

  local lucasPos = GetPosition("lucas")
  CreateAnimatedSpriteAtPosition("lightning_from_mailbox", "lightning", lucasPos:x() + 56, lucasPos:y() - 72, "strike", Direction.DOWN_LEFT, SpriteLayer.ABOVE)

  ShakeCamera(66)
  PlaySound("lightning_explosion.wav")
  SetDirection("lucas", Direction.DOWN)
  SetAnimation("lucas", "lightning_electrocute!")
  WaitForAnimation("lucas")

  StopShakingCamera()
  DestroyNamedSprite("lightning_from_mailbox")
  SetAnimation("lucas", "lightning_collapse!")
  WaitForAnimation("lucas")

  FadeMap(500, 0.0)
  WaitForMapFade()

  DisplayMessage("* It was lightning.\n\fAh.", "", SpeakerType.NONE)
  WaitForEndOfMessage()
  HideCutsceneBars(CutsceneOptions.DO_NOT_CHANGE_ANIMATION)
end

function hallucination_interior.approach_doria()
  if gamestate.approached_doria then
    return
  end

  gamestate.approached_doria = true

  StartCutscene()
  SetDirection("boney", Direction.LEFT)
  SetAnimation("boney", "barking")
  local barkingNoise = LoopSound("barking_at_hallucination.wav")
  Delay(200)

  ShowExpression("lucas", "surprise")
  SetDirection("lucas", Direction.LEFT)
  Delay(100)

  ShowExpression("kuma", "surprise")
  ShowExpression("duster", "surprise")
  SetDirection("kuma", Direction.LEFT)
  SetDirection("duster", Direction.LEFT)
  Delay(1000)

  PanToSprite("doria", 2000)
  Delay(500)

  RemoveExpression("lucas")
  RemoveExpression("kuma")
  RemoveExpression("duster")
  WaitForPan()

  SetDirection("doria", Direction.DOWN_RIGHT)
  SetAnimation("doria", "talk")
  ShowExpression("doria", "surprise")
  DisplayMessage("* Oh my!\n\f* Is that our little Kumatora I spy? `", "Doria", SpeakerType.MAN)
  Delay(1000)

  RemoveExpression("doria")
  WaitForEndOfMessage()

  SetAnimation("doria", "still")
  ReturnCamera(2000)
  Delay(1000)
  SetAnimation("kuma", "talk")
  DisplayMessage("* Doria...?\n\f* What the hell... You're still alive?", "Kumatora", SpeakerType.WOMAN)
  WaitForEndOfMessage()

  SetAnimation("boney", "crouch")
  StopSound(barkingNoise)
  PlaySound("boney_growl.wav")
  SetAnimation("kuma", "frozen")
  Delay(1000)

  SetAnimation("doria", "talk")
  DisplayMessage("* It is! It is her!\n\f* Such style! Such swagger!\nWhy, just as if she were Magifolk herself! `\n* When Ionia showed us the human she was looking after, I hardly knew what to think.", "Doria", SpeakerType.MAN)
  WaitForEndOfMessage()

  SetDirection("doria", Direction.DOWN)
  SetAnimation("doria", "hearts")
  DisplayMessage("* But what a lovely lady you've become!\n\f* You've made this old girl cry with pride! `", "Doria", SpeakerType.MAN)
  WaitForEndOfMessage()

  SetDirection("doria", Direction.DOWN_RIGHT)
  SetAnimation("doria", "talk")
  DisplayMessage("* Now I shudder to think how I'll move on once your short human life is over.\n* Ooh, get another one, I suppose!\nYes, we'll just get another human. `\nAnd the new Kumatora will be just as good, no, better than the last one!", "Doria", SpeakerType.MAN)
  WaitForEndOfMessage()

  SetDirection("doria", Direction.DOWN)
  SetAnimation("doria", "hairflip!")
  WaitForAnimation("doria")

  SetAnimation("doria", "still")
  Delay(1000)

  SetAnimation("kuma", "talk")
  DisplayMessage("* H-hey, what do you mean <new Kumatora>?", "Kumatora", SpeakerType.WOMAN)
  WaitForEndOfMessage()

  HideCutsceneBars()
end

function hallucination_interior.talk_to_ionia()
  Halt("ionia")
  StartCutscene()
  SetAnimation("ionia", "talk")
  DisplayMessage("* Kumatora!\n\f* Oh! My goodness!\nGet away from that monster!", "Ionia", SpeakerType.MAN)
  WaitForEndOfMessage()

  SetAnimation("ionia", "still")
  HideCutsceneBars()
end

function hallucination_interior.mailbox_time_passage()
  StartCutscene()
  DisplayMessage("* The mailbox lid is open...\n* Peek inside?", "", SpeakerType.NONE)
  ShowChoice("Yes", "No")
  WaitForEndOfMessage()

  if GetChoiceSelection() == 1 then
    HideCutsceneBars()
    return
  end

  FadeoutMusic(2000)
  Delay(4000)

  DisplayMessage("* Inside the mailbox is a long hallway.", "", SpeakerType.NONE)
  WaitForEndOfMessage()

  Delay(1000)

  FadeToBlack(1000)

  HideCutsceneBars()
  DisablePlayerControl()
  ChangeMap("time_passage", "fromMailbox", ChangeMapOptions.DO_NOT_FADE | ChangeMapOptions.DO_NOT_CHANGE_MUSIC)
  Delay(1000)

  PlayMusic("time_passage", 2000)
  RemoveFadeout(2000)

  EnablePlayerControl()
end

function hallucination_interior.switch_claus_attention()
  gamestate.switch_claus_lost_interest = false

  if gamestate.switch_claus_gaining_attention then
    return
  end

  gamestate.switch_claus_gaining_attention = true

  Halt("switch_claus")
  DisableBehaviour("switch_claus")
  ShowExpression("switch_claus", "surprise")
  FaceTowardSprite("switch_claus", "lucas")
  Delay(1000)

  RemoveExpression("switch_claus")

  if gamestate.switch_claus_map_change then
    return
  end

  if gamestate.switch_claus_lost_interest then
    SetMovementSpeed("switch_claus", 1)
    StartWandering("switch_claus")
  else
    SetMovementSpeed("switch_claus", 2)

    if IsSpriteInZone("switch_claus", "switch_claus_hidden") then
      MakeSpriteNotSolid("lucas")
      DirectSpriteToLocation("switch_claus", "switch_claus_rsvp")
      MakeSpriteSolid("lucas")
      WaitForSpritePath("switch_claus")
    end

    if gamestate.switch_claus_map_change then
      return
    end

    if gamestate.switch_claus_lost_interest then
      SetMovementSpeed("switch_claus", 1)
      StartWandering("switch_claus")
    else
      FollowSprite("switch_claus", "lucas")
    end
  end

  gamestate.switch_claus_gaining_attention = false
end

function hallucination_interior.switch_claus_lose_interest()
  gamestate.switch_claus_lost_interest = true

  SetMovementSpeed("switch_claus", 1)
  StartWandering("switch_claus")
end

function hallucination_interior.lets_switch_places()
  StartCutscene()

  FaceTowardSprite("switch_claus", "lucas")
  FacePartyTowardSprite("lucas", "switch_claus")
  Halt("switch_claus")
  PanToSprite("switch_claus", 500)
  WaitForPan()

  SetAnimation("switch_claus", "talk")

  DisplayMessage("* Let's switch places.\n\f* Let's switch places.\n\f* Lucas. Lucas\nLet's switch places.", "Claus", SpeakerType.MAN)
  ShowChoice("Yes", "No")
  WaitForEndOfMessage()

  if GetChoiceSelection() == 0 then
    DisplayMessage("* You'd like that, wouldn't you?\n\f* ...no. That's too easy.\n\fI'm not letting you off that easy.\n\f* It should've been you, right?\nYou feel guilty, right?\n\f* Well guess what, Lucas?\n\fYou're going to have to live with that guilt for the rest of your life.\n\f* You know why?\n\f* Because you're going to live, Lucas!\n\fYOU'RE! GOING! TO! LIVE!", "Claus", SpeakerType.MAN)
    HideCutsceneBars()

    SetAnimation("switch_claus", "still")

    -- Just so we can get away, for now.
    hallucination_interior.switch_claus_lose_interest()
  else
    DisplayMessage("* Huh? Why not?\n\f* You say I'm not real? I'm not Claus?\n\f* Oh, Lucas...", "Claus", SpeakerType.MAN)
    WaitForEndOfMessage()

    SetAnimation("switch_claus", "still")
    FadeoutMusic(1000)
    FadeMap(1000, 0.75)
    WaitForMapFade()

    Delay(1000)

    SetAnimation("switch_claus", "talk")
    DisplayMessage("* Of course I'm not Claus.\n\f* I'm you, remember?\n\f* Let's switch places.\nIt'll be sooo much fun.\n\f* It's what you deserve for not stopping me when I went to fight the Drago.", "Claus", SpeakerType.MAN)
    WaitForEndOfMessage()

    -- TODO: let's switch places
    ShakeCamera(100)
    Delay(50)

    gamestate.switch_claus_map_change = true

    FadeToBlack(1)
    ReturnCamera(1)
    ChangeMap("switched_interior", "lucas_start", ChangeMapOptions.DO_NOT_FADE | ChangeMapOptions.DO_NOT_CHANGE_MUSIC)
    DisablePlayerControl()
    BreakUpParty("lucas")
    MoveSpriteToWarp("kuma", "kuma_start")
    MoveSpriteToWarp("duster", "duster_start")
    MoveSpriteToWarp("boney", "boney_start")
    SetDirection("lucas", Direction.RIGHT)
    SetDirection("switch_claus", Direction.LEFT)
    SetDirection("kuma", Direction.UP)
    SetDirection("duster", Direction.UP)
    SetDirection("boney", Direction.UP)
    SetAnimation("lucas", "frozen")
    SetAnimation("switch_claus", "frozen")
    SetAnimation("kuma", "frozen")
    SetAnimation("duster", "frozen")
    SetAnimation("boney", "frozen")
    FadeMap(1, 0.0)
    StopShakingCamera()
    RemoveFadeout(1)
    Delay(1000)

    SetAnimation("switch_claus", "talk")
    DisplayMessage("* Look how much this is getting to you!\n\f* That's the thing about you.\nYou feel too much!\n\f* You think you're so strong but you're nothing like me.", "Claus", SpeakerType.MAN)
    WaitForEndOfMessage()

    SetAnimation("switch_claus", "frozen")
    ShowExpression("kuma", "surprise")
    Delay(500)

    SetAnimation("kuma", "talk")
    DisplayMessage("* What are we doing just standing around listening to smack talk from a nightmare?", "Kumatora", SpeakerType.WOMAN)
    Delay(250)

    RemoveExpression("kuma")
    WaitForEndOfMessage()

    SetAnimation("kuma", "frozen")
    SetAnimation("duster", "talk")
    DisplayMessage("* It's not fair that the forest is doing this to you.\n\f* We'll get through this together, I promise.", "Duster", SpeakerType.MAN)
    WaitForEndOfMessage()

    SetAnimation("duster", "frozen")
    Delay(2000)

    SetAnimation("switch_claus", "talk")
    DisplayMessage("* I'm going away now.\n\f* I hope you're happy.", "Claus", SpeakerType.MAN)
    WaitForEndOfMessage()

    SetAnimation("switch_claus", "frozen")
    Delay(1000)

    SetMovementSpeed("switch_claus", 1)

    local switchClausId = getSpriteByAlias("switch_claus")
    character():addSpriteToParty(switchClausId, getSpriteByAlias("kuma"))
    character():addSpriteToParty(switchClausId, getSpriteByAlias("duster"))
    character():addSpriteToParty(switchClausId, getSpriteByAlias("boney"))

    UnpauseSprite("switch_claus")
    DirectSpriteToLocation("switch_claus", "out_of_sight", PathfindingOptions.CARDINAL_DIRECTIONS_ONLY)
    WaitForSpritePath("switch_claus")

    PlayMusic("ello_ello_geen_bread", 2000)
    HideCutsceneBars()
  end
end