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

var _temp_local_var_2, _temp_local_var_3, _temp_local_var_4, _temp_local_var_5, _temp_local_var_6; function scr_determine_can_display_damage_ui(argument0) //gml_Script_scr_determine_can_display_damage_ui { hp_ui_alpha = 1 damage_ui_alpha = 1 miss_ui_alpha = 1 if (argument0 == 1) { var game_mode = global.game_mode var battle_enemy_name = global.battle_enemy_name if (global.game_mode == "customs") var _temp_local_var_2 = battle_enemy_name 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 (argument0 == 2) { game_mode = global.game_mode battle_enemy_name = global.battle_enemy_name_2 if (global.game_mode == "customs") var _temp_local_var_3 = battle_enemy_name else if (global.game_mode == "yellow") var _temp_local_var_6 = battle_enemy_name } if (argument0 == 3) { game_mode = global.game_mode battle_enemy_name = global.battle_enemy_name_3 if (global.game_mode == "customs") var _temp_local_var_4 = battle_enemy_name else if (global.game_mode == "yellow") var _temp_local_var_5 = battle_enemy_name } 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)
182
    if (global.current_hp_enemy <= global.attacking_damage_stat_critical && instance_exists(obj_text_damage_count))
183
        global.enemy_low_hp = true
184
    if instance_exists(obj_text_damage_count)
185
        script_execute(gml_Script_scr_determine_hit_special_effect_boss)
186
    if instance_exists(obj_text_fighting_parent)
187
        script_execute(gml_Script_scr_determine_attack_bonus)
188
}