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
            exit;
10
        }
11
        break;
12
    case 1:
13
        if (hp_percentage <= 0.5)
14
        {
15
            fmartlet_event_lowhp = 2;
16
            global.attack_cycle = 31;
17
            exit;
18
        }
19
        break;
20
    case 2:
21
        if (hp_percentage <= 0.3)
22
        {
23
            fmartlet_event_lowhp = 3;
24
            global.attack_cycle = 32;
25
            exit;
26
        }
27
        break;
28
    case 3:
29
        if (hp_percentage <= 0.15)
30
        {
31
            fmartlet_event_lowhp = 4;
32
            global.attack_cycle = 33;
33
            exit;
34
        }
35
        break;
36
}
37
if (ds_list_size(fmartlet_atpool) == 0)
38
{
39
    event_user(1);
40
    random_pos = irandom(ds_list_size(fmartlet_sppool) - 1);
41
    new_attack = ds_list_find_value(fmartlet_sppool, random_pos);
42
    global.attack_cycle = new_attack;
43
    ds_list_delete(fmartlet_sppool, random_pos);
44
    if (ds_list_size(fmartlet_sppool) == 0)
45
        event_user(2);
46
    exit;
47
}
48
var random_pos = irandom(ds_list_size(fmartlet_atpool) - 1);
49
var new_attack = ds_list_find_value(fmartlet_atpool, random_pos);
50
global.attack_cycle = new_attack;
51
ds_list_delete(fmartlet_atpool, random_pos);