Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_damage_determination_enemy_3

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

function scr_damage_determination_enemy_3(argument0) //gml_Script_scr_damage_determination_enemy_3 { switch argument0 { case "Gun Single": global.attacking_damage_stat_betrayal = global.current_hp_enemy_3 global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_attack - global.enemy_defense_stat_3 + r) * b) break case "Gun Multi": global.attacking_damage_stat_betrayal = global.current_hp_enemy_3 global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_3 + r) * (clamp(b, 1.5, 3))) break case "Revolver Single": global.attacking_damage_stat_betrayal = global.current_hp_enemy_3 global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_3 + r) * b) break case "Revolver Multi": global.attacking_damage_stat_betrayal = global.current_hp_enemy_3 global.attacking_damage_stat_critical_3 = 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_enemy_3
2
{
3
    switch argument0
4
    {
5
        case "Gun Single":
6
            global.attacking_damage_stat_betrayal = global.current_hp_enemy_3
7
            global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_attack - global.enemy_defense_stat_3 + r) * b)
22
            break
23
        case "Gun Multi":
24
            global.attacking_damage_stat_betrayal = global.current_hp_enemy_3
25
            global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_3 + r) * (clamp(b, 1.5, 3)))
44
            break
45
        case "Revolver Single":
46
            global.attacking_damage_stat_betrayal = global.current_hp_enemy_3
47
            global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_3 + r) * b)
78
            break
79
        case "Revolver Multi":
80
            global.attacking_damage_stat_betrayal = global.current_hp_enemy_3
81
            global.attacking_damage_stat_critical_3 = 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_3
117
            global.attacking_damage_stat_critical_3 = round((global.player_weapon_attack + global.player_weapon_modifier_attack + global.player_attack - global.enemy_defense_stat_3 + 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_3 + r) * b)
124
    }
125
126
    if (global.attacking_damage_cap_3 >= 0)
127
    {
128
        if (global.attacking_damage_stat > global.attacking_damage_cap_3)
129
            global.attacking_damage_stat = global.attacking_damage_cap_3
130
        if (global.attacking_damage_stat_critical_3 > global.attacking_damage_cap_3)
131
            global.attacking_damage_stat_critical_3 = global.attacking_damage_cap_3
132
    }
133
    if (global.attacking_damage_stat < 5)
134
        global.attacking_damage_stat = 5
135
    if (global.attacking_damage_stat_critical_3 < 5)
136
        global.attacking_damage_stat_critical_3 = 5
137
    if (button_pressed == true)
138
    {
139
        if (global.enemy_sparing_3 == true && global.enemy_vulnerable_3 == true)
140
        {
141
            global.last_hp_enemy_3 = global.current_hp_enemy_3
142
            global.current_hp_enemy_3 = 0
143
            global.enemy_betrayed_3 = true
144
            damage_type = "betrayed"
145
            instance_create(global.enemy_damage_x_3, global.enemy_damage_y_3, obj_text_damage_count)
146
            audio_play_sound(snd_monster_damage_hit_critical, 20, false)
147
        }
148
        else if (global.enemy_vulnerable_3 == true)
149
        {
150
            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_3 <= global.attacking_damage_stat_critical_3)
151
            {
152
                global.last_hp_enemy_3 = global.current_hp_enemy_3
153
                global.current_hp_enemy_3 -= global.attacking_damage_stat_critical_3
154
                damage_type = "critical"
155
                instance_create(global.enemy_damage_x_3, global.enemy_damage_y_3, obj_text_damage_count)
156
                audio_play_sound(snd_monster_damage_hit_critical, 20, false)
157
            }
158
            else
159
            {
160
                global.last_hp_enemy_3 = global.current_hp_enemy_3
161
                global.current_hp_enemy_3 -= global.attacking_damage_stat
162
                damage_type = "normal"
163
                instance_create(global.enemy_damage_x_3, global.enemy_damage_y_3, obj_text_damage_count)
164
                audio_play_sound(snd_monster_damage_hit, 20, false)
165
            }
166
        }
167
        else
168
            instance_create(global.enemy_damage_x_3, global.enemy_damage_y_3, obj_text_miss)
169
    }
170
    else
171
        instance_create(global.enemy_damage_x_3, global.enemy_damage_y_3, obj_text_miss)
172
    instance_create(0, 0, obj_battle_enemy_attacking_code_3)
173
    if instance_exists(obj_text_damage_count)
174
    {
175
        instance_create((obj_text_damage_count.x - 52), (obj_text_damage_count.y + 26), obj_battle_hp_current_enemy_attacking_3)
176
        instance_create((obj_text_damage_count.x - 52), (obj_text_damage_count.y + 26), obj_battle_hp_previous_enemy_attacking_3)
177
        instance_create((obj_text_damage_count.x - 52), (obj_text_damage_count.y + 26), obj_battle_hp_max_enemy_attacking_3)
178
    }
179
    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 } }
(3)
180
    if (global.current_hp_enemy_3 <= global.attacking_damage_stat_critical_3 && instance_exists(obj_text_damage_count))
181
        global.enemy_low_hp_3 = true
182
    if instance_exists(obj_text_fighting_parent)
183
        script_execute(gml_Script_scr_determine_attack_bonus)
184
}