summaryrefslogtreecommitdiff
path: root/npc/items
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-04-27 12:43:48 -0300
committerJesusaves <cpntb1@ymail.com>2020-04-27 12:43:48 -0300
commitabdee2ccaa24f361eef4bc44f11c5b900ae6ce25 (patch)
tree278060590bf34b54b742eb6ee63f9ae1e4a1dea3 /npc/items
parentb2fc469c9ac9cd9bc3df335ac2acda488ac9d18f (diff)
downloadserverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.tar.gz
serverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.tar.bz2
serverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.tar.xz
serverdata-abdee2ccaa24f361eef4bc44f11c5b900ae6ce25.zip
Sketch, playing with filters, for fake skills implementations
Diffstat (limited to 'npc/items')
-rw-r--r--npc/items/grenade.txt25
1 files changed, 18 insertions, 7 deletions
diff --git a/npc/items/grenade.txt b/npc/items/grenade.txt
index 226712691..f2e749ba9 100644
--- a/npc/items/grenade.txt
+++ b/npc/items/grenade.txt
@@ -9,6 +9,7 @@
function script grenade {
.@r=getarg(0, 3);
.@d=getarg(1, 500);
+ .@f$=getarg(2, "filter_notboss");
getmapxy(.@m$, .@x, .@y, 0);
.@c=getunits(BL_MOB, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
@@ -17,7 +18,7 @@ function script grenade {
.@dm=max(1, .@hp*(10000-.@d)/10000);
if (getarg(2, false))
.@dm=max(1, .@hp-.@d);
- if (!(getunitdata(.@mbs[.@i], UDT_MODE) & 32)) { // 32 = MD_BOSS
+ if (callfunc(.@f$)) {
//debugmes "Hitting monster (%d hp) for %d damage", .@hp, .@dm;
setunitdata(.@mbs[.@i], UDT_HP, .@dm);
specialeffect(FX_ATTACK, AREA, .@mbs[.@i]);
@@ -26,27 +27,30 @@ function script grenade {
return;
}
-// areasc(range, time, sc, bl) - defaults to 3x3 square, sleep mob for 500ms.
+// areasc(range, time, sc, bl, value, filter)
+// Defaults to 3x3 square, sleep mob for 500ms. Ignores you.
// Need a player caster. Valid BL: BL_MOB | BL_PC | BL_HOM | BL_MER
function script areasc {
.@r=getarg(0, 3);
.@d=getarg(1, 500);
.@s=getarg(2, SC_SLEEP);
.@b=getarg(3, BL_MOB);
+ .@val=getarg(4, 1);
+ .@f$=getarg(5, "filter_notme");
getmapxy(.@m$, .@x, .@y, 0);
.@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
for (.@i = 0; .@i < .@c; .@i++) {
- // Never target the caster
- if (.@mbs[.@i] == getcharid(3))
+ // Filtering
+ if (!callfunc(.@f$, .@mbs[.@i]))
continue;
- sc_start .@s, .@d, 1, 10000, SCFLAG_NONE, .@mbs[.@i];
+ sc_start .@s, .@d, .@val, 10000, SCFLAG_NONE, .@mbs[.@i];
specialeffect(FX_BUFF, AREA, .@mbs[.@i]);
}
return;
}
-// areasc2(map, x, y, {range, time, sc, bl}) - can be used by NPC
+// areasc2(map, x, y, {range, time, sc, bl, value, filter}) - can be used by NPC
// Valid BL: BL_MOB | BL_PC | BL_HOM | BL_MER
function script areasc2 {
.@m$=getarg(0);
@@ -56,10 +60,15 @@ function script areasc2 {
.@d=getarg(4, 500);
.@s=getarg(5, SC_SLEEP);
.@b=getarg(6, BL_MOB);
+ .@val=getarg(7, 1);
+ .@f$=getarg(8, "filter_always");
.@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
for (.@i = 0; .@i < .@c; .@i++) {
- sc_start .@s, .@d, 1, 10000, SCFLAG_NONE, .@mbs[.@i];
+ // Filtering
+ if (!callfunc(.@f$, .@mbs[.@i]))
+ continue;
+ sc_start .@s, .@d, .@val, 10000, SCFLAG_NONE, .@mbs[.@i];
specialeffect(FX_BUFF, AREA, .@mbs[.@i]);
}
return;
@@ -82,3 +91,5 @@ function script massprovoke {
return;
}
+// TODO: Maybe we could use areasc() with a special check
+// To force the implementation of guild skills... (Yet another script based)