Deltarune (Chapter 4) script viewer

← back to main script listing

gml_GlobalScript_scr_attackphase

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

function
scr_attackphase()
{ with (obj_battlecontroller) { techwon = 0; if (
scr_monsterpop() == 0)
techwon = 1; if (techwon == 1)
scr_wincombat();
if (techwon == 0) { for (__hiti = 0; __hiti < 3; __hiti++) global.hittarget[__hiti] = 0; fightphase = 1; global.charturn = 3; if (global.charaction[0] == 4 || global.charaction[0] == 2) fightphase = 0; if (global.charaction[1] == 4 || global.charaction[1] == 2) fightphase = 0; if (global.charaction[2] == 4 || global.charaction[2] == 2) fightphase = 0; if (global.myfight == 4) fightphase = 1; if (i_ex(obj_sound_of_justice_enemy) && obj_sound_of_justice_enemy.phase == 2) { if (global.charaction[0] == 1 && global.charaction[1] != 1) { if (obj_sound_of_justice_enemy.krisattackcount > 0) { global.myfight = -1; global.mnfight = 1; exit; } } if (global.charaction[0] == 1 && global.charaction[1] == 1) { if (obj_sound_of_justice_enemy.krisattackcount > 1) { global.myfight = -1; global.mnfight = 1; exit; } global.charaction[1] = 0; } if (global.charaction[0] != 1 && global.charaction[1] == 1) { global.myfight = -1; global.mnfight = 1; exit; } } if (fightphase == 1) { global.myfight = 1; instance_create(xx + 2, yy + 365, obj_attackpress); } else { global.myfight = 4; instance_create(0, 0, obj_spellphase); } } } }
()
2
{
3
    with (obj_battlecontroller)
4
    {
5
        techwon = 0;
6
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
7
            techwon = 1;
8
        if (techwon == 1)
9
            
scr_wincombat
scr_wincombat

function
scr_wincombat()
{ if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1) { global.myfight = 7; global.mnfight = -1; with (obj_battlecontroller) victory = 1; for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } } else { for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } global.encounterno = global.flag[60 dojo_next_encounter];
scr_encountersetup(global.encounterno);
global.flag[60 dojo_next_encounter] = 0; for (__j = 0; __j < 3; __j++) { if (global.monstertype[__j] != 0(None)) { _newmonster =
scr_monster_add(global.monstertype[__j], global.monsterinstancetype[__j]);
global.monsterinstance[_newmonster].x = camerax() + 800; global.monsterinstance[_newmonster].y = global.monstermakey[__j]; with (global.monsterinstance[_newmonster])
scr_move_to_point_over_time(global.monstermakex[myself], global.monstermakey[myself], 10);
} } global.myfight = 5; myfightreturntimer = 15; global.mnfight = -1; } }
();
10
        if (techwon == 0)
11
        {
12
            for (__hiti = 0; __hiti < 3; __hiti++)
13
                global.hittarget[__hiti] = 0;
14
            fightphase = 1;
15
            global.charturn = 3;
16
            if (global.charaction[0] == 4 || global.charaction[0] == 2)
17
                fightphase = 0;
18
            if (global.charaction[1] == 4 || global.charaction[1] == 2)
19
                fightphase = 0;
20
            if (global.charaction[2] == 4 || global.charaction[2] == 2)
21
                fightphase = 0;
22
            if (global.myfight == 4)
23
                fightphase = 1;
24
            if (i_ex(obj_sound_of_justice_enemy) && obj_sound_of_justice_enemy.phase == 2)
25
            {
26
                if (global.charaction[0] == 1 && global.charaction[1] != 1)
27
                {
28
                    if (obj_sound_of_justice_enemy.krisattackcount > 0)
29
                    {
30
                        global.myfight = -1;
31
                        global.mnfight = 1;
32
                        exit;
33
                    }
34
                }
35
                if (global.charaction[0] == 1 && global.charaction[1] == 1)
36
                {
37
                    if (obj_sound_of_justice_enemy.krisattackcount > 1)
38
                    {
39
                        global.myfight = -1;
40
                        global.mnfight = 1;
41
                        exit;
42
                    }
43
                    global.charaction[1] = 0;
44
                }
45
                if (global.charaction[0] != 1 && global.charaction[1] == 1)
46
                {
47
                    global.myfight = -1;
48
                    global.mnfight = 1;
49
                    exit;
50
                }
51
            }
52
            if (fightphase == 1)
53
            {
54
                global.myfight = 1;
55
                instance_create(xx + 2, yy + 365, obj_attackpress);
56
            }
57
            else
58
            {
59
                global.myfight = 4;
60
                instance_create(0, 0, obj_spellphase);
61
            }
62
        }
63
    }
64
}