summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/pre-re/skill_db.conf2
-rw-r--r--db/re/skill_db.conf2
-rw-r--r--src/map/skill.c53
-rw-r--r--src/map/skill.h1
-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
8 files changed, 75 insertions, 16 deletions
diff --git a/db/pre-re/skill_db.conf b/db/pre-re/skill_db.conf
index 4873012aa..21a0f0e78 100644
--- a/db/pre-re/skill_db.conf
+++ b/db/pre-re/skill_db.conf
@@ -4299,6 +4299,7 @@ skill_db: (
Element: "Ele_Wind"
DamageType: {
SplashArea: true
+ SplitDamage: true
IgnoreFlee: true
}
SplashRange: 1
@@ -4350,6 +4351,7 @@ skill_db: (
Element: "Ele_Fire"
DamageType: {
SplashArea: true
+ SplitDamage: true
IgnoreFlee: true
}
SplashRange: 2
diff --git a/db/re/skill_db.conf b/db/re/skill_db.conf
index 4863e4051..ec8548ab2 100644
--- a/db/re/skill_db.conf
+++ b/db/re/skill_db.conf
@@ -4520,6 +4520,7 @@ skill_db: (
Element: "Ele_Wind"
DamageType: {
SplashArea: true
+ SplitDamage: true
IgnoreFlee: true
}
SplashRange: 1
@@ -4572,6 +4573,7 @@ skill_db: (
Element: "Ele_Fire"
DamageType: {
SplashArea: true
+ SplitDamage: true
IgnoreFlee: true
}
SplashRange: 2
diff --git a/src/map/skill.c b/src/map/skill.c
index a4ebff9f1..0d1865a1f 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4132,7 +4132,7 @@ static int skill_activate_reverberation(struct block_list *bl, va_list ap)
if( su->alive && (sg = su->group) != NULL && sg->skill_id == WM_REVERBERATION && sg->unit_id == UNT_REVERBERATION ) {
int64 tick = timer->gettick();
clif->changetraplook(bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, tick);
+ skill->trap_do_splash(bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
su->limit = DIFF_TICK32(tick,sg->tick)+1500;
sg->unit_id = UNT_USED_TRAPS;
}
@@ -12638,7 +12638,7 @@ static int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int
if (sg->src_id == bl->id)
break; //Does not affect the caster.
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->unit_id = UNT_USED_TRAPS;
sg->limit = DIFF_TICK32(tick,sg->tick) + 1500;
break;
@@ -12932,7 +12932,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
}
- map->foreachinrange(skill->trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.
}
break;
@@ -12963,10 +12963,10 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case UNT_FREEZINGTRAP:
case UNT_FIREPILLAR_ACTIVE:
case UNT_CLAYMORETRAP:
- if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP )
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick);
+ if (sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP)
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag | BL_SKILL | ~BCT_SELF, tick);
else
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)
clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
sg->limit=DIFF_TICK32(tick,sg->tick)+1500 +
@@ -13197,9 +13197,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case UNT_GROUNDDRIFT_POISON:
case UNT_GROUNDDRIFT_WATER:
case UNT_GROUNDDRIFT_FIRE:
- map->foreachinrange(skill->trap_splash,&src->bl,
- skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag,
- &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(&src->bl, UNT_FIREPILLAR_ACTIVE);
sg->limit=DIFF_TICK32(tick,sg->tick)+1500;
@@ -13260,7 +13258,7 @@ static int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *b
case UNT_REVERBERATION:
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ skill->trap_do_splash(&src->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
sg->limit = DIFF_TICK32(tick,sg->tick)+1500;
sg->unit_id = UNT_USED_TRAPS;
break;
@@ -16624,10 +16622,10 @@ static int skill_detonator(struct block_list *bl, va_list ap)
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag|BL_SKILL|~BCT_SELF,bl,su->group->tick);
+ skill->trap_do_splash(bl, su->group->skill_id, su->group->skill_lv, su->group->bl_flag | BL_SKILL | ~BCT_SELF, su->group->tick);
break;
default:
- map->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
+ skill->trap_do_splash(bl, su->group->skill_id, su->group->skill_lv, su->group->bl_flag, su->group->tick);
}
clif->changetraplook(bl, UNT_USED_TRAPS);
su->group->limit = DIFF_TICK32(timer->gettick(),su->group->tick) +
@@ -16760,6 +16758,27 @@ static int skill_chastle_mob_changetarget(struct block_list *bl, va_list ap)
return 0;
}
+/**
+ * Does final adjustments (e.g. count enemies affected by splash) then runs trap splash function (skill_trap_splash).
+ *
+ * @param bl : trap skill unit's bl
+ * @param skill_id : Trap Skill ID
+ * @param skill_lv : Trap Skill Level
+ * @param bl_flag : Flag representing units affected by this trap
+ * @param tick : tick related to this trap
+ */
+static void skill_trap_do_splash(struct block_list *bl, uint16 skill_id, uint16 skill_lv, int bl_flag, int64 tick)
+{
+ int enemy_count = 0;
+
+ if (skill->get_nk(skill_id) & NK_SPLASHSPLIT) {
+ enemy_count = map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, bl, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
+ enemy_count = max(1, enemy_count); // Don't let enemy_count be 0 when spliting trap damage
+ }
+
+ map->foreachinrange(skill->trap_splash, bl, skill->get_splash(skill_id, skill_lv), bl_flag, bl, tick, enemy_count);
+}
+
/*==========================================
*
*------------------------------------------*/
@@ -16770,6 +16789,7 @@ static int skill_trap_splash(struct block_list *bl, va_list ap)
struct skill_unit *src_su = NULL;
struct skill_unit_group *sg;
struct block_list *ss;
+ int enemy_count = va_arg(ap, int);
nullpo_ret(bl);
nullpo_ret(src);
@@ -16864,7 +16884,7 @@ static int skill_trap_splash(struct block_list *bl, va_list ap)
}
/* Fall through */
default:
- skill->attack(skill->get_type(sg->skill_id),ss,src,bl,sg->skill_id,sg->skill_lv,tick,0);
+ skill->attack(skill->get_type(sg->skill_id), ss, src, bl, sg->skill_id, sg->skill_lv, tick, enemy_count);
break;
}
return 1;
@@ -17579,7 +17599,7 @@ static int skill_unit_timer_sub(union DBKey key, struct DBData *data, va_list ap
break;
}
clif->changetraplook(bl,UNT_USED_TRAPS);
- map->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
+ skill->trap_do_splash(bl, group->skill_id, group->skill_lv, group->bl_flag, tick);
group->limit = DIFF_TICK32(tick,group->tick)+1500;
su->limit = DIFF_TICK32(tick,group->tick)+1500;
group->unit_id = UNT_USED_TRAPS;
@@ -18967,7 +18987,7 @@ static int skill_destroy_trap(struct block_list *bl, va_list ap)
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- map->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &su->bl,tick);
+ skill->trap_do_splash(&su->bl, sg->skill_id, sg->skill_lv, sg->bl_flag | BL_SKILL | ~BCT_SELF, tick);
break;
case UNT_LANDMINE:
case UNT_BLASTMINE:
@@ -18976,7 +18996,7 @@ static int skill_destroy_trap(struct block_list *bl, va_list ap)
case UNT_FLASHER:
case UNT_FREEZINGTRAP:
case UNT_CLUSTERBOMB:
- map->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick);
+ skill->trap_do_splash(&su->bl, sg->skill_id, sg->skill_lv, sg->bl_flag, tick);
break;
}
// Traps aren't recovered.
@@ -21572,6 +21592,7 @@ void skill_defaults(void)
skill->onskillusage = skill_onskillusage;
skill->cell_overlap = skill_cell_overlap;
skill->timerskill = skill_timerskill;
+ skill->trap_do_splash = skill_trap_do_splash;
skill->trap_splash = skill_trap_splash;
skill->check_condition_mercenary = skill_check_condition_mercenary;
skill->locate_element_field = skill_locate_element_field;
diff --git a/src/map/skill.h b/src/map/skill.h
index 97134224e..0ace19927 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -2059,6 +2059,7 @@ struct skill_interface {
int (*onskillusage) (struct map_session_data *sd, struct block_list *bl, uint16 skill_id, int64 tick);
int (*cell_overlap) (struct block_list *bl, va_list ap);
int (*timerskill) (int tid, int64 tick, int id, intptr_t data);
+ void (*trap_do_splash) (struct block_list *bl, uint16 skill_id, uint16 skill_lv, int bl_flag, int64 tick);
int (*trap_splash) (struct block_list *bl, va_list ap);
int (*check_condition_mercenary) (struct block_list *bl, int skill_id, int lv, int type);
struct skill_unit_group *(*locate_element_field) (struct block_list *bl);
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 9261f6320..e0c30d6b0 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -7156,6 +7156,8 @@ typedef int (*HPMHOOK_pre_skill_cell_overlap) (struct block_list **bl, va_list a
typedef int (*HPMHOOK_post_skill_cell_overlap) (int retVal___, struct block_list *bl, va_list ap);
typedef int (*HPMHOOK_pre_skill_timerskill) (int *tid, int64 *tick, int *id, intptr_t *data);
typedef int (*HPMHOOK_post_skill_timerskill) (int retVal___, int tid, int64 tick, int id, intptr_t data);
+typedef void (*HPMHOOK_pre_skill_trap_do_splash) (struct block_list **bl, uint16 *skill_id, uint16 *skill_lv, int *bl_flag, int64 *tick);
+typedef void (*HPMHOOK_post_skill_trap_do_splash) (struct block_list *bl, uint16 skill_id, uint16 skill_lv, int bl_flag, int64 tick);
typedef int (*HPMHOOK_pre_skill_trap_splash) (struct block_list **bl, va_list ap);
typedef int (*HPMHOOK_post_skill_trap_splash) (int retVal___, struct block_list *bl, va_list ap);
typedef int (*HPMHOOK_pre_skill_check_condition_mercenary) (struct block_list **bl, int *skill_id, int *lv, int *type);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index fdd89760e..760f44c5e 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -5672,6 +5672,8 @@ struct {
struct HPMHookPoint *HP_skill_cell_overlap_post;
struct HPMHookPoint *HP_skill_timerskill_pre;
struct HPMHookPoint *HP_skill_timerskill_post;
+ struct HPMHookPoint *HP_skill_trap_do_splash_pre;
+ struct HPMHookPoint *HP_skill_trap_do_splash_post;
struct HPMHookPoint *HP_skill_trap_splash_pre;
struct HPMHookPoint *HP_skill_trap_splash_post;
struct HPMHookPoint *HP_skill_check_condition_mercenary_pre;
@@ -12225,6 +12227,8 @@ struct {
int HP_skill_cell_overlap_post;
int HP_skill_timerskill_pre;
int HP_skill_timerskill_post;
+ int HP_skill_trap_do_splash_pre;
+ int HP_skill_trap_do_splash_post;
int HP_skill_trap_splash_pre;
int HP_skill_trap_splash_post;
int HP_skill_check_condition_mercenary_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index 140758140..59ebfd130 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2902,6 +2902,7 @@ struct HookingPointData HookingPoints[] = {
{ HP_POP(skill->onskillusage, HP_skill_onskillusage) },
{ HP_POP(skill->cell_overlap, HP_skill_cell_overlap) },
{ HP_POP(skill->timerskill, HP_skill_timerskill) },
+ { HP_POP(skill->trap_do_splash, HP_skill_trap_do_splash) },
{ HP_POP(skill->trap_splash, HP_skill_trap_splash) },
{ HP_POP(skill->check_condition_mercenary, HP_skill_check_condition_mercenary) },
{ HP_POP(skill->locate_element_field, HP_skill_locate_element_field) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index d220f78fd..3615f06ed 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -75794,6 +75794,32 @@ int HP_skill_timerskill(int tid, int64 tick, int id, intptr_t data) {
}
return retVal___;
}
+void HP_skill_trap_do_splash(struct block_list *bl, uint16 skill_id, uint16 skill_lv, int bl_flag, int64 tick) {
+ int hIndex = 0;
+ if (HPMHooks.count.HP_skill_trap_do_splash_pre > 0) {
+ void (*preHookFunc) (struct block_list **bl, uint16 *skill_id, uint16 *skill_lv, int *bl_flag, int64 *tick);
+ *HPMforce_return = false;
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_trap_do_splash_pre; hIndex++) {
+ preHookFunc = HPMHooks.list.HP_skill_trap_do_splash_pre[hIndex].func;
+ preHookFunc(&bl, &skill_id, &skill_lv, &bl_flag, &tick);
+ }
+ if (*HPMforce_return) {
+ *HPMforce_return = false;
+ return;
+ }
+ }
+ {
+ HPMHooks.source.skill.trap_do_splash(bl, skill_id, skill_lv, bl_flag, tick);
+ }
+ if (HPMHooks.count.HP_skill_trap_do_splash_post > 0) {
+ void (*postHookFunc) (struct block_list *bl, uint16 skill_id, uint16 skill_lv, int bl_flag, int64 tick);
+ for (hIndex = 0; hIndex < HPMHooks.count.HP_skill_trap_do_splash_post; hIndex++) {
+ postHookFunc = HPMHooks.list.HP_skill_trap_do_splash_post[hIndex].func;
+ postHookFunc(bl, skill_id, skill_lv, bl_flag, tick);
+ }
+ }
+ return;
+}
int HP_skill_trap_splash(struct block_list *bl, va_list ap) {
int hIndex = 0;
int retVal___ = 0;