summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorGuilherme G. Menaldo <guilherme.menaldo@outlook.com>2018-08-20 21:20:46 -0300
committerGuilherme G. Menaldo <guilherme.menaldo@outlook.com>2018-08-30 12:04:06 -0300
commit6a0d3d52dcb64a4e04d49336fa7bdf82874a7cc1 (patch)
tree554d7c0f25b7c44076a93da4507e74a697bcf09e /src/plugins
parent7f7b8060cba8f0aba60f43cf343bdf3f773f3438 (diff)
downloadhercules-6a0d3d52dcb64a4e04d49336fa7bdf82874a7cc1.tar.gz
hercules-6a0d3d52dcb64a4e04d49336fa7bdf82874a7cc1.tar.bz2
hercules-6a0d3d52dcb64a4e04d49336fa7bdf82874a7cc1.tar.xz
hercules-6a0d3d52dcb64a4e04d49336fa7bdf82874a7cc1.zip
Makes trap damage possible to be reflected
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc1
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc26
4 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 0c63a98b6..9261f6320 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -278,6 +278,8 @@ typedef void (*HPMHOOK_pre_battle_drain) (struct map_session_data **sd, struct b
typedef void (*HPMHOOK_post_battle_drain) (struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss);
typedef void (*HPMHOOK_pre_battle_reflect_damage) (struct block_list **target, struct block_list **src, struct Damage **wd, uint16 *skill_id);
typedef void (*HPMHOOK_post_battle_reflect_damage) (struct block_list *target, struct block_list *src, struct Damage *wd, uint16 skill_id);
+typedef void (*HPMHOOK_pre_battle_reflect_trap) (struct block_list **target, struct block_list **src, struct Damage **md, uint16 *skill_id);
+typedef void (*HPMHOOK_post_battle_reflect_trap) (struct block_list *target, struct block_list *src, struct Damage *md, uint16 skill_id);
typedef int (*HPMHOOK_pre_battle_attr_ratio) (int *atk_elem, int *def_type, int *def_lv);
typedef int (*HPMHOOK_post_battle_attr_ratio) (int retVal___, int atk_elem, int def_type, int def_lv);
typedef int64 (*HPMHOOK_pre_battle_attr_fix) (struct block_list **src, struct block_list **target, int64 *damage, int *atk_elem, int *def_type, int *def_lv);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index c4394d7f4..fdd89760e 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -232,6 +232,8 @@ struct {
struct HPMHookPoint *HP_battle_drain_post;
struct HPMHookPoint *HP_battle_reflect_damage_pre;
struct HPMHookPoint *HP_battle_reflect_damage_post;
+ struct HPMHookPoint *HP_battle_reflect_trap_pre;
+ struct HPMHookPoint *HP_battle_reflect_trap_post;
struct HPMHookPoint *HP_battle_attr_ratio_pre;
struct HPMHookPoint *HP_battle_attr_ratio_post;
struct HPMHookPoint *HP_battle_attr_fix_pre;
@@ -6783,6 +6785,8 @@ struct {
int HP_battle_drain_post;
int HP_battle_reflect_damage_pre;
int HP_battle_reflect_damage_post;
+ int HP_battle_reflect_trap_pre;
+ int HP_battle_reflect_trap_post;
int HP_battle_attr_ratio_pre;
int HP_battle_attr_ratio_post;
int HP_battle_attr_fix_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index e5584cc43..140758140 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -133,6 +133,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(battle->delay_damage, HP_battle_delay_damage) },
{ HP_POP(battle->drain, HP_battle_drain) },
{ HP_POP(battle->reflect_damage, HP_battle_reflect_damage) },
+ { HP_POP(battle->reflect_trap, HP_battle_reflect_trap) },
{ HP_POP(battle->attr_ratio, HP_battle_attr_ratio) },
{ HP_POP(battle->attr_fix, HP_battle_attr_fix) },
{ HP_POP(battle->calc_cardfix, HP_battle_calc_cardfix) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index f2ce1505c..d220f78fd 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -2806,6 +2806,32 @@ void HP_battle_reflect_damage(struct block_list *target, struct block_list *src,
}
return;
}
+void HP_battle_reflect_trap(struct block_list *target, struct block_list *src, struct Damage *md, uint16 skill_id) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_battle_reflect_trap_pre > 0) {
+ void (*preHookFunc) (struct block_list **target, struct block_list **src, struct Damage **md, uint16 *skill_id);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_battle_reflect_trap_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_battle_reflect_trap_pre[hIndex].func;
+ preHookFunc(&target, &src, &md, &skill_id);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.battle.reflect_trap(target, src, md, skill_id);
+ }
+ if (HPMHooks.count.HP_battle_reflect_trap_post > 0) {
+ void (*postHookFunc) (struct block_list *target, struct block_list *src, struct Damage *md, uint16 skill_id);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_battle_reflect_trap_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_battle_reflect_trap_post[hIndex].func;
+ postHookFunc(target, src, md, skill_id);
+ }
+ }
+ return;
+}
int HP_battle_attr_ratio(int atk_elem, int def_type, int def_lv) {
int hIndex = 0;
int retVal___ = 0;