Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_mnendturn

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

function
scr_mnendturn()
{ if (global.char[0] == 2) sus = 0; if (global.char[1] == 2) sus = 1; if (global.char[2] == 2) sus = 2; techwon = 0; if (
scr_monsterpop() == 0)
techwon = 1; if (global.flag[39 dojo_abort?] == 1) techwon = 1; if (techwon == 1)
scr_wincombat();
if (techwon == 0) { with (obj_battlecontroller) { messagepriority = -1; attackpriority = -1; }
scr_battlecursor_memory_reset();
global.mnfight = 0; global.myfight = 0; global.bmenuno = 0; global.charturn = 0; skip = 0; with (obj_monsterparent) { if (variable_instance_exists(id, "end_turn_action")) end_turn_action(); } for (i = 0; i < 3; i += 1) { global.hittarget[i] = 0; with (global.charinstance[i]) tu = 0; hptarget = global.char[i]; if (global.char[i] != 0 && global.hp[hptarget] <= 0) { healamt = ceil(global.maxhp[hptarget] / 8); dmgwr = instance_create(global.charinstance[i].x, (global.charinstance[i].y + global.charinstance[i].myheight) - 24, obj_dmgwriter); with (dmgwr) { delay = 1; type = 3; } dmgwr.damage =
scr_heal(i, healamt);
if (global.hp[hptarget] >= 1) { with (dmgwr) specialmessage = 4; } } } if (global.charmove[0] == 0 || global.charauto[global.char[0]] == 1) global.charturn = 1; if (global.charturn == 1) { if (global.charmove[1] == 0 || global.charauto[global.char[1]] == 1) global.charturn = 2; } if (global.charturn == 2) { if (global.charmove[2] == 0 || global.charauto[global.char[2]] == 1) skip = 1; } for (i = 0; i < 3; i += 1) { global.acting[i] = 0; global.actingsingle[i] = 0; global.actingsimul[i] = 0; global.actingtarget[i] = 0; global.temptension[i] = global.tension; global.charspecial[i] = 0; global.targeted[i] = 0; global.charaction[i] = 0; global.faceaction[i] = 0; global.monsterattackname[i] = " "; } global.currentactingchar = 0; with (obj_monsterparent) { attacked = 0; talked = 0; acting = 0; actingsus = 0; actingral = 0; actingnoe = 0; } if (skip == 1) { if (global.char[0] == 2 && global.charauto[2] == 1) { global.acting[0] = 1; global.myfight = 3; }
scr_endturn();
} if (disablesusieralseiattack == 1 && global.charturn == 1) ...
()
2
{
3
    if (global.char[0] == 2)
4
        sus = 0;
5
    if (global.char[1] == 2)
6
        sus = 1;
7
    if (global.char[2] == 2)
8
        sus = 2;
9
    techwon = 0;
10
    if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 0)
11
        techwon = 1;
12
    if (global.flag[39 dojo_abort?] == 1)
13
        techwon = 1;
14
    if (techwon == 1)
15
        
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; } }
();
16
    if (techwon == 0)
