Deltarune (Chapter 2) 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
    exit;
3
if (dead > 0 && o_boxingcontroller.wireframe_boxing == 1)
4
    exit;
5
if (other.baseball == 1 && other.maker_id.y < c && punchcon > 0 && punchcon <= 4)
6
    exit;
7
if (other.baseball == 1 && invincible == 1)
8
    exit;
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
        {
87
            health_count -= other.damage;
88
        }
89
        if (health_count <= 0 && dead == 0)
90
        {
91
            health_count = 0;
92
            dead = 0.5;
93
        }
94
        if (global.hp[1] < 1)
95
            event_user(3);
96
        if (other.kick == 1 && wireframe_boxing == 1)
97
        {
98
            failed_kick_tutorial_counter++;
99
            other.has_tutorial_kick_hit_player = 1;
100
        }
101
        if (other.kick == 1 && wireframe_boxing == 0)
102
            o_boxingqueen.playerhitbykick = 1;
103
        beat_phase1_no_damage_taken_check = 1;
104
        beat_phase2_no_damage_taken_check = 1;
105
        phase3_hit_check = 0;
106
        with (o_boxingqueen)
107
            attack_succeeded = 1;
108
        drawflip = other.hit_direction;
109
        if (o_boxingcontroller.wireframe_boxing == 0)
110
        {
111
            d = instance_create(0, 0, obj_shake);
112
            d.shakex = ceil(2);
113
            d.shakey = ceil(2);
114
        }
115
        hit_fx = instance_create((x - 20) + irandom(40), y - 80 - irandom(40), obj_boxing_hit_fx);
116
        with (hit_fx)
117
            event_user(0);
118
        hit_fx = instance_create((x - 20) + irandom(40), y - 80 - irandom(40), obj_boxing_hit_fx);
119
        with (hit_fx)
120
            event_user(0);
121
        hit_fx = instance_create((x - 20) + irandom(40), y - 80 - irandom(40), obj_boxing_hit_fx);
122
        with (hit_fx)
123
            event_user(0);
124
        if (other.give_hurt > 0)
125
            hurt_length = other.give_hurt;
126
        if (other.give_invincibility > 0)
127
        {
128
            invincible = 1;
129
            invincibility_timer = -other.give_invincibility;
130
        }
131
    }
132
}