Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_damage_determination_boss

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

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