|
6
|
scr_damagescr_damage
function scr_damage()
{
if (global.inv < 0)
{
scr_damage_cache();
var __element = 0;
if (variable_instance_exists(id, "element"))
{
if (is_real(element))
__element = element;
}
if (target < 3)
{
if (global.hp[global.char[target]] <= 0)
{
scr_randomtarget_old();
target = mytarget;
with (global.charinstance[target])
{
image_blend = c_white;
darkify = 0;
}
}
}
var __remtarget = -1;
if (target == 4)
{
__remtarget = 4;
scr_randomtarget_old();
target = mytarget;
if ((global.hp[global.char[target]] / global.maxhp[global.char[target]]) < (scr_party_hpaverage() / 2))
{
scr_randomtarget_old();
target = mytarget;
}
if ((global.hp[global.char[target]] / global.maxhp[global.char[target]]) < (scr_party_hpaverage() / 2))
{
scr_randomtarget_old();
target = mytarget;
}
if (target == 0 && (global.hp[global.char[target]] / global.maxhp[global.char[target]]) < 0.35)
{
scr_randomtarget_old();
target = mytarget;
}
with (global.charinstance[target])
{
image_blend = c_white;
darkify = 0;
}
}
chartarget = 3;
tdamage = damage;
var oldcalculation = 0;
if (target < 3)
{
if (oldcalculation)
tdamage = ceil(tdamage - (global.battledf[target] * 3));
else
tdamage = scr_damage_calculation(tdamage, target);
chartarget = global.char[target];
if (global.charaction[target] == 10)
tdamage = ceil((2 * tdamage) / 3);
tdamage = ceil(tdamage * scr_element_damage_reduction(__element, global.char[target]));
if (tdamage < 1)
tdamage = 1;
}
if (!instance_exists(obj_shake))
instance_create(0, 0, obj_shake);
with (global.charinstance[target])
{
hurt = 1;
hurttimer = 0;
}
hpdiff = tdamage;
with (obj_dmgwriter)
{
if (delaytimer >= 1)
killactive = 1;
}
doomtype = -1;
with (obj_heart)
dmgnoise = 1;
if (target < 3)
{
if (global.hp[chartarget] <= 0)
{
doomtype = 4;
global.hp[chartarget] -= round(tdamage / 4);
hpdiff = round(tdamage / 4);
}
else
{
global.hp[chartarget] -= tdamage;
if (global.chapter == 2 && instance_exists(obj_gigaqueen_enemy) && global.hp[chartarget] <= 0)
{
global.hp[chartarget] = 1;
with (o_boxingcontroller)
event_user(3);
}
if (global.hp[chartarget] <= 0)
... ();
|
|
8
|
scr_damage_all_overworldscr_damage_all_overworld
function scr_damage_all_overworld()
{
if (global.inv < 0)
{
scr_damage_cache();
remdamage = damage;
remtarget = target;
if (!instance_exists(obj_shake))
instance_create(0, 0, obj_shake);
with (obj_dmgwriter)
killactive = 1;
snd_stop(snd_hurt1);
snd_play(snd_hurt1);
for (ti = 0; ti < 3; ti += 1)
{
global.inv = -1;
damage = remdamage;
target = ti;
tdamage = damage;
with (global.charinstance[target])
{
hurt = 1;
hurttimer = 0;
}
hpdiff = tdamage;
if (hpdiff >= global.hp[global.char[target]])
hpdiff = global.hp[global.char[target]] - 1;
d_cancel = 0;
if (hpdiff <= 1)
{
d_cancel = 1;
hpdiff = 0;
}
if (d_cancel == 0)
{
doomtype = -1;
global.hp[global.char[target]] -= hpdiff;
if (global.charinstance[target].visible == true)
{
dmgwriter = instance_create(global.charinstance[target].x, (global.charinstance[target].y + global.charinstance[target].myheight) - 24, obj_dmgwriter);
dmgwriter.damage = hpdiff;
dmgwriter.type = doomtype;
}
}
if (global.hp[global.char[target]] < 1)
global.hp[global.char[target]] = 1;
}
scr_damage_check();
gameover = 1;
if (global.char[0] != 0 && global.hp[global.char[0]] > 2)
gameover = 0;
if (global.char[1] != 0 && global.hp[global.char[1]] > 2)
gameover = 0;
if (global.char[2] != 0 && global.hp[global.char[2]] > 2)
gameover = 0;
if (gameover == 1)
scr_gameover();
target = remtarget;
global.inv = global.invc * 40;
}
} ();
|