Deltarune script viewer

← back to main script listing

gml_Object_obj_heroparent_ch1_Draw_0

(view raw script w/o annotations or w/e)
1
if (global.hp[global.char[myself]] > 0)
2
{
3
    if (global.myfight == 3 && global.faceaction[myself] == 6)
4
        state = 6;
5
    if (state == 0 && hurt == 0)
6
    {
7
        acttimer = 0;
8
        thissprite = idlesprite;
9
        if (global.faceaction[myself] == 1)
10
            thissprite = attackreadysprite;
11
        if (global.faceaction[myself] == 3)
12
            thissprite = itemreadysprite;
13
        if (global.faceaction[myself] == 2)
14
            thissprite = spellreadysprite;
15
        if (global.faceaction[myself] == 6)
16
            thissprite = actreadysprite;
17
        if (global.charcond[myself] == 5)
18
        {
19
            thissprite = defeatsprite;
20
            global.faceaction[myself] = 9;
21
        }
22
        if (global.faceaction[myself] == 4)
23
        {
24
            thissprite = defendsprite;
25
            index = defendtimer;
26
            if (defendtimer < defendframes)
27
                defendtimer += 0.5;
28
        }
29
        else
30
        {
31
            defendtimer = 0;
32
            index = siner / 5;
33
        }
34
        siner += 1;
35
    }
36
    if (state == 1 && hurt == 0)
37
    {
38
        siner += 1;
39
        if (attacked == 0)
40
        {
41
            snd_stop_ch1(snd_laz_c_ch1);
42
            if (object_index == obj_herokris_ch1)
43
                snd_play_ch1(snd_laz_c_ch1);
44
            if (object_index == obj_heroralsei_ch1)
45
            {
46
                ls = snd_play_ch1(snd_laz_c_ch1);
47
                snd_pitch_ch1(ls, 1.15);
48
            }
49
            if (object_index == obj_herosusie_ch1)
50
            {
51
                ls = snd_play_ch1(snd_laz_c_ch1);
52
                snd_pitch_ch1(ls, 0.9);
53
            }
54
            if (points == 150)
55
            {
56
                snd_stop_ch1(snd_criticalswing_ch1);
57
                snd_play_ch1(snd_criticalswing_ch1);
58
                repeat (3)
59
                {
60
                    anim = instance_create_ch1(x + mywidth + random(50), y + 30 + random(30), obj_afterimage_ch1);
61
                    anim.sprite_index = spr_lightfairy_ch1;
62
                    anim.image_speed = 0.25;
63
                    anim.depth = -20;
64
                    anim.image_xscale = 2;
65
                    anim.image_yscale = 2;
66
                    anim.hspeed = 2 + random(4);
67
                    anim.friction = -0.25;
68
                }
69
            }
70
            attacked = 1;
71
            alarm[1] = 10;
gml_Object_obj_heroparent_ch1_Alarm_1.gml

global.faceaction[myself] = 0; scr_retarget_ch1(myself); if (cancelattack == 0) { dm = instance_create_ch1(global.monsterx[global.chartarget[myself]], (global.monstery[global.chartarget[myself]] - (global.hittarget[global.chartarget[myself]] * 20)) + 20, obj_dmgwriter_ch1); dm.type = char - 1; dm.delay = 8; damage = round(((global.battleat[myself] * points) / 20) - (global.monsterdf[global.chartarget[myself]] * 3)); if (global.monstertype[global.chartarget[myself]] == 19Susie (w/ Lancer)) damage = ceil(damage * 0.3); if (damage < 0) damage = 0; if (damage == 0) { dm.delay = 2; with (global.monsterinstance[global.chartarget[myself]]) { if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0; state = 4; } } } dm.damage = damage; global.hittarget[global.chartarget[myself]] += 1; global.monsterhp[global.chartarget[myself]] -= damage; if (is_auto_susie == 1 && global.monsterhp[global.chartarget[myself]] <= 0) { with (global.chartarget[myself]) global.flag[51 + myself] = 5; } if (damage > 0) { if (global.monstertype[0] != 20JEVIL) scr_tensionheal_ch1(round(points / 10)); if (global.monstertype[0] == 20JEVIL) scr_tensionheal_ch1(round(points / 15)); attack = instance_create_ch1(global.monsterx[global.chartarget[myself]] + random(6), global.monstery[global.chartarget[myself]] + random(6), obj_basicattack_ch1); if (object_index == obj_herosusie_ch1) { attack.sprite_index = spr_attack_mash2_ch1; attack.image_speed = 0.5; attack.maxindex = 4; snd_play_ch1(snd_impact_ch1); instance_create_ch1(0, 0, obj_shake_ch1); } if (object_index == obj_heroralsei_ch1) { attack.sprite_index = spr_attack_slap1_ch1; attack.maxindex = 4; attack.image_speed = 0.5; } if (points == 150) { attack.image_xscale = 2.5; attack.image_yscale = 2.5; } with (global.monsterinstance[global.chartarget[myself]]) { shakex = 9; state = 3; hurttimer = 30; } if (instance_exists(global.monsterinstance[global.chartarget[myself]])) global.monsterinstance[global.chartarget[myself]].hurtamt = damage; } if (global.monsterhp[global.chartarget[myself]] <= 0) { with (global.monsterinstance[global.chartarget[myself]]) scr_monsterdefeat_ch1(); } }
72
        }
73
        if (attacktimer < attackframes)
74
            image_index = attacktimer;
75
        else
76
            image_index = attackframes;
77
        thissprite = attacksprite;
78
        index = image_index;
79
        attacktimer += attackspeed;
80
    }
