Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_damage_enemy

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

function scr_damage_enemy(arg0, arg1) { dm = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter); if (caster < 4) { dm.type = global.char[caster] - 1; if (global.char[caster] == 4) dm.type = 6; } if (caster == 5) dm.type = 5; dm.damage = arg1; global.monsterhp[arg0] -= arg1; if (arg1 > 0) { with (global.monsterinstance[arg0]) { shakex = 9; state = 3; hurttimer = 30; } if (i_ex(global.monsterinstance[arg0])) global.monsterinstance[arg0].hurtamt = arg1; } global.hittarget[arg0] += 1; if (arg1 == 0) { with (global.monsterinstance[arg0]) { hurtamt = 0; if (hurttimer <= 15 && candodge == 1) { dodgetimer = 0; state = 4; } } } if (global.chapter == 2 && i_ex(obj_sweet_enemy) && global.monsterhp[arg0] <= 0) global.monsterhp[arg0] = 1; var a = 0; if (global.chapter == 2 && i_ex(obj_queen_enemy)) a = 1; if (global.chapter == 2 && i_ex(obj_spamton_neo_enemy)) a = 2; if (global.chapter == 2 && i_ex(obj_berdlyb_enemy)) a = 3; if (global.monsterhp[arg0] <= 0 && a == 0) { with (global.monsterinstance[arg0]) scr_monsterdefeat(); } if (global.chapter == 2 && global.monsterhp[arg0] <= 0 && a == 3) { with (global.monsterinstance[arg0]) endcon = 1; } }
(arg0, arg1)
2
{
3
    dm = instance_create(global.monsterx[arg0], (global.monstery[arg0] + 20) - (global.hittarget[arg0] * 20), obj_dmgwriter);
4
    if (caster < 4)
5
    {
6
        dm.type = global.char[caster] - 1;
7
        if (global.char[caster] == 4)
8
            dm.type = 6;
9
    }
10
    if (caster == 5)
11
        dm.type = 5;
12
    dm.damage = arg1;
13
    global.monsterhp[arg0] -= arg1;
14
    if (arg1 > 0)
15
    {
16
        with (global.monsterinstance[arg0])
17
        {
18
            shakex = 9;
19
            state = 3;
20
            hurttimer = 30;
21
        }
22
        if (i_ex(global.monsterinstance[arg0]))
23
            global.monsterinstance[arg0].hurtamt = arg1;
24
    }
25
    global.hittarget[arg0] += 1;
26
    if (arg1 == 0)
27
    {
28
        with (global.monsterinstance[arg0])
29
        {
30
            hurtamt = 0;
31
            if (hurttimer <= 15 && candodge == 1)
32
            {
33
                dodgetimer = 0;
34
                state = 4;
35
            }
36
        }
37
    }
38
    if (global.chapter == 2 && i_ex(obj_sweet_enemy) && global.monsterhp[arg0] <= 0)
39
        global.monsterhp[arg0] = 1;
40
    var a = 0;
41
    if (global.chapter == 2 && i_ex(obj_queen_enemy))
42
        a = 1;
43
    if (global.chapter == 2 && i_ex(obj_spamton_neo_enemy))
44
        a = 2;
45
    if (global.chapter == 2 && i_ex(obj_berdlyb_enemy))
46
        a = 3;
47
    if (global.monsterhp[arg0] <= 0 && a == 0)
48
    {
49
        with (global.monsterinstance[arg0])
50
            scr_monsterdefeat
scr_monsterdefeat

function scr_monsterdefeat() { if (global.monster[myself] == 1) { global.monstergold[3] += global.monstergold[myself]; global.monsterexp[3] += global.monsterexp[myself]; global.monster[myself] = 0; if (global.flag[51 + myself] == 0) { global.flag[51 + myself] = 2; if (global.monsterhp[myself] <= 0) global.flag[51 + myself] = 1; } if (global.flag[51 + myself] == 1) { global.flag[40 violences] += 1; if (fatal == 1) global.flag[44 kills]++; } if (global.flag[51 + myself] == 2) global.flag[41 spares] += 1; if (global.flag[51 + myself] == 3) global.flag[42 pacifies] += 1; if (global.flag[51 + myself] == 5) global.flag[43 autosusie_violences] += 1; if (global.flag[51 + myself] == 6) { global.flag[45 freezes] += 1; global.monstergold[3] += 24; } if (scr_monsterpop() == 0) { _amt_add = 0; _frozened = 0; _violenced = 0; _spared = 0; _pacified = 0; for (d_i = 0; d_i < 3; d_i += 1) { if (global.flag[51 + d_i] != 0) _amt_add += 1; if (global.flag[51 + d_i] == 1) _violenced += 1; if (global.flag[51 + d_i] == 2) _spared += 1; if (global.flag[51 + d_i] == 3) _pacified += 1; if (global.flag[51 + d_i] == 6) _frozened += 1; } if (_frozened > 0) global.flag[50 last_encounter_end] = 6; if (_pacified > 0) global.flag[50 last_encounter_end] = 3; if (_spared > 0) global.flag[50 last_encounter_end] = 2; if (_violenced > 0) global.flag[50 last_encounter_end] = 1; if (_frozened > 0) { if (_pacified > 0 || _violenced > 0 || _spared > 0) global.flag[50 last_encounter_end] = 1; } if (global.flag[50 last_encounter_end] == 6) global.flag[926 iceshocked_encounters]++; if (global.flag[54 encounter_pointer] != 0) { global.flag[global.flag[54 encounter_pointer]] = global.flag[50 last_encounter_end]; global.flag[54 encounter_pointer] = 0; } } event_user(11); } }
();
51
    }
52
    if (global.chapter == 2 && global.monsterhp[arg0] <= 0 && a == 3)
53
    {
54
        with (global.monsterinstance[arg0])
55
            endcon = 1;
56
    }
57
}