Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_heroparent_Other_10

(view raw script w/o annotations or w/e)
1
if (finishattacktimer > 0)
2
{
3
    finishattacktimer--;
4
    if (finishattacktimer == 0)
5
    {
6
        global.faceaction[myself] = 0;
7
        
scr_retarget
scr_retarget

function
scr_retarget(arg0)
{ thistarget = global.chartarget[arg0]; cancelattack = 0; if (thistarget == 0) { if (global.monster[0] == 0) thistarget = 1; } if (thistarget == 1) { if (global.monster[1] == 0) thistarget = 2; } if (thistarget == 2) { if (global.monster[2] == 0) thistarget = 3; if (thistarget == 3 && global.monster[0] == 1) thistarget = 0; if (thistarget == 3 && global.monster[1] == 1) thistarget = 1; if (thistarget == 3) cancelattack = 1; } global.chartarget[arg0] = thistarget; }
(myself);
8
        var knightblock = 0;
9
        if (global.chapter == 3 && i_ex(obj_knight_enemy) && obj_knight_enemy.blocking == 1 && obj_knight_enemy.damagereduction < 0.1)
10
            knightblock = 1;
11
        if (cancelattack == 0)
12
        {
13
            dm = instance_create(global.monsterx[global.chartarget[myself]], (global.monstery[global.chartarget[myself]] - (global.hittarget[global.chartarget[myself]] * 20)) + 20, obj_dmgwriter);
14
            dm.type = char - 1;
15
            if (char == 4)
16
                dm.type = 6;
17
            dm.delay = 8;
18
            damage = round(((global.battleat[myself] * points) / 20) - (global.monsterdf[global.chartarget[myself]] * 3));
19
            if (global.chapter == 3 && i_ex(obj_knight_enemy))
20
            {
21
                damage = ceil(damage * obj_knight_enemy.damagereduction);
22
                if (object_index == obj_herokris)
23
                {
24
                    if (global.hp[2] < 0 && global.hp[3] < 0)
25
                        damage *= 2;
26
                    else if (global.hp[2] < 0 || global.hp[3] < 0)
27
                        damage *= 1;
28
                    else
29
                        damage = round(damage * 0.5);
30
                }
31
            }
32
            if (global.monstertype[global.chartarget[myself]] == 19Susie (w/ Lancer))
33
                damage = ceil(damage * 0.3);
34
            if (i_ex(obj_tenna_enemy) && normalsprite == spr_krisr_dark)
35
            {
36
                if (obj_tenna_enemy.didkrisdoswordroute == true)
37
                    damage = ceil(damage * 3);
38
                if (obj_tenna_enemy.didkrisdoswordroute == false)
39
                    damage = ceil(damage * 0.5);
40
            }
41
            if (damage < 0)
42
                damage = 0;
43
            if (damage == 0)
44
            {
45
                dm.delay = 2;
46
                with (global.monsterinstance[global.chartarget[myself]])
47
                {
48
                    if (hurttimer <= 15 && candodge == 1)
49
                    {
50
                        dodgetimer = 0;
51
                        state = 4;
52
                    }
53
                }
54
            }
55
            dm.damage = damage;
56
            global.hittarget[global.chartarget[myself]] += 1;
57
            global.monsterhp[global.chartarget[myself]] -= damage;
58
            if (global.monsterhp[global.chartarget[myself]] <= 0)
59
                global.monster[global.chartarget[myself]] = 0;
60
            if (is_auto_susie == 1 && global.monsterhp[global.chartarget[myself]] <= 0)
61
            {
62
                with (global.chartarget[myself])
63
                    global.flag[51 + myself] = 5;
64
            }
65
            if (damage > 0)
66
            {
67
                if (global.monstertype[0] != 20JEVIL)
68
                    
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; if (global.chapter == 3 && i_ex(obj_gameshow_battlemanager)) obj_gameshow_battlemanager.tpgained += arg0; if (global.chapter == 3) { obj_battlecontroller.mercytotal += arg0; if (obj_battlecontroller.mercytotal < 0) obj_battlecontroller.mercytotal = 0; if (obj_battlecontroller.mercytotal >= 250) obj_battlecontroller.mercytotal = 250; } }
(round(points / 10));
69
                if (global.monstertype[0] == 20JEVIL)
70
                    
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; if (global.chapter == 3 && i_ex(obj_gameshow_battlemanager)) obj_gameshow_battlemanager.tpgained += arg0; if (global.chapter == 3) { obj_battlecontroller.mercytotal += arg0; if (obj_battlecontroller.mercytotal < 0) obj_battlecontroller.mercytotal = 0; if (obj_battlecontroller.mercytotal >= 250) obj_battlecontroller.mercytotal = 250; } }
(round(points / 15));
71
                if (knightblock == 1)
72
                    obj_knight_enemy.blockanim = 1;
73
                if (knightblock == 0)
74
                {
75
                    attack = instance_create(global.monsterx[global.chartarget[myself]] + random(6), global.monstery[global.chartarget[myself]] + random(6), obj_basicattack);
76
                    if (object_index == obj_herosusie)
77
                    {
78
                        attack.sprite_index = spr_attack_mash2;
79
                        attack.image_speed = 0.5;
80
                        attack.maxindex = 4;
81
                        snd_play(snd_impact);
82
                        instance_create(0, 0, obj_shake);
83
                    }
84
                    if (object_index == obj_heroralsei)
85
                    {
86
                        attack.sprite_index = spr_attack_slap1;
87
                        attack.maxindex = 4;
88
                        attack.image_speed = 0.5;
89
                    }
90
                    if (object_index == obj_heronoelle)
91
                    {
92
                        attack.sprite_index = spr_attack_slap2;
93
                        attack.maxindex = 4;
94
                        attack.image_speed = 0.5;
95
                    }
96
                    if (points == 150)
97
                    {
98
                        attack.image_xscale = 2.5;
99
                        attack.image_yscale = 2.5;
100
                    }
101
                    with (global.monsterinstance[global.chartarget[myself]])
102
                    {
103
                        shakex = 9;
104
                        state = 3;
105
                        hurttimer = 30;
106
                        if (global.chapter == 3 && i_ex(obj_knight_enemy) && damage >= 100)
107
                            obj_knight_enemy.stronghurtanim = true;
108
                    }
109
                }
110
                if (instance_exists(global.monsterinstance[global.chartarget[myself]]))
111
                    global.monsterinstance[global.chartarget[myself]].hurtamt = damage;
112
            }
113
        }
114
    }
115
}