Deltarune (Chapter 4) 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; for (i = 0; i < 3; i += 1) { global.hittarget[i] = 0; with (global.charinstance[i]) tu = 0; hptarget = global.char[i]; if (global.chapter == 4 && i_ex(obj_titan_enemy) && obj_titan_enemy.gerson.sprite_index == spr_gerson_item) continue; 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 (disablesusieattack == 1 && global.charturn == 1) global.bmenucoord[0][global.charturn] = 1; for (i = 0; i < 12; i += 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
        for (i = 0; i < 3; i += 1)
30
        {
31
            global.hittarget[i] = 0;
32
            with (global.charinstance[i])
33
                tu = 0;
34
            hptarget = global.char[i];
35
            if (global.chapter == 4 && i_ex(obj_titan_enemy) && obj_titan_enemy.gerson.sprite_index == spr_gerson_item)
36
                continue;
37
            if (global.char[i] != 0 && global.hp[hptarget] <= 0)
38
            {
39
                healamt = ceil(global.maxhp[hptarget] / 8);
40
                dmgwr = instance_create(global.charinstance[i].x, (global.charinstance[i].y + global.charinstance[i].myheight) - 24, obj_dmgwriter);
41
                with (dmgwr)
42
                {
43
                    delay = 1;
44
                    type = 3;
45
                }
46
                dmgwr.damage = 
scr_heal
scr_heal

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

function
scr_endturn()
{ if (!i_ex(obj_hammer_of_justice_enemy)) { 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(); 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 (soundbattle) { if (i_ex(obj_sound_of_justice_enemy)) { if (global.charaction[0] == 1) obj_sound_of_justice_enemy.kris_phase2_try_attack_con = 1; if (global.charaction[1] == 4) { } else { if (global.charaction[1] == 1) obj_sound_of_justice_enemy.susie_phase2_try_attack_con = 1; global.charaction[1] = 0; global.faceaction[1] = 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; } }
();
97
        }
98
        if (disablesusieattack == 1 && global.charturn == 1)
99
            global.bmenucoord[0][global.charturn] = 1;
100
        for (i = 0; i < 12; i += 1)
101
        {
102
            for (j = 0; j < 3; j += 1)
103
                tempitem[i][j] = global.item[i];
104
        }
105
    }
106
}