Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shadow_mantle_enemy_Step_2

(view raw script w/o annotations or w/e)
1
if (place_meeting(x, y, obj_board_swordhitbox) && hurttimer == 0)
2
{
3
    snd_stop(snd_board_bosshit);
4
    snd_play(snd_board_bosshit);
5
    with (obj_board_controller)
6
    {
7
        crt_glitch = 6;
8
        crt_glitchstrength = 8;
9
    }
10
    hurttimer = 8;
11
    if (phasetransitioncon == 1)
12
    {
13
        hp -= 0.2;
14
    }
15
    else if (hp < 5)
16
    {
17
        if (dashcon != 0)
18
            hp -= 1;
19
        else
20
            hp -= 0.1;
21
    }
22
    else
23
    {
24
        if (timeshitthisphase == -2)
25
            hp -= 2;
26
        if (timeshitthisphase == -1)
27
            hp -= 1.5;
28
        if (timeshitthisphase == 0)
29
            hp--;
30
        if (timeshitthisphase == 1)
31
            hp -= 0.75;
32
        if (timeshitthisphase == 2)
33
            hp -= 0.5;
34
        if (timeshitthisphase > 2)
35
            hp -= 0.2;
36
        damagetakenduringattack++;
37
        timeshitthisphase++;
38
        if (spawnenemies == 1)
39
            hitsduringenemies++;
40
    }
41
    snd_stop(snd_board_mantle_dash_slow);
42
    if ((phase != 4 || phasetransitioncon == 1) && hp < 4)
43
        hp = 4;
44
    if (hp < 1 || (hp < 2 && global.shadow_mantle_losses >= 7))
45
    {
46
        snd_free(global.currentsong[0]);
47
        instance_create(x, y, obj_shadow_mantle_enemy_outro);
48
        instance_destroy();
49
        with (obj_shadow_mantle_clone)
50
            instance_destroy();
51
        with (obj_shadow_mantle_cloud_bullet)
52
            instance_destroy();
53
        with (obj_shadow_mantle_bomb)
54
            instance_destroy();
55
        with (obj_shadow_mantle_cloud)
56
            instance_destroy();
57
        with (obj_shadow_mantle_enemy_spawn)
58
            instance_destroy();
59
        with (obj_shadow_mantle_fire_controller)
60
            instance_destroy();
61
        with (obj_shadow_mantle_fire)
62
            instance_destroy();
63
        with (obj_spawn_pos)
64
            instance_destroy();
65
        with (obj_shadow_mantle_fire3)
66
            instance_destroy();
67
        with (obj_shadow_mantle_groundfire)
68
            instance_destroy();
69
        with (obj___)
70
            instance_destroy();
71
        exit;
72
    }
73
}
74
scr_depth_board
scr_depth_board

