Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_damage_determination_trial

(view raw script w/o annotations or w/e)
1
function scr_damage_determination_trial
scr_damage_determination_trial

function scr_damage_determination_trial(arg0) { switch (arg0) { case "Gun Single": global.attacking_damage_stat_betrayal = global.current_hp_enemy; global.attacking_damage_stat_critical = 100; if (shot_type == "medium") global.attacking_damage_stat = 50; else if (shot_type == "weak") global.attacking_damage_stat = 30; break; case "Gun Multi": global.attacking_damage_stat_betrayal = global.current_hp_enemy; global.attacking_damage_stat_critical = 100 * circle_count; b = 0; var st_temp = shot_total; while (st_temp > 3) b += 100; switch (st_temp) { case 3: b += 100; break; case 2: b += 50; break; default: b += 30; } global.attacking_damage_stat = b; break; case "Revolver Single": global.attacking_damage_stat_betrayal = global.current_hp_enemy; global.attacking_damage_stat_critical = 140; r = random_range(0, 2); c = 0; switch (shot_type) { case "strong": b = 60; break; case "medium": b = 40; break; default: b = 0; } var st_temp; for (st_temp = shot_total_pre; st_temp > 3; st_temp -= 3) c += 16; switch (st_temp) { case 3: c += 16; break; case 2: c += 8; break; default: c += 0; } global.attacking_damage_stat = b + c; break; case "Revolver Multi": global.attacking_damage_stat_betrayal = global.current_hp_enemy; global.attacking_damage_stat_critical = (60 * circle_count) + (80 * circle_count); r = random_range(0, 2); b = 0; c = 0; var st_temp; for (st_temp = shot_total; st_temp > 3; st_temp -= 3) b += 60; switch (st_temp) { case 3: b += 60; break; case 2: b += 40; break; default: b += 0; } for (st_temp = shot_total_pre; st_temp > 3; st_temp -= 3) c += (16 * circle_count); switch (st_temp) { case 3: c += (16 * circle_count); break; case 2: c += (8 * circle_count); break; default: c += 0; } global.attacking_damage_stat = b + c; break; default: global.attacking_damage_stat_betrayal = global.current_hp_enemy; ...
(arg0)
2
{
3
    switch (arg0)
4
    {
5
        case "Gun Single":
6
            global.attacking_damage_stat_betrayal = global.current_hp_enemy;
7
            global.attacking_damage_stat_critical = 100;
8
            if (shot_type == "medium")
9
                global.attacking_damage_stat = 50;
10
            else if (shot_type == "weak")
11
                global.attacking_damage_stat = 30;
12
            break;
13
        case "Gun Multi":
14
            global.attacking_damage_stat_betrayal = global.current_hp_enemy;
15
            global.attacking_damage_stat_critical = 100 * circle_count;
16
            b = 0;
17
            var st_temp = shot_total;
18
            while (st_temp > 3)
19
                b += 100;
20
            switch (st_temp)
21
            {
22
                case 3:
23
                    b += 100;
24
                    break;
25
                case 2:
26
                    b += 50;
27
                    break;
28
                default:
29
                    b += 30;
30
            }
31
            global.attacking_damage_stat = b;
32
            break;
33
        case "Revolver Single":
34
            global.attacking_damage_stat_betrayal = global.current_hp_enemy;
35
            global.attacking_damage_stat_critical = 140;
36
            r = random_range(0, 2);
37
            c = 0;
38
            switch (shot_type)
39
            {
40
                case "strong":
41
                    b = 60;
42
                    break;
43
                case "medium":
44
                    b = 40;
45
                    break;
46
                default:
47
                    b = 0;
48
            }
49
            var st_temp;
50
            for (st_temp = shot_total_pre; st_temp > 3; st_temp -= 3)
51
                c += 16;
52
            switch (st_temp)
53
            {
54
                case 3:
55
                    c += 16;
56
                    break;
57
                case 2:
58
                    c += 8;
59
                    break;
60
                default:
61
                    c += 0;
62
            }
63
            global.attacking_damage_stat = b + c;
64
            break;
65
        case "Revolver Multi":
66
            global.attacking_damage_stat_betrayal = global.current_hp_enemy;
67
            global.attacking_damage_stat_critical = (60 * circle_count) + (80 * circle_count);
68
            r = random_range(0, 2);
69
            b = 0;
70
            c = 0;
71
            var st_temp;
72
            for (st_temp = shot_total; st_temp > 3; st_temp -= 3)
73
                b += 60;
74
            switch (st_temp)
75
            {
76
                case 3:
77
                    b += 60;
78
                    break;
79
                case 2:
80
                    b += 40;
81
                    break;
82
                default:
83
                    b += 0;
84
            }
85
            for (st_temp = shot_total_pre; st_temp > 3; st_temp -= 3)
86
                c += (16 * circle_count);
87
            switch (st_temp)
88
            {
89
                case 3:
90
                    c += (16 * circle_count);
91
                    break;
92
                case 2:
93
                    c += (8 * circle_count);
94
                    break;
95
                default:
96
                    c += 0;
97
            }
98
            global.attacking_damage_stat = b + c;
99
            break;
100
        default:
101
            global.attacking_damage_stat_betrayal = global.current_hp_enemy;
102
            global.attacking_damage_stat_critical = 100;
103
            global.attacking_damage_stat = round(-((x - 53) * (x - 585)) / 1415.12);
104
    }
105
    if (global.attacking_damage_cap >= 0)
106
    {
107
        if (global.attacking_damage_stat > global.attacking_damage_cap)
108
            global.attacking_damage_stat = global.attacking_damage_cap;
109
        if (global.attacking_damage_stat_critical > global.attacking_damage_cap)
110
            global.attacking_damage_stat_critical = global.attacking_damage_cap;
111
    }
112
    var boss_mini = global.boss_mini;
113
    if (button_pressed == true)
114
    {
115
        if (global.enemy_sparing == true && global.enemy_vulnerable == true)
116
        {
117
            global.last_hp_enemy = global.current_hp_enemy;
118
            global.current_hp_enemy = 0;
119
            global.enemy_betrayed = true;
120
            damage_type = "betrayed";
121
            if (boss_mini == true)
122
                instance_create(global.enemy_damage_x, global.enemy_damage_y, obj_text_damage_count);
123
            else
124
                instance_create(319, 120, obj_text_damage_count);
125
            audio_play_sound(snd_monster_damage_hit_critical, 20, false);
126
        }
127
        else if (global.enemy_vulnerable == true)
128
        {
129
            if ((arg0 == "Knife Single" && x == 319) || ((arg0 == "Gun Single" || arg0 == "Revolver Single") && shot_type == "strong") || ((arg0 == "Gun Multi" || arg0 == "Revolver Multi") && shot_total == (circle_count * 3)) || global.current_hp_enemy <= global.attacking_damage_stat_critical)
130
            {
131
                global.last_hp_enemy = global.current_hp_enemy;
132
                global.current_hp_enemy -= global.attacking_damage_stat_critical;
133
                damage_type = "critical";
134
                if (boss_mini == true)
135
                    instance_create(global.enemy_damage_x, global.enemy_damage_y, obj_text_damage_count);
136
                else
137
                    instance_create(319, 120, obj_text_damage_count);
138
                audio_play_sound(snd_monster_damage_hit_critical, 20, false);
139
            }
140
            else
141
            {
142
                global.last_hp_enemy = global.current_hp_enemy;
143
                global.current_hp_enemy -= global.attacking_damage_stat;
144
                damage_type = "normal";
145
                if (boss_mini == true)
146
                    instance_create(global.enemy_damage_x, global.enemy_damage_y, obj_text_damage_count);
147
                else
148
                    instance_create(319, 120, obj_text_damage_count);
149
                audio_play_sound(snd_monster_damage_hit, 20, false);
150
            }
151
        }
152
        else if (boss_mini == true)
153
        {
154
            instance_create(global.enemy_damage_x, global.enemy_damage_y, obj_text_miss);
155
        }
156
        else
157
        {
158
            instance_create(319, 120, obj_text_miss);
159
        }
160
    }
161
    else if (boss_mini == true)
162
    {
163
        instance_create(global.enemy_damage_x, global.enemy_damage_y, obj_text_miss);
164
    }
165
    else
166
    {
167
        instance_create(319, 120, obj_text_miss);
168
    }
169
    instance_create(0, 0, obj_battle_boss_attacking_code);
170
    if (instance_exists(obj_text_damage_count))
171
    {
172
        if (boss_mini == true)
173
        {
174
            instance_create(obj_text_damage_count.x - 52, obj_text_damage_count.y + 26, obj_battle_hp_current_boss_attacking_mini);
175
            instance_create(obj_text_damage_count.x - 52, obj_text_damage_count.y + 26, obj_battle_hp_previous_boss_attacking_mini);
176
            instance_create(obj_text_damage_count.x - 52, obj_text_damage_count.y + 26, obj_battle_hp_max_boss_attacking_mini);
177
        }
178
        else
179
        {
180
            instance_create(192, 152, obj_battle_hp_current_boss_attacking);
181
            instance_create(192, 152, obj_battle_hp_previous_boss_attacking);
182
            instance_create(192, 152, obj_battle_hp_max_boss_attacking);
183
        }
184
    }
185
    scr_determine_can_display_damage_ui
scr_determine_can_display_damage_ui

function scr_determine_can_display_damage_ui(arg0) { hp_ui_alpha = 1; damage_ui_alpha = 1; miss_ui_alpha = 1; if (arg0 == 1) { var game_mode = global.game_mode; var battle_enemy_name = global.battle_enemy_name; if (global.game_mode == "customs") { switch (battle_enemy_name) { default: } } else if (global.game_mode == "yellow") { switch (battle_enemy_name) { case "dummy training pacifist": hp_ui_alpha = 0; damage_ui_alpha = 0; break; default: } } } if (arg0 == 2) { var game_mode = global.game_mode; var battle_enemy_name = global.battle_enemy_name_2; if (global.game_mode == "customs") { switch (battle_enemy_name) { default: } } else if (global.game_mode == "yellow") { switch (battle_enemy_name) { default: } } } if (arg0 == 3) { var game_mode = global.game_mode; var battle_enemy_name = global.battle_enemy_name_3; if (global.game_mode == "customs") { switch (battle_enemy_name) { default: } } else if (global.game_mode == "yellow") { switch (battle_enemy_name) { default: } } } if (instance_exists(obj_battle_hp_enemy_attacking_parent)) { with (obj_battle_hp_enemy_attacking_parent) image_alpha = obj_target_bar_battle.hp_ui_alpha; } if (instance_exists(obj_text_damage_count)) { with (obj_text_damage_count) image_alpha = obj_target_bar_battle.damage_ui_alpha; } if (instance_exists(obj_text_miss)) { with (obj_text_miss) image_alpha = obj_target_bar_battle.miss_ui_alpha; } }
(1);
186
    if (global.current_hp_enemy <= global.attacking_damage_stat_critical && instance_exists(obj_text_damage_count))
187
        global.enemy_low_hp = true;
188
    if (instance_exists(obj_text_damage_count))
189
        script_execute(scr_determine_hit_special_effect_boss);
190
    if (instance_exists(obj_text_fighting_parent))
191
        script_execute(scr_determine_attack_bonus);
192
}