summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-01 15:24:35 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-01 17:23:19 +0300
commitfb398fe6dcc8ba797e133df3db3dcdfa1df9042b (patch)
tree89ba9d9cdbb9ad6e122c2984ad75ffbf53a8082a /src
parent8340001e7b3adb04d91a08c0372f058a4edfdf39 (diff)
downloadplugin-fb398fe6dcc8ba797e133df3db3dcdfa1df9042b.tar.gz
plugin-fb398fe6dcc8ba797e133df3db3dcdfa1df9042b.tar.bz2
plugin-fb398fe6dcc8ba797e133df3db3dcdfa1df9042b.tar.xz
plugin-fb398fe6dcc8ba797e133df3db3dcdfa1df9042b.zip
Add files for skill constants and ground skills handlers.
For now add one ground skill EVOL_MASSPROVOKE.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/script.c2
-rw-r--r--src/emap/skill.c22
-rw-r--r--src/emap/skill.h8
-rw-r--r--src/emap/skill_const.c15
-rw-r--r--src/emap/skill_const.h14
-rw-r--r--src/emap/skill_ground.c67
-rw-r--r--src/emap/skill_ground.h15
9 files changed, 148 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3f6f98f..76f6140 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,6 +77,10 @@ MAP_SRC = emap/atcommand.c \
emap/send.h \
emap/skill.c \
emap/skill.h \
+ emap/skill_const.c \
+ emap/skill_const.h \
+ emap/skill_ground.c \
+ emap/skill_ground.h \
emap/status.c \
emap/status.h \
emap/unit.c \
diff --git a/src/emap/init.c b/src/emap/init.c
index 4079871..280c26e 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -296,6 +296,7 @@ HPExport void plugin_init (void)
skill->unit_onplace_unknown = eskill_unit_onplace_unknown;
skill->check_condition_castend_unknown = eskill_check_condition_castend_unknown;
skill->get_requirement_unknown = eskill_get_requirement_unknown;
+ skill->castend_pos2_unknown = eskill_castend_pos2_unknown;
langScriptId = script->add_str("Lang");
mountScriptId = script->add_str("mount");
diff --git a/src/emap/script.c b/src/emap/script.c
index e3ad3ed..73854ce 100644
--- a/src/emap/script.c
+++ b/src/emap/script.c
@@ -19,6 +19,7 @@
#include "emap/map.h"
#include "emap/data/npcd.h"
#include "emap/struct/npcdext.h"
+#include "emap/skill_const.h"
#define getExt2() \
TBL_NPC *nd = NULL; \
@@ -84,6 +85,7 @@ void escript_hardcoded_constants_pre(void)
script->constdb_comment("Evol constants");
script->set_constant("MAX_SLOTS", MAX_SLOTS, false, false);
script->constdb_comment(NULL);
+ eskill_addskill_conststants();
}
// stripped copy from script_load_translations without actual translation loading.
diff --git a/src/emap/skill.c b/src/emap/skill.c
index ce2c038..65f34e1 100644
--- a/src/emap/skill.c
+++ b/src/emap/skill.c
@@ -18,6 +18,10 @@
#include "map/npc.h"
#include "map/script.h"
+#include "emap/skill.h"
+#include "emap/skill_const.h"
+#include "emap/skill_ground.h"
+
#include "plugins/HPMHooking.h"
int eskill_check_condition_castend_post(int retVal,
@@ -128,3 +132,21 @@ void eskill_get_requirement_unknown(struct status_change *sc __attribute__ ((unu
struct skill_condition *req __attribute__ ((unused)))
{
}
+
+bool eskill_castend_pos2_unknown(struct block_list* src,
+ int *x,
+ int *y,
+ uint16 *skill_id,
+ uint16 *skill_lv,
+ int64 *tick,
+ int *flag)
+{
+ switch (*skill_id)
+ {
+ case EVOL_MASSPROVOKE:
+ return eskill_massprovoke_castend(src, x, y, skill_id, skill_lv, tick, flag);
+ default:
+ ShowWarning("skill_castend_pos2: Unknown skill used:%d\n", *skill_id);
+ return true;
+ }
+}
diff --git a/src/emap/skill.h b/src/emap/skill.h
index 63d8bda..db519cb 100644
--- a/src/emap/skill.h
+++ b/src/emap/skill.h
@@ -73,4 +73,12 @@ void eskill_get_requirement_unknown(struct status_change *sc,
uint16 *skill_lv,
struct skill_condition *req);
+bool eskill_castend_pos2_unknown(struct block_list* src,
+ int *x,
+ int *y,
+ uint16 *skill_id,
+ uint16 *skill_lv,
+ int64 *tick,
+ int *flag);
+
#endif // EVOL_MAP_SKILL
diff --git a/src/emap/skill_const.c b/src/emap/skill_const.c
new file mode 100644
index 0000000..30e6fde
--- /dev/null
+++ b/src/emap/skill_const.c
@@ -0,0 +1,15 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#include "map/script.h"
+
+#include "emap/skill_const.h"
+
+void eskill_addskill_conststants(void)
+{
+ script->constdb_comment("Evol skills");
+ script->set_constant("EVOL_MASSPROVOKE", EVOL_MASSPROVOKE, false, false);
+ script->constdb_comment(NULL);
+}
diff --git a/src/emap/skill_const.h b/src/emap/skill_const.h
new file mode 100644
index 0000000..11076e8
--- /dev/null
+++ b/src/emap/skill_const.h
@@ -0,0 +1,14 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_SKILL_CONST
+#define EVOL_MAP_SKILL_CONST
+
+enum
+{
+ EVOL_MASSPROVOKE = 10016
+};
+
+void eskill_addskill_conststants(void);
+
+#endif // EVOL_MAP_SKILL_CONST
diff --git a/src/emap/skill_ground.c b/src/emap/skill_ground.c
new file mode 100644
index 0000000..f557009
--- /dev/null
+++ b/src/emap/skill_ground.c
@@ -0,0 +1,67 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/nullpo.h"
+#include "common/timer.h"
+#include "map/mob.h"
+#include "map/skill.h"
+
+#include "emap/skill_ground.h"
+
+static int eskill_massprovoke_sub(struct block_list *bl,
+ va_list ap)
+{
+ nullpo_ret(bl);
+
+ if (bl->type != BL_MOB)
+ return 0;
+
+ struct block_list* src = va_arg(ap, struct block_list*);
+ int dist = va_arg(ap, int);
+ int *cnt = va_arg(ap, int*);
+ struct status_change *tsc = status->get_sc(bl);
+ struct mob_data *dstmd = BL_UCAST(BL_MOB, bl);
+
+ if (tsc && tsc->count)
+ {
+ status_change_end(bl, SC_FREEZE, INVALID_TIMER);
+ if (tsc->data[SC_STONE] && tsc->opt1 == OPT1_STONE)
+ status_change_end(bl, SC_STONE, INVALID_TIMER);
+ status_change_end(bl, SC_SLEEP, INVALID_TIMER);
+ status_change_end(bl, SC_TRICKDEAD, INVALID_TIMER);
+ }
+
+ if (dstmd && src)
+ {
+ dstmd->state.provoke_flag = src->id;
+ mob->target(dstmd, src, dist);
+ (*cnt) ++;
+ }
+
+ return 0;
+}
+
+bool eskill_massprovoke_castend(struct block_list* src,
+ int *x,
+ int *y,
+ uint16 *skill_id,
+ uint16 *skill_lv,
+ int64 *tick __attribute__ ((unused)),
+ int *flag __attribute__ ((unused)))
+{
+ nullpo_retr(false, src);
+ const int r = skill->get_splash(*skill_id, *skill_lv);
+ const int dist = skill->get_range2(src, *skill_id, *skill_lv);
+ int cnt = 0;
+ map->foreachinarea(eskill_massprovoke_sub, src->m, *x - r, *y - r, *x + r, *y + r, BL_MOB,
+ src, dist, &cnt);
+ if (cnt == 0)
+ unit->skillcastcancel(src, 1);
+ return false;
+}
diff --git a/src/emap/skill_ground.h b/src/emap/skill_ground.h
new file mode 100644
index 0000000..6ed4b19
--- /dev/null
+++ b/src/emap/skill_ground.h
@@ -0,0 +1,15 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_SKILL_GROUND
+#define EVOL_MAP_SKILL_GROUND
+
+bool eskill_massprovoke_castend(struct block_list* src,
+ int *x,
+ int *y,
+ uint16 *skill_id,
+ uint16 *skill_lv,
+ int64 *tick,
+ int *flag);
+
+#endif // EVOL_MAP_SKILL_GROUND