function
scr_depth_board()
{ depth = 1000000 - ((y * 10) + ((sprite_height - sprite_yoffset) * 10)); } function scr_board_depth() {
scr_depth_board();
}
();
75
if (!i_ex(obj_shadow_mantle_enemy_spawn) && !i_ex(obj___) && burstwavecon == 0 && spawnenemies == 0 && dashcon == 0 && flamewavecon == 0 && telegraphtimer == 0 && phasetransitioncon == 0)
76
{
77
    hspeed = 0;
78
    vspeed = 0;
79
    attacktimer++;
80
}
81
if ((hp <= 22 && phase == 1) || (hp <= 13 && phase == 2) || (hp <= 4 && phase == 3))
82
{
83
    burstwavecon = 0;
84
    burstwavetimer = 0;
85
    spawnenemies = 0;
86
    spawnenemiestimer = 0;
87
    dashcon = 0;
88
    dashtimer = 0;
89
    dashused = 0;
90
    dashcount = 0;
91
    flamewavecon = 0;
92
    flamewavetimer = 0;
93
    telegraphtimer = 0;
94
    phasetransitioncon = 0;
95
    attacktimer = 20;
96
    darkcandydrop = false;
97
    sprite_index = spr_shadow_mantle_idle;
98
    image_speed = 1/3;
99
    speed = 0;
100
    gravity = 0;
101
    friction = 0;
102
    hspeed = 0;
103
    vspeed = 0;
104
    path_end();
105
    with (obj_shadow_mantle_fire)
106
        instance_destroy();
107
    with (obj_shadow_mantle_fire_controller)
108
        instance_destroy();
109
}
110
if (attacktimer >= 20)
111
{
112
    if (timeshitthisphase > 0)
113
        timeshitthisphase = 0;
114
    else if (timeshitthisphase == 0)
115
        timeshitthisphase = -1;
116
    else if (timeshitthisphase == -1)
117
        timeshitthisphase = -2;
118
    with (obj_shadow_mantle_fire)
119
        instance_destroy();
120
    attacktimer = 0;
121
    damagetakenduringattack = 0;
122
    movecon = 0;
123
    movetimer = 0;
124
    dashcount = 0;
125
    telegraphtimer = 0;
126
    telegraphused = 0;
127
    hitsduringenemies = 0;
128
    hspeed = 0;
129
    vspeed = 0;
130
    speed = 0;
131
    var attackchosen = false;
132
    if (hp > 22)
133
    {
134
        if (burstwaveused == 0 && flamewaveused == 0)
135
        {
136
            if (global.shadow_mantle_losses == 0)
137
                flamewaveused = 1;
138
            else if (choose(1, 2) == 1)
139
                burstwaveused = 1;
140
            else
141
                flamewaveused = 1;
142
        }
143
        if (burstwaveused == 0)
144
        {
145
            burstwaveused = 1;
146
            flamewaveused = 0;
147
            burstwavecon = 1;
148
            movestyle = "cardinal";
149
        }
150
        else if (flamewaveused == 0)
151
        {
152
            flamewaveused = 1;
153
            burstwaveused = 0;
154
            flamewavecon = 1;
155
        }
156
    }
157
    if (hp > 13 && hp <= 22)
158
    {
159
        if (phase == 1)
160
        {
161
            phase = 2;
162
            phasetransitioncon = 1;
163
            phasetransitiontimer = 0;
164
            movetimer = 0;
165
            movecon = 0;
166
            movestyle = "to point and stop";
167
            enemywaveused = 1;
168
        }
169
        else
170
        {
171
            if (dashused == 0 && enemywaveused == 0)
172
            {
173
                if (choose(1, 2) == 1)
174
                    enemywaveused = 1;
175
                else
176
                    dashused = 1;
177
            }
178
            if (enemywaveused == 0)
179
            {
180
                enemywaveused = 1;
181
                dashused = 0;
182
                spawnenemies = 1;
183
            }
184
            else if (dashused == 0)
185
            {
186
                dashused = 1;
187
                enemywaveused = 0;
188
                dashcon = 2;
189
                movestyle = "to point and stop";
190
            }
191
        }
192
    }
193
    if (hp > 4 && hp <= 13)
194
    {
195
        if (phase == 2)
196
        {
197
            phase = 3;
198
            phasetransitioncon = 1;
199
            phasetransitiontimer = 0;
200
            movetimer = 0;
201
            movecon = 0;
202
            movestyle = "to point and stop";
203
        }
204
        else
205
        {
206
            var attack = choose(2, 2, 2);
207
            if (burstwaveused == 1 && enemywaveused == 1 && flamewaveused == 1)
208
            {
209
                if (lastused != "burstwave")
210
                    burstwaveused = 0;
211
                if (lastused != "enemywave")
212
                    enemywaveused = 0;
213
                if (lastused != "flamewave")
214
                    flamewaveused = 0;
215
            }
216
            repeat (4)
217
            {
218
                if (hp <= 4)
219
                {
220
                    hp = 4;
221
                    dashcon = 2;
222
                    dashtimer = 5;
223
                    movestyle = "to point and stop";
224
                }
225
                else if (attackchosen == false)
226
                {
227
                    if (attack == 0 && burstwaveused == 0)
228
                    {
229
                        burstwaveused = 1;
230
                        attackchosen = true;
231
                        burstwavecon = 1;
232
                        movestyle = "cardinal";
233
                        lastused = "burstwave";
234
                    }
235
                    else if (attack == 1 && enemywaveused == 0)
236
                    {
237
                        enemywaveused = 1;
238
                        attackchosen = true;
239
                        spawnenemies = 1;
240
                        lastused = "enemywave";
241
                    }
242
                    else if (attack == 2 && flamewaveused == 0)
243
                    {
244
                        flamewaveused = 1;
245
                        attackchosen = true;
246
                        flamewavecon = 1;
247
                        lastused = "flamewave";
248
                    }
249
                    else
250
                    {
251
                        attack++;
252
                        if (attack > 2)
253
                            attack = 0;
254
                    }
255
                }
256
            }
257
        }
258
    }
259
    if (hp <= 4)
260
    {
261
        if (phase == 3)
262
        {
263
            phase = 4;
264
            phasetransitioncon = 1;
265
            phasetransitiontimer = 0;
266
            movetimer = 0;
267
            movecon = 0;
268
            movestyle = "to point and stop";
269
        }
270
        else
271
        {
272
            var attack = choose(0, 1, 2);
273
            dashcon = 2;
274
            movestyle = "to point and stop";
275
        }
276
    }
277
}
278
if (burstwavecon == 1)
279
{
280
    burstwavetimer++;
281
    if (hp > 13)
282
    {
283
        if (burstwavetimer == 1)
284
        {
285
            sprite_index = spr_shadow_mantle_release;
286
            image_speed = 0.5;
287
            image_index = 0;
288
        }
289
        if (burstwavetimer == 11)
290
        {
291
            bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
292
            bullet.depth = depth - 5;
293
            bullet.targetx = 160 + (irandom(9) * 32) + 16;
294
            bullet.targety = 96 + (irandom(1) * 32) + 29;
295
        }
296
        if (burstwavetimer == 17)
297
        {
298
            sprite_index = spr_shadow_mantle_release_abbreviated;
299
            image_speed = 0.5;
300
            image_index = 0;
301
        }
302
        if (burstwavetimer == 21)
303
        {
304
            bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
305
            bullet.depth = depth - 5;
306
            bullet.targetx = 160 + (irandom(9) * 32) + 16;
307
            bullet.targety = 160 + (irandom(1) * 32) + 29;
308
        }
309
        if (burstwavetimer == 27)
310
        {
311
            sprite_index = spr_shadow_mantle_release_abbreviated;
312
            image_speed = 0.5;
313
            image_index = 0;
314
        }
315
        if (burstwavetimer == 31)
316
        {
317
            bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
318
            bullet.depth = depth - 5;
319
            bullet.targetx = 160 + (irandom(9) * 32) + 16;
320
            bullet.targety = 224 + (irandom(1) * 32) + 29;
321
        }
322
        if (burstwavetimer == 121)
323
        {
324
            sprite_index = spr_shadow_mantle_release;
325
            image_speed = 0.5;
326
            image_index = 0;
327
        }
328
        if (burstwavetimer == 131)
329
        {
330
            bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
331
            bullet.depth = depth - 5;
332
            bullet.targetx = 160 + (irandom(9) * 32) + 16;
333
            bullet.targety = 96 + (irandom(1) * 32) + 29;
334
        }
335
        if (burstwavetimer == 137)
336
        {
337
            sprite_index = spr_shadow_mantle_release_abbreviated;
338
            image_speed = 0.5;
339
            image_index = 0;
340
        }
341
        if (burstwavetimer == 141)
342
        {
343
            bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
344
            bullet.depth = depth - 5;
345
            bullet.targetx = 160 + (irandom(9) * 32) + 16;
346
            bullet.targety = 160 + (irandom(1) * 32) + 29;
347
        }
348
        if (burstwavetimer == 147)
349
        {
350
            sprite_index = spr_shadow_mantle_release_abbreviated;
351
            image_speed = 0.5;
352
            image_index = 0;
353
        }
354
        if (burstwavetimer == 151)
355
        {
356
            bullet = instance_create(x + 16, y + 29, obj_shadow_mantle_bomb);
357
            bullet.depth = depth - 5;
358
            bullet.targetx = 160 + (irandom(9) * 32) + 16;
359
            bullet.targety = 224 + (irandom(1) * 32) + 29;
360
        }
361
    }
362
    else
363
    {
364
        if (burstwavetimer == 1)
365
        {
366
            sprite_index = spr_shadow_mantle_release;
367
            image_speed = 0.5;
368
            image_index = 0;
369
        }
370
        if (burstwavetimer == 11)
371
        {
372
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
373
            bullet.depth = depth - 5;
374
            bullet.targetx = 160 + (irandom(4) * 32) + 16;
375
            bullet.targety = 96 + (irandom(2) * 32) + 29;
376
        }
377
        if (burstwavetimer == 17)
378
        {
379
            sprite_index = spr_shadow_mantle_release_abbreviated;
380
            image_speed = 0.5;
381
            image_index = 0;
382
        }
383
        if (burstwavetimer == 21)
384
        {
385
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
386
            bullet.depth = depth - 5;
387
            bullet.targetx = 320 + (irandom(4) * 32) + 16;
388
            bullet.targety = 96 + (irandom(2) * 32) + 29;
389
        }
390
        if (burstwavetimer == 27)
391
        {
392
            sprite_index = spr_shadow_mantle_release_abbreviated;
393
            image_speed = 0.5;
394
            image_index = 0;
395
        }
396
        if (burstwavetimer == 31)
397
        {
398
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
399
            bullet.depth = depth - 5;
400
            bullet.targetx = 160 + (irandom(4) * 32) + 16;
401
            bullet.targety = 192 + (irandom(2) * 32) + 29;
402
        }
403
        if (burstwavetimer == 37)
404
        {
405
            sprite_index = spr_shadow_mantle_release_abbreviated;
406
            image_speed = 0.5;
407
            image_index = 0;
408
        }
409
        if (burstwavetimer == 41)
410
        {
411
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
412
            bullet.depth = depth - 5;
413
            bullet.targetx = 320 + (irandom(4) * 32) + 16;
414
            bullet.targety = 192 + (irandom(2) * 32) + 29;
415
        }
416
        if (burstwavetimer == 81)
417
        {
418
            sprite_index = spr_shadow_mantle_release;
419
            image_speed = 0.5;
420
            image_index = 0;
421
        }
422
        if (burstwavetimer == 91)
423
        {
424
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
425
            bullet.depth = depth - 5;
426
            bullet.targetx = 160 + (irandom(4) * 32) + 16;
427
            bullet.targety = 96 + (irandom(2) * 32) + 29;
428
        }
429
        if (burstwavetimer == 97)
430
        {
431
            sprite_index = spr_shadow_mantle_release_abbreviated;
432
            image_speed = 0.5;
433
            image_index = 0;
434
        }
435
        if (burstwavetimer == 101)
436
        {
437
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
438
            bullet.depth = depth - 5;
439
            bullet.targetx = 320 + (irandom(4) * 32) + 16;
440
            bullet.targety = 96 + (irandom(2) * 32) + 29;
441
        }
442
        if (burstwavetimer == 107)
443
        {
444
            sprite_index = spr_shadow_mantle_release_abbreviated;
445
            image_speed = 0.5;
446
            image_index = 0;
447
        }
448
        if (burstwavetimer == 111)
449
        {
450
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
451
            bullet.depth = depth - 5;
452
            bullet.targetx = 160 + (irandom(4) * 32) + 16;
453
            bullet.targety = 192 + (irandom(2) * 32) + 29;
454
        }
455
        if (burstwavetimer == 117)
456
        {
457
            sprite_index = spr_shadow_mantle_release_abbreviated;
458
            image_speed = 0.5;
459
            image_index = 0;
460
        }
461
        if (burstwavetimer == 121)
462
        {
463
            bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
464
            bullet.depth = depth - 5;
465
            bullet.targetx = 320 + (irandom(4) * 32) + 16;
466
            bullet.targety = 192 + (irandom(2) * 32) + 29;
467
        }
468
    }
469
    if ((hp > 13 && burstwavetimer >= 182) || (hp <= 13 && burstwavetimer >= 152))
470
    {
471
        movestyle = "none";
472
        hspeed = 0;
473
        vspeed = 0;
474
        if (telegraphtimer == 0 && damagetakenduringattack == 0)
475
        {
476
            sprite_index = spr_shadow_mantle_laugh;
477
            image_speed = 0.1;
478
            snd_play_pitch(snd_board_mantle_laugh_mid, 1.3);
479
            telegraphtimer = 61;
480
        }
481
        if (telegraphtimer <= 1 || (damagetakenduringattack >= 1 && telegraphtimer > 0 && telegraphtimer <= 31))
482
        {
483
            burstwavecon = 0;
484
            burstwavetimer = 0;
485
            sprite_index = spr_shadow_mantle_idle;
486
            image_speed = 1/3;
487
        }
488
    }
489
}
490
if (spawnenemies == 1)
491
{
492
    spawnenemiestimer++;
493
    if (spawnenemiestimer == 1)
494
    {
495
        sprite_index = choose(spr_shadow_mantle_side_r, spr_shadow_mantle_side_l);
496
        image_speed = 1/3;
497
    }
498
    if (spawnenemiestimer == 15 || spawnenemiestimer == 30 || spawnenemiestimer == 45 || spawnenemiestimer == 60 || spawnenemiestimer == 75)
499
    {
500
        snd_stop(snd_board_summon);
501
        snd_play(snd_board_summon);
502
        spawn = instance_create(x, y, obj_shadow_mantle_enemy_spawn);
503
    }
504
    if (spawnenemiestimer == 30 || spawnenemiestimer == 75)
505
        spawn.move_type = 1;
506
    if (spawnenemiestimer == 75)
507
        hitsduringenemies = 0;
508
    if (spawnenemiestimer == 77)
509
    {
510
        hitsduringenemies++;
511
        sprite_index = spr_shadow_mantle_laugh;
512
        image_speed = 0.1;
513
        image_xscale = 1;
514
        snd_play_pitch(snd_board_mantle_laugh_mid, 1.3);
515
    }
516
    if (spawnenemiestimer == 106)
517
    {
518
        sprite_index = spr_shadow_mantle_idle;
519
        image_speed = 1/3;
520
        image_xscale = 1;
521
    }
522
    if (spawnenemiestimer == 126)
523
        spawnenemiestimer = 76;
524
    if (spawnenemiestimer >= 77 && hitsduringenemies > 4)
525
    {
526
        sprite_index = spr_shadow_mantle_idle;
527
        image_speed = 1/3;
528
        image_xscale = 1;
529
        spawnenemies = 0;
530
        spawnenemiestimer = 0;
531
        dashcount = 0;
532
        dashused = 1;
533
        enemywaveused = 0;
534
        damagetakenduringattack = 0;
535
        timeshitthisphase = 0;
536
        dashcon = 2;
537
        dashtimer = -1;
538
        telegraphtimer = 0;
539
        movestyle = "to point and stop";
540
        waittimer = 0;
541
    }
542
}
543
if (flamewavecon == 1)
544
{
545
    flamewavetimer++;
546
    if (flamewavetimer == 1)
547
        movestyle = "path";
548
    if (flamewavetimer == 10 || flamewavetimer == 60 || flamewavetimer == 110 || flamewavetimer == 160)
549
    {
550
        if (hp > 13)
551
            _type = 4;
552
        else
553
            _type = 5;
554
        fire = instance_create(x, y, obj_shadow_mantle_fire_controller);
555
        fire._type = _type;
556
        if (flamewavetimer == 10)
557
            fire._type = 4.5;
558
    }
559
    if ((flamewavetimer == 20 || flamewavetimer == 50 || flamewavetimer == 80 || flamewavetimer == 110) && hp <= 13 && _type == 5)
560
    {
561
        sprite_index = spr_shadow_mantle_release;
562
        image_speed = 0.5;
563
        image_index = 0;
564
    }
565
    if ((flamewavetimer == 30 || flamewavetimer == 60 || flamewavetimer == 90 || flamewavetimer == 120) && hp <= 13 && _type == 5)
566
    {
567
        bullet = instance_create(x + 16, y + 16, obj_shadow_mantle_bomb);
568
        bullet.depth = depth - 5;
569
        bullet.targetx = 160 + (irandom(9) * 32) + 16;
570
        bullet.targety = 96 + (irandom(5) * 32) + 29;
571
    }
572
    if (flamewavetimer == 210)
573
    {
574
        flamewavecon = 0;
575
        flamewavetimer = 0;
576
    }
577
}
578
if (phasetransitioncon == 1)
579
{
580
    phasetransitiontimer++;
581
    if (phasetransitiontimer == 1)
582
        ohmygodimonfire = 0;
583
    if (phasetransitiontimer == 25)
584
    {
585
        snd_play_pitch(snd_board_mantle_move, 0.7);
586
        with (obj_shadow_mantle_bg)
587
            con = 1;
588
    }
589
    if (phasetransitiontimer == 46)
590
    {
591
        if (phase == 4)
592
        {
593
            sprite_index = spr_shadow_mantle_dash;
594
            ohmygodimonfire = 1;
595
            phasetransitioncon = 2;
596
            phasetransitiontimer = 0;
597
        }
598
    }
599
    if (phasetransitiontimer >= 47 && !i_ex(obj_shadow_mantle_fire_controller))
600
    {
601
        phasetransitioncon = 0;
602
        phasetransitiontimer = 0;
603
        attacktimer = 20;
604
        ohmygodimonfire = 0;
605
    }
606
}
607
if (phasetransitioncon == 2)
608
{
609
    phasetransitiontimer++;
610
    if (phasetransitiontimer == 1)
611
    {
612
        sprite_index = spr_shadow_mantle_dash;
613
        image_speed = 0.5;
614
        snd_play(snd_board_torch_high);
615
        ohmygodimonfire = 1;
616
    }
617
    if ((phasetransitiontimer % 5) == 0 && phasetransitiontimer < 52)
618
        snd_play(snd_board_torch_high);
619
    if ((phasetransitiontimer % 2) == 0 && phasetransitiontimer < 45)
620
    {
621
        var rand = irandom(360);
622
        instance_create(x + 16 + lengthdir_x(42, rand), y + 16 + lengthdir_y(42, rand), obj_shadow_mantle_transition_particle);
623
    }
624
    if (phasetransitiontimer > 10 && phasetransitiontimer < 52)
625
    {
626
        if (sprite_index == spr_shadow_mantle_dash)
627
            sprite_index = spr_shadow_mantle_onfire;
628
        else
629
            sprite_index = spr_shadow_mantle_dash;
630
    }
631
    if (phasetransitiontimer == 45)
632
    {
633
        var offset = 19.5;
634
        var len = 24;
635
        fire1 = instance_create(x + 16 + lengthdir_x(len, 67.5 + offset), y + 16 + lengthdir_y(len, 67.5 + offset), obj_board_marker);
636
        fire1.sprite_index = spr_shadow_mantle_fire;
637
        fire1.image_xscale = 2;
638
        fire1.image_yscale = 2;
639
        fire1.depth = 10000;
640
        fire2 = instance_create(x + 16 + lengthdir_x(len, 187.54 + offset), y + 16 + lengthdir_y(len, 187.54 + offset), obj_board_marker);
641
        fire2.sprite_index = spr_shadow_mantle_fire;
642
        fire2.image_xscale = 2;
643
        fire2.image_yscale = 2;
644
        fire2.depth = 10000;
645
        fire3 = instance_create(x + 16 + lengthdir_x(len, 307.54 + offset), y + 16 + lengthdir_y(len, 307.54 + offset), obj_board_marker);
646
        fire3.sprite_index = spr_shadow_mantle_fire;
647
        fire3.image_xscale = 2;
648
        fire3.image_yscale = 2;
649
        fire3.depth = 10000;
650
    }
651
    if (phasetransitiontimer > 52 && phasetransitiontimer < 72)
652
    {
653
        with (fire1)
654
        {
655
            if (visible == true)
656
                visible = false;
657
            else
658
                visible = true;
659
        }
660
        with (fire2)
661
        {
662
            if (visible == true)
663
                visible = false;
664
            else
665
                visible = true;
666
        }
667
        with (fire3)
668
        {
669
            if (visible == true)
670
                visible = false;
671
            else
672
                visible = true;
673
        }
674
    }
675
    if (phasetransitiontimer == 42)
676
    {
677
        fire = instance_create(x, y, obj_shadow_mantle_fire_controller);
678
        fire._type = 8;
679
    }
680
    if (phasetransitiontimer == 72)
681
    {
682
        sprite_index = spr_shadow_mantle_idle;
683
        ohmygodimonfire = 0;
684
        with (fire1)
685
            instance_destroy();
686
        with (fire2)
687
            instance_destroy();
688
        with (fire3)
689
            instance_destroy();
690
    }
691
    if (phasetransitiontimer >= 83 && !i_ex(obj_shadow_mantle_fire_controller))
692
    {
693
        phasetransitioncon = 0;
694
        phasetransitiontimer = 0;
695
        attacktimer = -10;
696
        ohmygodimonfire = 0;
697
    }
698
}
699
if (dashcon == 1)
700
{
701
    dashtimer++;
702
    if (dashtimer == 1)
703
    {
704
        if ((dashcount > 2 || (damagetakenduringattack > 2 && dashcount > 1)) && hp > 4)
705
        {
706
            show_debug_message("dashcount: " + string(dashcount));
707
            show_debug_message("damagetakenduringattack: " + string(damagetakenduringattack));
708
            vspeed = 16;
709
            x = 224 + (irandom(5) * 32);
710
            dashcon = 1.5;
711
            dashtimer = 0;
712
        }
713
        else
714
        {
715
            if (choose(1, 2) == 1)
716
            {
717
                direction = point_direction(x + 16, y + 16, obj_mainchara_board.x + 16, obj_mainchara_board.y + 16);
718
                gravity = 0.24;
719
            }
720
            else
721
            {
722
                direction = point_direction(x + 16, y + 16, obj_mainchara_board.x + 16 + choose(66, -66), obj_mainchara_board.y + 16);
723
                gravity = 0.24;
724
            }
725
            gravity_direction = direction;
726
            if (global.shadow_mantle_losses >= 7)
727
                gravity = 0.2;
728
            snd_play_delay(snd_board_mantle_dash_slow, 5, 1, 0.95 + random(0.1));
729
            speed = 2;
730
            dashtimer = 28;
731
            dashcon = 2;
732
            dashcount++;
733
        }
734
    }
735
}
736
if (dashcon == 1.5)
737
{
738
    if (y > (cameray() + 152) || telegraphtimer > 0)
739
    {
740
        gravity = 0;
741
        speed = 0;
742
        ohmygodimonfire = 0;
743
        if (telegraphtimer == 0)
744
        {
745
            sprite_index = spr_shadow_mantle_laugh;
746
            image_speed = 0.1;
747
            snd_play_pitch(snd_board_mantle_laugh_mid, 1.3);
748
            telegraphtimer = 46;
749
        }
750
        if (telegraphtimer == 1)
751
        {
752
            sprite_index = spr_shadow_mantle_idle;
753
            image_speed = 1/3;
754
            attacktimer = 19;
755
            dashcon = 0;
756
            telegraphtimer = 0;
757
        }
758
    }
759
}
760
if (dashcon == 0 && phasetransitioncon == 0)
761
    ohmygodimonfire = 0;
