Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_battle_enemy_attack_eq_visualizer_Step_0

(view raw script w/o annotations or w/e)
1
if (live_call())
2
    return global.live_result;
3
if (!instance_exists(obj_dialogue_box_battle_transformation_any))
4
    exit;
5
switch (scene)
6
{
7
    case -1:
8
        for (var i = 0; i < eq_bar_number; i++)
9
        {
10
            eq_bar_height_target[i] = irandom_range(eq_bar_height_min, eq_bar_height_max);
11
            if (eq_bar_height_target[i] < eq_bar_collidable)
12
            {
13
                if (eq_bar_low_current < eq_bar_low_max)
14
                {
15
                    eq_bar_low_current += 1;
16
                }
17
                else
18
                {
19
                    eq_bar_hi_current += 1;
20
                    eq_bar_height_target[i] = irandom_range(eq_bar_collidable, eq_bar_height_max);
21
                }
22
            }
23
            else if (eq_bar_height_target[i] > eq_bar_collidable)
24
            {
25
                if (eq_bar_hi_current < eq_bar_hi_max)
26
                {
27
                    eq_bar_hi_current += 1;
28
                }
29
                else
30
                {
31
                    eq_bar_height_target[i] = irandom_range(eq_bar_height_min, eq_bar_collidable);
32
                    eq_bar_low_current += 1;
33
                }
34
            }
35
        }
36
        cutscene_advance();
37
        break;
38
    case 0:
39
    case 2:
40
    case 4:
41
    case 6:
42
        eq_bar_draw_warning_bars = false;
43
        cutscene_wait(0.1);
44
        break;
45
    case 1:
46
    case 3:
47
    case 5:
48
        if (eq_bar_draw_warning_bars == false)
49
        {
50
            eq_bar_draw_warning_bars = true;
51
            audio_play_sound(snd_bullet_warning, 1, 0);
52
        }
53
        cutscene_wait(0.1);
54
        break;
55
    case 7:
56
        cutscene_wait(0.2);
57
        break;
58
    case 8:
59
        if (cutscene_wait(0.6))
60
        {
61
            eq_bar_hi_current = 0;
62
            eq_bar_low_current = 0;
63
            scene = -1;
64
            if (attack_number_max > 1)
65
                attack_number_max -= 1;
66
            else
67
                instance_destroy();
68
            for (var i = 0; i < eq_bar_number; i++)
69
                eq_bar_height_target[i] = eq_bar_height_min;
70
        }
71
        break;
72
}
73
for (var i = 0; i < eq_bar_number; i++)
74
{
75
    var y_target;
76
    if (scene > 7)
77
        y_target = eq_bar_height_target[i];
78
    else
79
        y_target = eq_bar_height_min;
80
    eq_bar_height[i] = lerp(eq_bar_height[i], y_target, lerp_speed);
81
}
82
if (!instance_exists(obj_dialogue_box_battle_transformation_any))
83
    exit;
84
for (var i = 0; i < eq_bar_number; i++)
85
{
86
    var box = 3154;
87
    xx = box.bbox_left + 6 + ((i + 1) * eq_bar_gap) + (eq_bar_width * i);
88
    yy = box.bbox_bottom - 6;
89
    yy_2 = yy - eq_bar_height[i];
90
    if (instance_exists(obj_heart_battle_fighting_parent))
91
    {
92
        var soul = 2979;
93
        if (soul.vulnerable == true && rectangle_in_rectangle(soul.bbox_left, soul.bbox_top, soul.bbox_right, soul.bbox_bottom, xx, yy, xx + eq_bar_width, yy_2))
94
        {
95
            with (obj_heart_battle_fighting_parent)
96
            {
97
                collide_id = other;
98
                damage_number = collide_id.damage_number;
99
                event_user(1);
100
            }
101
        }
102
    }
103
}