17
    {
18
        with (obj_battlecontroller)
19
        {
20
            messagepriority = -1;
21
            attackpriority = -1;
22
        }
23
        
scr_battlecursor_memory_reset
scr_battlecursor_memory_reset

function
scr_battlecursor_memory_reset()
{ if (global.flag[14 remember_battle_menu] == 0) { for (i = 0; i < 20; i += 1) { for (j = 0; j < 20; j += 1) global.bmenucoord[i][j] = 0; } } }
();
24
        global.mnfight = 0;
25
        global.myfight = 0;
26
        global.bmenuno = 0;
27
        global.charturn = 0;
28
        skip = 0;
29
        with (obj_monsterparent)
30
        {
31
            if (variable_instance_exists(id, "end_turn_action"))
32
                end_turn_action();
33
        }
34
        for (i = 0; i < 3; i += 1)
35
        {
36
            global.hittarget[i] = 0;
37
            with (global.charinstance[i])
38
                tu = 0;
39
            hptarget = global.char[i];
40
            if (global.char[i] != 0 && global.hp[hptarget] <= 0)
41
            {
42
                healamt = ceil(global.maxhp[hptarget] / 8);
43
                dmgwr = instance_create(global.charinstance[i].x, (global.charinstance[i].y + global.charinstance[i].myheight) - 24, obj_dmgwriter);
44
                with (dmgwr)
45
                {
46
                    delay = 1;
47
                    type = 3;
48
                }
49
                dmgwr.damage = 
scr_heal
scr_heal

function
scr_heal(arg0, arg1, arg2 = true)
{ abovemaxhp = 0; belowzero = 0; hltarget = global.char[arg0]; _curhp = global.hp[hltarget]; if (global.hp[hltarget] <= 0) belowzero = 1; if (global.hp[hltarget] > global.maxhp[hltarget]) abovemaxhp = 1; if (abovemaxhp == 0) { global.hp[hltarget] += arg1; if (global.hp[hltarget] > global.maxhp[hltarget]) global.hp[hltarget] = global.maxhp[hltarget]; } if (belowzero == 1 && global.hp[hltarget] >= 0 && arg2) { if (global.hp[hltarget] < ceil(global.maxhp[hltarget] / 6)) global.hp[hltarget] = ceil(global.maxhp[hltarget] / 6);
scr_revive(arg0);
} snd_stop(snd_power); snd_play(snd_power); return global.hp[hltarget] - _curhp; }
(i, healamt);
50
                if (global.hp[hptarget] >= 1)
51
                {
52
                    with (dmgwr)
53
                        specialmessage = 4;
54
                }
55
            }
56
        }
57
        if (global.charmove[0] == 0 || global.charauto[global.char[0]] == 1)
58
            global.charturn = 1;
59
        if (global.charturn == 1)
60
        {
61
            if (global.charmove[1] == 0 || global.charauto[global.char[1]] == 1)
62
                global.charturn = 2;
63
        }
64
        if (global.charturn == 2)
65
        {
66
            if (global.charmove[2] == 0 || global.charauto[global.char[2]] == 1)
67
                skip = 1;
68
        }
69
        for (i = 0; i < 3; i += 1)
70
        {
71
            global.acting[i] = 0;
72
            global.actingsingle[i] = 0;
73
            global.actingsimul[i] = 0;
74
            global.actingtarget[i] = 0;
75
            global.temptension[i] = global.tension;
76
            global.charspecial[i] = 0;
77
            global.targeted[i] = 0;
78
            global.charaction[i] = 0;
79
            global.faceaction[i] = 0;
80
            global.monsterattackname[i] = " ";
81
        }
82
        global.currentactingchar = 0;
83
        with (obj_monsterparent)
84
        {
85
            attacked = 0;
86
            talked = 0;
87
            acting = 0;
88
            actingsus = 0;
89
            actingral = 0;
90
            actingnoe = 0;
91
        }
92
        if (skip == 1)
93
        {
94
            if (global.char[0] == 2 && global.charauto[2] == 1)
95
            {
96
                global.acting[0] = 1;
97
                global.myfight = 3;
98
            }
99
            
scr_endturn
scr_endturn

function
scr_endturn()
{ for (i = 0; i < 12; i += 1) global.item[i] = tempitem[i][global.charturn]; for (i = 0; i < 12; i += 1) { for (j = 0; j < 3; j += 1) tempitem[i][j] = global.item[i]; } moveswapped = 0; with (obj_writer) instance_destroy(); with (obj_face) instance_destroy(); with (obj_smallface) instance_destroy(); for (i = 0; i < 3; i += 1) { if ((i == 0 && (global.chararmor1[1] == 38 || global.chararmor2[1] == 38) && global.faceaction[0] == 4) || (i == 1 && (global.chararmor1[2] == 38 || global.chararmor2[2] == 38) && global.faceaction[1] == 4) || (i == 2 && (global.chararmor1[3] == 38 || global.chararmor2[3] == 38) && global.faceaction[2] == 4)) { var healnum = round(global.maxhp[i + 1] * 0.16); global.charinstance[i].healnum = healnum;
scr_heal(i, healnum);
with (global.charinstance[i]) { ha = instance_create(x, y, obj_healanim); ha.target = id; dmgwr =
scr_dmgwriter_selfchar();
with (dmgwr) { delay = 8; type = 3; } if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]]) { with (dmgwr) specialmessage = 3; } dmgwr.damage = healnum; tu += 1; } } for (iii = 0; iii < 3; iii++) { with (global.charinstance[i]) tu--; } } global.attacking = 0; for (i = 0; i < 3; i += 1) { global.monsterattackname[i] = " "; if (global.charauto[global.char[i]] == 1 && global.hp[global.char[i]] > 0) { if (global.monster[2] == 1) global.chartarget[i] = 2; if (global.monster[1] == 1) global.chartarget[i] = 1; if (global.monster[0] == 1) global.chartarget[i] = 0; } if (global.charaction[i] == 1) global.attacking = 1; } __noactors = 1; if (global.acting[0] == 1) __noactors = 0; for (__noactorsi = 0; __noactorsi < 3; __noactorsi++) { if (global.actingsingle[__noactorsi] == 1) __noactors = 0; } if (__noactors == 1) {
scr_attackphase();
} else { global.charturn = 3; global.myfight = 3; global.currentactingchar = 0; if (global.acting[0] == 0)
scr_nextact();
if (global.acting[0] == 1 && global.actingsimul[0] == 1)
scr_act_simul();
} with (obj_battlecontroller) { messagepriority = -1; attackpriority = -1; } }
();
100
        }
101
        if (disablesusieralseiattack == 1 && global.charturn == 1)
102
            global.bmenucoord[0][global.charturn] = 1;
103
        for (i = 0; i < 12; i += 1)
104
        {
105
            for (j = 0; j < 3; j += 1)
106
                tempitem[i][j] = global.item[i];
107
        }
108
    }
109
}