Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_martlet_final_attack_controller_Other_10

(view raw script w/o annotations or w/e)
1
var hp_percentage = global.current_hp_enemy / global.max_hp_enemy
2
switch fmartlet_event_lowhp
3
{
4
    case 0:
5
        if (hp_percentage <= 0.75)
6
        {
7
            fmartlet_event_lowhp = 1
8
            global.attack_cycle = 30
9
            return;
10
        }
11
        break
12
    case 1:
13
        if (hp_percentage <= 0.5)
14
        {
15
            fmartlet_event_lowhp = 2
16
            global.attack_cycle = 31
17
            return;
18
        }
19
        break
20
    case 2:
21
        if (hp_percentage <= 0.3)
22
        {
23
            fmartlet_event_lowhp = 3
24
            global.attack_cycle = 32
25
            return;
26
        }
27
        break
28
    case 3:
29
        if (hp_percentage <= 0.15)
30
        {
31
            fmartlet_event_lowhp = 4
32
            global.attack_cycle = 33
33
            return;
34
        }
35
        break
36
}
37
38
if (ds_list_size(fmartlet_atpool) == 0)
39
{
40
    event_user(1)
41
    var random_pos = irandom(ds_list_size(fmartlet_sppool) - 1)
42
    var new_attack = ds_list_find_value(fmartlet_sppool, random_pos)
43
    global.attack_cycle = new_attack
44
    ds_list_delete(fmartlet_sppool, random_pos)
45
    if (ds_list_size(fmartlet_sppool) == 0)
46
        event_user(2)
47
    return;
48
}
49
random_pos = irandom(ds_list_size(fmartlet_atpool) - 1)
50
new_attack = ds_list_find_value(fmartlet_atpool, random_pos)
51
global.attack_cycle = new_attack
52
ds_list_delete(fmartlet_atpool, random_pos)