Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_damage_all_overworld

(view raw script w/o annotations or w/e)
1
function 
scr_damage_all_overworld
scr_damage_all_overworld

function
scr_damage_all_overworld()
{ if (global.inv < 0) { gameover = 1; if (global.char[0] != 0 && global.hp[global.char[0]] > 1) gameover = 0; if (global.char[1] != 0 && global.hp[global.char[1]] > 1) gameover = 0; if (global.char[2] != 0 && global.hp[global.char[2]] > 1) gameover = 0; if (global.chapter == 5 && gameover && global.tempflag[57] == 1) { if (global.char[0] != 0) global.hp[global.char[0]] = 0; if (global.char[1] != 0) global.hp[global.char[1]] = 0; if (global.char[2] != 0) global.hp[global.char[2]] = 0; exit; } if (gameover == 1)
scr_gameover();
remdamage = damage; remtarget = target; if (!instance_exists(obj_shake)) instance_create(0, 0, obj_shake); with (obj_dmgwriter) killactive = 1; snd_stop(snd_hurt1); snd_play(snd_hurt1); var maxhpdiff = 0; for (ti = 0; ti < 3; ti += 1) { global.inv = -1; damage = remdamage; target = ti; tdamage = damage; with (global.charinstance[target]) { hurt = 1; hurttimer = 0; } hpdiff = tdamage; if (hpdiff >= global.hp[global.char[target]]) hpdiff = global.hp[global.char[target]] - 1; maxhpdiff = max(hpdiff, maxhpdiff); d_cancel = 0; if (hpdiff <= 1) { if (global.hp[global.char[target]] <= 0) { hpdiff = 0; d_cancel = 1; } else { hpdiff = 1; } } if (d_cancel == 0) { doomtype = -1; global.hp[global.char[target]] -= hpdiff; if ((instance_exists(global.charinstance[target]) && global.charinstance[target].visible == true) || i_ex(obj_climb_kris) || i_ex(obj_plat_player)) { var trg = -4; var nowriter = false; if (i_ex(obj_plat_player)) { trg = 910; if (ti > 0) { with (obj_plat_follower) { if (name == "susie" && other.ti == 1) trg = self; if (name == "ralsei" && other.ti == 2) trg = self; } if (trg == 910) { if (hpdiff == maxhpdiff) { with (dmgwriter) damage = maxhpdiff; } nowriter = true; } } } else if (i_ex(obj_climb_kris)) { trg = 1164; if (ti > 0) { with (obj_climb_susie) { if (name == "susie" && other.ti == 1) trg = self; if (name == "ralsei" && other.ti == 2) ...
()
2
{
3
    if (global.inv < 0)
4
    {
5
        gameover = 1;
6
        if (global.char[0] != 0 && global.hp[global.char[0]] > 1)
7
            gameover = 0;
8
        if (global.char[1] != 0 && global.hp[global.char[1]] > 1)
9
            gameover = 0;
10
        if (global.char[2] != 0 && global.hp[global.char[2]] > 1)
11
            gameover = 0;
12
        if (global.chapter == 5 && gameover && global.tempflag[57] == 1)
13
        {
14
            if (global.char[0] != 0)
15
                global.hp[global.char[0]] = 0;
16
            if (global.char[1] != 0)
17
                global.hp[global.char[1]] = 0;
18
            if (global.char[2] != 0)
19
                global.hp[global.char[2]] = 0;
20
            exit;
21
        }
22
        if (gameover == 1)
23
            
scr_gameover
scr_gameover

function
scr_gameover(arg0 = true)
{ if (global.chapter == 5) { global.flag[57] = 0; if (i_ex(obj_flowery_enemy) && global.flag[1865] == 1) global.flag[1865] = 2; with (obj_orangeheart_floweryjarona) stopthat = true; } if (global.flag[35 gameover_mode] == 0) { audio_stop_all(); if (arg0) snd_play(snd_hurt1); global.gameover_room = room; global.screenshot = sprite_create_from_surface(application_surface, 0, 0, __view_get(e__VW.WView, 0), __view_get(e__VW.HView, 0), 0, 0, 0, 0); snd_free_all(); room_goto(room_gameover ); } if (global.flag[35 gameover_mode] == 1) { global.turntimer = -1; global.flag[36 dojo_failure] = 1; global.flag[39 dojo_abort?] = 1; } if (global.flag[35 gameover_mode] == 2) { audio_stop_all(); snd_play(snd_hurt1); snd_free_all(); global.entrance = 0; global.tempflag[9] = 1; global.fighting = 0; global.interact = 0; global.hp[0] = 1; global.hp[1] = 1; global.hp[2] = 1; global.hp[3] = 1; __room = room; if (global.chapter == 2) { with (instance_create(0, 0, obj_persistentfadein)) image_alpha = 1.2; } room_goto(__room); } } enum e__VW { XView, YView, WView, HView, Angle, HBorder, VBorder, HSpeed, VSpeed, Object, Visible, XPort, YPort, WPort, HPort, Camera, SurfaceID }
();
24
        remdamage = damage;
25
        remtarget = target;
26
        if (!instance_exists(obj_shake))
27
            instance_create(0, 0, obj_shake);
28
        with (obj_dmgwriter)
29
            killactive = 1;
30
        snd_stop(snd_hurt1);
31
        snd_play(snd_hurt1);
32
        var maxhpdiff = 0;
33
        for (ti = 0; ti < 3; ti += 1)
34
        {
35
            global.inv = -1;
36
            damage = remdamage;
37
            target = ti;
38
            tdamage = damage;
39
            with (global.charinstance[target])
40
            {
41
                hurt = 1;
42
                hurttimer = 0;
43
            }
44
            hpdiff = tdamage;
45
            if (hpdiff >= global.hp[global.char[target]])
46
                hpdiff = global.hp[global.char[target]] - 1;
47
            maxhpdiff = max(hpdiff, maxhpdiff);
48
            d_cancel = 0;
49
            if (hpdiff <= 1)
50
            {
51
                if (global.hp[global.char[target]] <= 0)
52
                {
53
                    hpdiff = 0;
54
                    d_cancel = 1;
55
                }
56
                else
57
                {
58
                    hpdiff = 1;
59
                }
60
            }
61
            if (d_cancel == 0)
62
            {
63
                doomtype = -1;
64
                global.hp[global.char[target]] -= hpdiff;
65
                if ((instance_exists(global.charinstance[target]) && global.charinstance[target].visible == true) || i_ex(obj_climb_kris) || i_ex(obj_plat_player))
66
                {
67
                    var trg = -4;
68
                    var nowriter = false;
69
                    if (i_ex(obj_plat_player))
70
                    {
71
                        trg = 910;
72
                        if (ti > 0)
73
                        {
74
                            with (obj_plat_follower)
75
                            {
76
                                if (name == "susie" && other.ti == 1)
77
                                    trg = self;
78
                                if (name == "ralsei" && other.ti == 2)
79
                                    trg = self;
80
                            }
81
                            if (trg == 910)
82
                            {
83
                                if (hpdiff == maxhpdiff)
84
                                {
85
                                    with (dmgwriter)
86
                                        damage = maxhpdiff;
87
                                }
88
                                nowriter = true;
89
                            }
90
                        }
91
                    }
92
                    else if (i_ex(obj_climb_kris))
93
                    {
94
                        trg = 1164;
95
                        if (ti > 0)
96
                        {
97
                            with (obj_climb_susie)
98
                            {
99
                                if (name == "susie" && other.ti == 1)
100
                                    trg = self;
101
                                if (name == "ralsei" && other.ti == 2)
102
                                    trg = self;
103
                            }
104
                            if (trg == 1164)
105
                            {
106
                                if (hpdiff == maxhpdiff)
107
                                {
108
                                    with (dmgwriter)
109
                                        damage = maxhpdiff;
110
                                }
111
                                nowriter = true;
112
                            }
113
                        }
114
                    }
115
                    if (!nowriter)
116
                    {
117
                        dmgwriter = instance_create(x, y, obj_dmgwriter);
118
                        dmgwriter.damage = hpdiff;
119
                        dmgwriter.type = doomtype;
120
                        if (i_ex(obj_climb_kris) || i_ex(obj_plat_player))
121
                        {
122
                            dmgwriter.x = trg.x;
123
                            dmgwriter.y = trg.y;
124
                            dmgwriter.ystart = trg.y;
125
                            dmgwriter.depth = trg.depth - 100;
126
                            if (i_ex(obj_plat_player))
127
                            {
128
                                dmgwriter.depth = 1650;
129
                                if (obj_plat_player.dashing)
130
                                    dmgwriter.slidespeedx = obj_plat_player.hspeed;
131
                            }
132
                            if (variable_instance_exists(trg, "onrotatingtower") && trg.onrotatingtower == true)
133
                                dmgwriter.x = camerax() + (camerawidth() / 2);
134
                        }
135
                        else if (instance_exists(global.charinstance[target]))
136
                        {
137
                            dmgwriter.x = global.charinstance[target].x;
138
                            dmgwriter.y = (global.charinstance[target].y + global.charinstance[target].myheight) - 24;
139
                        }
140
                    }
141
                }
142
                if (global.hp[global.char[target]] < 1)
143
                    global.hp[global.char[target]] = 1;
144
            }
145
        }
146
        target = remtarget;
147
        global.inv = global.invc * 40;
148
    }
149
}