81
    if (state == 2 && hurt == 0)
82
    {
83
        siner += 1;
84
        if (itemed == 0)
85
        {
86
            itemed = 1;
87
            alarm[4] = 15;
gml_Object_obj_heroparent_ch1_Alarm_4.gml

global.faceaction[myself] = 0; if (scr_monsterpop_ch1() > 0) scr_spell_ch1(global.charspecial[myself], myself); state = 0; attacktimer = 0;
88
        }
89
        if (attacktimer < spellframes)
90
            image_index = attacktimer;
91
        else
92
            image_index = spellframes;
93
        if (scr_monsterpop_ch1
scr_monsterpop_ch1

function scr_monsterpop_ch1() { return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
94
            attacktimer = 0;
95
        thissprite = spellsprite;
96
        index = image_index;
97
        attacktimer += 0.5;
98
    }
99
    if (state == 4 && hurt == 0)
100
    {
101
        siner += 1;
102
        if (itemed == 0)
103
        {
104
            itemed = 1;
105
            alarm[4] = 15;
gml_Object_obj_heroparent_ch1_Alarm_4.gml

global.faceaction[myself] = 0; if (scr_monsterpop_ch1() > 0) scr_spell_ch1(global.charspecial[myself], myself); state = 0; attacktimer = 0;
106
        }
107
        if (attacktimer < itemframes)
108
            image_index = attacktimer;
109
        else
110
            image_index = itemframes;
111
        if (scr_monsterpop_ch1
scr_monsterpop_ch1

function scr_monsterpop_ch1() { return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
112
            attacktimer = 0;
113
        index = image_index;
114
        thissprite = itemsprite;
115
        attacktimer += 0.5;
116
    }
117
    if (state == 6)
118
    {
119
        if (global.myfight == 3)
120
        {
121
            if (acttimer < actframes)
122
                acttimer += 0.5;
123
        }
124
        else
125
        {
126
            acttimer += 0.5;
127
        }
128
        thissprite = actsprite;
129
        index = acttimer;
130
        if (acttimer >= actreturnframes)
131
        {
132
            acttimer = 0;
133
            state = 0;
134
            global.faceaction[myself] = 0;
135
        }
136
    }
137
    if (state == 7)
138
    {
139
        hurt = 0;
140
        hurttimer = 0;
141
        if (victoryanim < victoryframes)
142
        {
143
            thissprite = victorysprite;
144
            index = victoryanim;
145
            victoryanim += 0.334;
146
        }
147
        else
148
        {
149
            thissprite = normalsprite;
150
            index = 0;
151
        }
152
    }
153
    if (hurt == 1)
154
    {
155
        hurtindex = hurttimer / 2;
156
        if (hurtindex > 2)
157
            hurtindex = 2;
158
        if (global.charcond[myself] == 5)
159
        {
160
            global.faceaction[myself] = 5;
161
            global.charmove[myself] = 1;
162
            global.charcond[myself] = 0;
163
        }
164
        if (global.faceaction[myself] == 0)
165
            global.faceaction[myself] = 5;
166
        if (global.faceaction[myself] != 4)
167
        {
168
            specdraw = 1;
169
            draw_sprite_ext(hurtsprite, hurtindex, (x - 20) + (hurtindex * 10), y, 2, 2, 0, image_blend, image_alpha);
170
        }
171
        else
172
        {
173
            specdraw = 1;
174
            thissprite = defendsprite;
175
            index = defendtimer;
176
            draw_sprite_ext(defendsprite, defendtimer, (x - 20) + (hurtindex * 10), y, 2, 2, 0, image_blend, image_alpha);
177
        }
178
        if (hurttimer > 15)
179
        {
180
            hurttimer = 0;
181
            hurt = 0;
182
            if (global.faceaction[myself] == 5)
183
                global.faceaction[myself] = 0;
184
        }
185
        hurttimer += 1;
186
    }
187
}
188
else
189
{
190
    global.charcond[myself] = 0;
191
    hurttimer = 0;
192
    hurt = 0;
193
    thissprite = defeatsprite;
194
    index = 0;
195
    siner += 1;
196
}
197
if (specdraw == 0)
198
{
199
    sprite_index = thissprite;
200
    image_index = index;
201
    draw_sprite_ext(thissprite, index, x, y, 2, 2, 0, image_blend, image_alpha);
202
    if (flash == 1)
203
    {
204
        fsiner += 1;
205
        d3d_set_fog_ch1(true, 16777215, 0, 1);
206
        draw_sprite_ext(thissprite, index, x, y, 2, 2, 0, image_blend, (-cos(fsiner / 5) * 0.4) + 0.6);
207
        d3d_set_fog_ch1(false, 0, 0, 0);
208
    }
209
}
210
specdraw = 0;
211
if (becomeflash == 0)
212
    flash = 0;
213
if (global.targeted[myself] == 1)
214
{
215
    if (global.mnfight == 1)
216
        draw_sprite_ext(spr_chartarget_ch1, siner / 10, x, y, 2, 2, 0, c_white, 1);
217
}
218
else if (combatdarken == 1 && instance_exists(obj_darkener_ch1))
219
{
220
    if (darkify == 1)
221
    {
222
        if (darkentimer < 15)
223
            darkentimer += 1;
224
        image_blend = merge_color(c_white, c_black, darkentimer / 30);
225
    }
226
}
227
if (darkify == 0)
228
{
229
    if (darkentimer > 0)
230
        darkentimer -= 3;
231
    image_blend = merge_color(c_white, c_black, darkentimer / 30);
232
}
233
becomeflash = 0;