summaryrefslogblamecommitdiff
path: root/npc/items/grenade.txt
blob: a1348039c931252d0b6a353f4d8e448030192432 (plain) (tree)




















                                                                                 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Grenades workaround

// Main loop - TODO: Should not affect boss
// grenade(range, damage - in 0.01%) - defaults to 3x3 square, with 5% damage
function	script	grenade	{
    .@r=getarg(0, 3);
    .@d=getarg(1, 500);

    getmapxy(.@m$, .@x, .@y, 0);
    .@c=getunits(BL_MOB, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
    for (.@i = 0; .@i < .@c; .@i++) {
        .@hp=getunitdata(.@mbs[.@i], UDT_HP);
        setunitdata(.@mbs[.@i], UDT_HP, max(1, .@hp*(10000-.@d)/10000));
    }
    return;
}