762
if (dashcon == 2)
763
{
764
    dashtimer++;
765
    if (dashtimer == 10 && friction == 0)
766
    {
767
        sprite_index = spr_shadow_mantle_dash;
768
        image_speed = 0.5;
769
        snd_play_volume(snd_board_mantle_dash_prepare, 1.2);
770
        ohmygodimonfire = 1;
771
        if (choose(1, 2) == 1)
772
            direction = point_direction(x + 16, y + 16, obj_mainchara_board.x + 16, obj_mainchara_board.y + 16);
773
        else
774
            direction = point_direction(x + 16, y + 16, obj_mainchara_board.x + 16 + choose(66, -66), obj_mainchara_board.y + 16);
775
        if (direction < 200 || direction > 330)
776
            direction = 200 + irandom(130);
777
        gravity_direction = direction;
778
        if (distance_to_object(obj_mainchara_board) >= 70)
779
        {
780
            friction = 0.4;
781
            speed = -6;
782
        }
783
        else
784
        {
785
            friction = 0.14;
786
            speed = -4;
787
            dashtimer = 0;
788
        }
789
    }
790
    if (dashtimer == 28)
791
    {
792
        snd_stop(snd_board_mantle_dash_slow);
793
        snd_play_pitch(snd_board_mantle_dash_slow, 0.95 + random(0.1));
794
        friction = 0;
795
        gravity = 0.5;
796
        speed = 10;
797
    }
798
    if (dashcount > 0 && hp <= 4)
799
    {
800
        if (dashtimer == 44)
801
            instance_create_depth(160 + (irandom(9) * 32), 20, depth + 1, obj_shadow_mantle_clone);
802
        if (dashtimer == 58)
803
            instance_create_depth(160 + (irandom(9) * 32), 20, depth + 1, obj_shadow_mantle_clone);
804
    }
805
    if (dashtimer >= 30 && (dashtimer % 2) == 0)
806
    {
807
        if (hp >= 5)
808
            gravity += 0.03;
809
        else if (global.shadow_mantle_losses < 7)
810
            gravity += 0.03;
811
        else if (global.shadow_mantle_losses < 14)
812
            gravity += 0.023;
813
        else
814
            gravity += 0.017;
815
        instance_create_depth(x + 16, y + 16, depth + 1, obj_shadow_mantle_groundfire);
816
    }
817
    if (y > (cameray() + cameraheight()) || y < (cameray() - 100) || x < (camerax() + 32) || x > (camerax() + camerawidth()))
818
    {
819
        dashtimer = 0;
820
        dashcon = 1;
821
        speed = 0;
822
        gravity = 0;
823
        direction = 270;
824
        gravity_direction = 270;
825
        x = 160 + (irandom(9) * 32);
826
        y = cameray() - 10;
827
    }
828
    if (ohmygodimonfire == 1)
829
    {
830
        dashhitboxtimer++;
831
        if (dashhitboxtimer > 20)
832
            instance_create_depth(x + 16 + lengthdir_x(speed, direction), y + 16 + lengthdir_y(speed, direction), depth - 99999, obj_shadow_mantle_dash_hitbox);
833
    }
834
    else
835
    {
836
        dashhitboxtimer = 0;
837
    }
838
}
839
siner++;
840
y += sin(siner / 3);
841
if (movestyle == "to point and stop")
842
{
843
    if (movetimer > 6)
844
        movetimer = 0;
845
    if (movecon == 0)
846
    {
847
        hspeed = 0;
848
        vspeed = 0;
849
        speed = 0;
850
        if (phasetransitioncon == 1)
851
        {
852
            targetx = 304;
853
            targety = 174;
854
        }
855
        else if (spawnenemies == 1)
856
        {
857
        }
858
        else
859
        {
860
            targetx = 160 + (irandom(9) * 32);
861
            targety = 96 + (irandom(5) * 32);
862
            if (dashcon == 2)
863
            {
864
                targetx = (obj_mainchara_board.x - 40) + irandom(80);
865
                if (targetx < 160)
866
                    targetx = 160;
867
                if (targetx > 446)
868
                    targetx = 446;
869
                targety = 96;
870
            }
871
        }
872
        movecon = 1;
873
        movetimer = 0;
874
    }
875
    if (movecon == 1)
876
    {
877
        if (image_blend != c_purple)
878
            image_blend = c_purple;
879
        else
880
            image_blend = c_white;
881
        movetimer++;
882
        x = lerp(x, targetx, movetimer / 6);
883
        y = lerp(y, targety, movetimer / 6);
884
        if (movetimer == 6)
885
        {
886
            image_blend = c_white;
887
            movecon = 0;
888
            movetimer = 0;
889
            movestyle = "none";
890
        }
891
    }
892
}
893
if (movestyle == "move slowly to points")
894
{
895
    if (movecon == 0)
896
    {
897
        speed = 0;
898
        hspeed = 0;
899
        vspeed = 0;
900
        targetx = 160 + (irandom(9) * 32);
901
        targety = 96 + (irandom(5) * 32);
902
        move_towards_point(targetx, targety, 1);
903
        movecon = 1;
904
    }
905
    if (movecon == 1)
906
    {
907
        movetimer++;
908
        if (movetimer == 60)
909
        {
910
            movecon = 0;
911
            movetimer = 0;
912
        }
913
    }
914
}
915
if (movestyle == "cardinal")
916
{
917
    if (movecon == 0)
918
    {
919
        speed = 0;
920
        var spd = 5;
921
        if (hp <= 13)
922
            spd = 7;
923
        var rand = choose(0, 1, 2, 3);
924
        if (rand == 0)
925
        {
926
            hspeed = spd;
927
            vspeed = 0;
928
        }
929
        if (rand == 1)
930
        {
931
            vspeed = -spd;
932
            hspeed = 0;
933
        }
934
        if (rand == 2)
935
        {
936
            hspeed = -spd;
937
            vspeed = 0;
938
        }
939
        if (rand == 3)
940
        {
941
            vspeed = spd;
942
            hspeed = 0;
943
        }
944
        if ((y + 16) < 150)
945
        {
946
            vspeed = spd;
947
            hspeed = 0;
948
        }
949
        if ((y + 16) > 228)
950
        {
951
            vspeed = -spd;
952
            hspeed = 0;
953
        }
954
        if ((x + 16) < 215)
955
        {
956
            vspeed = 0;
957
            hspeed = spd;
958
        }
959
        if ((x + 16) > 420)
960
        {
961
            vspeed = 0;
962
            hspeed = -spd;
963
        }
964
        movecon = 1;
965
    }
966
    if (movecon == 1)
967
    {
968
        movetimer++;
969
        if (movetimer == 20)
970
        {
971
            movecon = 0;
972
            movetimer = 0;
973
        }
974
    }
975
    if (x > (camerax() + camerawidth()))
976
    {
977
        hspeed = -5;
978
        vspeed = 0;
979
        movetimer = 0;
980
        movecon = 0;
981
    }
982
    if (x < (camerax() + 32))
983
    {
984
        hspeed = 5;
985
        vspeed = 0;
986
        movetimer = 0;
987
        movecon = 0;
988
    }
989
    if (y > (cameray() + cameraheight() + 32))
990
    {
991
        hspeed = 0;
992
        vspeed = -5;
993
        movetimer = 0;
994
        movecon = 0;
995
    }
996
    if (y < cameray())
997
    {
998
        hspeed = 0;
999
        vspeed = 5;
1000
        movetimer = 0;
1001
        movecon = 0;
1002
    }
1003
}
1004
if (movestyle == "path")
1005
{
1006
    speed = 0;
1007
    hspeed = 0;
1008
    vspeed = 0;
1009
    var spd = 0.15;
1010
    x = lerp(x, obj_shadow_mantle_path.x, spd);
1011
    y = lerp(y, obj_shadow_mantle_path.y, spd);
1012
}
1013
else
1014
{
1015
    firetrailtimer = 0;
1016
}
1017
if (sprite_index == spr_shadow_mantle_laugh)
1018
    image_speed = lerp(0.6, 0.1, telegraphtimer / 61);