Deltarune script viewer

← back to main script listing

gml_Object_o_boxingcontroller_Collision_o_boxing_hitbox

(view raw script w/o annotations or w/e)
1
if (dead == 1)
2
    return;
3
if (dead > 0 && o_boxingcontroller.wireframe_boxing == 1)
4
    return;
5
if (other.baseball == 1 && other.maker_id.y < c && punchcon > 0 && punchcon <= 4)
6
    return;
7
if (other.baseball == 1 && invincible == 1)
8
    return;
9
if (other.baseball == 1 && other.graze_only == 0)
10
{
11
    with (other)
12
        instance_destroy()
13
}
14
if (other.graze_only == 0)
15
{
16
    hit_me = 1
17
    if (ducking == 1 && other.hit_ducking == 0)
18
        hit_me = 0
19
    if (dodging == 1 && other.hit_dodging == 0)
20
        hit_me = 0
21
    if (jumping == 1 && other.hit_jumping == 0)
22
        hit_me = 0
23
    if (invincible == 1)
24
        hit_me = 0
25
    if (hit_me == 1)
26
    {
27
        event_user(2)
28
        times_hit_by_boss += 1
29
        with (o_boxinggraze)
30
            tpgain = 0
31
        if (wireframe_boxing == 0)
32
        {
33
            if (other.final_attack == 1)
34
            {
35
                if (global.hp[1] <= 10)
36
                    global.hp[1] -= 10
37
                else if (defend == 0)
38
                    global.hp[1] -= floor(global.hp[1] / 2)
39
                else
40
                    global.hp[1] -= floor(global.hp[1] / 2 * 0.75)
41
            }
42
            else
43
            {
44
                var damage_reduction_in_turn = 1
45
                var final_damage_amount = 0
46
                if (global.flag[526 encount_first_tasq] < 5)
47
                {
48
                    if (damagetakenthisturn < 60)
49
                        damage_reduction_in_turn = 1
50
                    else if (damagetakenthisturn >= 60)
51
                        damage_reduction_in_turn = 0.6
52
                    else if (damagetakenthisturn >= 120)
53
                        damage_reduction_in_turn = 0.3
54
                }
55
                if (global.flag[526 encount_first_tasq] >= 5 && global.flag[526 encount_first_tasq] < 7)
56
                {
57
                    if (damagetakenthisturn < 40)
58
                        damage_reduction_in_turn = 1
59
                    else if (damagetakenthisturn >= 40)
60
                        damage_reduction_in_turn = 0.6
61
                    else if (damagetakenthisturn >= 80)
62
                        damage_reduction_in_turn = 0.3
63
                }
64
                if (global.flag[526 encount_first_tasq] >= 7)
65
                {
66
                    if (damagetakenthisturn < 30)
67
                        damage_reduction_in_turn = 1
68
                    else if (damagetakenthisturn >= 30)
69
                        damage_reduction_in_turn = 0.6
70
                    else if (damagetakenthisturn >= 50)
71
                        damage_reduction_in_turn = 0.3
72
                }
73
                if (defend == 0)
74
                    final_damage_amount = floor(other.damage * damage_reduction_in_turn)
75
                else
76
                    final_damage_amount = floor(other.damage * 0.75 * damage_reduction_in_turn)
77
                if (final_damage_amount < 10)
78
                    final_damage_amount = 10
79
                damagetakenthisturn += final_damage_amount
80
                global.hp[1] -= final_damage_amount
81
            }
82
            health_count = global.hp[1]
83
            health_count_max = global.maxhp[1]
84
        }
85
        else
86
            health_count -= other.damage
87
        if (health_count <= 0 && dead == 0)
88
        {
89
            health_count = 0
90
            dead = 0.5
91
        }
92
        if (global.hp[1] < 1)
93
            event_user(3)
94
        if (other.kick == 1 && wireframe_boxing == 1)
95
        {
96
            failed_kick_tutorial_counter++
97
            other.has_tutorial_kick_hit_player = 1
98
        }
99
        if (other.kick == 1 && wireframe_boxing == 0)
100
            o_boxingqueen.playerhitbykick = 1
101
        beat_phase1_no_damage_taken_check = 1
102
        beat_phase2_no_damage_taken_check = 1
103
        phase3_hit_check = 0
104
        with (o_boxingqueen)
105
            attack_succeeded = 1
106
        drawflip = other.hit_direction
107
        if (o_boxingcontroller.wireframe_boxing == 0)
108
        {
109
            d = instance_create(0, 0, obj_shake)
110
            d.shakex = ceil(2)
111
            d.shakey = ceil(2)
112
        }
113
        hit_fx = instance_create((x - 20 + irandom(40)), (y - 80 - irandom(40)), obj_boxing_hit_fx)
114
        with (hit_fx)
115
            event_user(0)
116
        hit_fx = instance_create((x - 20 + irandom(40)), (y - 80 - irandom(40)), obj_boxing_hit_fx)
117
        with (hit_fx)
118
            event_user(0)
119
        hit_fx = instance_create((x - 20 + irandom(40)), (y - 80 - irandom(40)), obj_boxing_hit_fx)
120
        with (hit_fx)
121
            event_user(0)
122
        if (other.give_hurt > 0)
123
            hurt_length = other.give_hurt
124
        if (other.give_invincibility > 0)
125
        {
126
            invincible = 1
127
            invincibility_timer = (-other.give_invincibility)
128
        }
129
    }
130
}