Deltarune 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 (global.chapter == 2 && i_ex(obj_berdlyb_enemy) && obj_berdlyb_enemy.endcon == 1) techwon = 1; else 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 (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 (global.chapter == 2 && i_ex(obj_berdlyb_enemy) && obj_berdlyb_enemy.endcon == 1)
9
            techwon = 1;
10
        else if (techwon == 1)
11
            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; } }
();
12
        if (techwon == 0)
13
        {
14
            for (__hiti = 0; __hiti < 3; __hiti++)
15
                global.hittarget[__hiti] = 0;
16
            fightphase = 1;
17
            global.charturn = 3;
18
            if (global.charaction[0] == 4 || global.charaction[0] == 2)
19
                fightphase = 0;
20
            if (global.charaction[1] == 4 || global.charaction[1] == 2)
21
                fightphase = 0;
22
            if (global.charaction[2] == 4 || global.charaction[2] == 2)
23
                fightphase = 0;
24
            if (global.myfight == 4)
25
                fightphase = 1;
26
            if (fightphase == 1)
27
            {
28
                global.myfight = 1;
29
                instance_create(xx + 2, yy + 365, obj_attackpress);
30
            }
31
            else
32
            {
33
                global.myfight = 4;
34
                instance_create(0, 0, obj_spellphase);
35
            }
36
        }
37
    }
38
}