summaryrefslogtreecommitdiff
path: root/npc/items
diff options
context:
space:
mode:
Diffstat (limited to 'npc/items')
-rw-r--r--npc/items/grenade.txt10
1 files changed, 8 insertions, 2 deletions
diff --git a/npc/items/grenade.txt b/npc/items/grenade.txt
index a1348039c..218758b8a 100644
--- a/npc/items/grenade.txt
+++ b/npc/items/grenade.txt
@@ -5,7 +5,8 @@
// Grenades workaround
// Main loop - TODO: Should not affect boss
-// grenade(range, damage - in 0.01%) - defaults to 3x3 square, with 5% damage
+// grenade(range, damage - in 0.01%, flag) - defaults to 3x3 square, with 5% damage.
+// If flag is set, damage will be deemed to be absolute values.
function script grenade {
.@r=getarg(0, 3);
.@d=getarg(1, 500);
@@ -14,7 +15,12 @@ function script grenade {
.@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));
+ .@dm=max(1, .@hp*(10000-.@d)/10000);
+ if (getarg(2, false))
+ .@dm=max(1, .@hp-.@d);
+ //debugmes "Hitting monster (%d hp) for %d damage", .@hp, .@dm;
+ setunitdata(.@mbs[.@i], UDT_HP, .@dm);
+ specialeffect(FX_ATTACK, AREA, .@mbs[.@i]);
}
return;
}