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