summaryrefslogtreecommitdiff
path: root/src/map
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/map
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/map')
-rw-r--r--src/map/battle.c35
-rw-r--r--src/map/battle.h3
2 files changed, 38 insertions, 0 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index fceb30be1..8707ef6ac 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4339,6 +4339,8 @@ static struct Damage battle_calc_misc_attack(struct block_list *src, struct bloc
}
break;
}
+
+ battle->reflect_trap(target, src, &md, skill_id);
return md;
}
@@ -6008,6 +6010,37 @@ static void battle_reflect_damage(struct block_list *target, struct block_list *
#undef NORMALIZE_RDAMAGE
}
+/**
+ * Reflects damage from certain traps, if battle_config.trap_reflect is true.
+ * @param target : Player who triggered the trap
+ * @param src : Player who set the trap
+ * @param md : Trap damage structure
+ * @param skill_id : Trap skill ID
+ */
+static void battle_reflect_trap(struct block_list *target, struct block_list *src, struct Damage *md, uint16 skill_id)
+{
+ if (battle_config.trap_reflect == true) {
+ if (src != target) { // Don't reflect your own damage
+ switch (skill_id) {
+ case HT_CLAYMORETRAP:
+ case HT_LANDMINE:
+ case HT_FREEZINGTRAP:
+ case HT_BLASTMINE:
+ // Needs official info
+ //case RA_CLUSTERBOMB:
+ //case RA_FIRINGTRAP:
+ //case RA_ICEBOUNDTRAP:
+ //case GN_THORNS_TRAP:
+ //case KO_MAKIBISHI:
+ case MA_LANDMINE:
+ case MA_FREEZINGTRAP:
+ battle->reflect_damage(target, src, md, skill_id);
+ break;
+ }
+ }
+ }
+}
+
static void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss)
{
struct weapon_data *wd;
@@ -7325,6 +7358,7 @@ static const struct battle_data {
* Hercules
**/
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
+ { "trap_reflect", &battle_config.trap_reflect, 1, 0, 1, },
{ "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
{ "unequip_restricted_equipment", &battle_config.unequip_restricted_equipment, 0, 0, 3, },
{ "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
@@ -7614,6 +7648,7 @@ void battle_defaults(void)
battle->delay_damage = battle_delay_damage;
battle->drain = battle_drain;
battle->reflect_damage = battle_reflect_damage;
+ battle->reflect_trap = battle_reflect_trap;
battle->attr_ratio = battle_attr_ratio;
battle->attr_fix = battle_attr_fix;
battle->calc_cardfix = battle_calc_cardfix;
diff --git a/src/map/battle.h b/src/map/battle.h
index 9f5207e95..c16007e16 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -506,6 +506,7 @@ struct Battle_Config {
/** Hercules **/
int skill_trap_type;
+ int trap_reflect;
int item_restricted_consumption_type;
int unequip_restricted_equipment;
int max_walk_path;
@@ -636,6 +637,8 @@ struct battle_interface {
void (*drain) (struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int boss);
/* damage reflect */
void (*reflect_damage) (struct block_list *target, struct block_list *src, struct Damage *wd,uint16 skill_id);
+ /* trap reflect */
+ void(*reflect_trap) (struct block_list *target, struct block_list *src, struct Damage *md, uint16 skill_id);
/* attribute rate */
int (*attr_ratio) (int atk_elem, int def_type, int def_lv);
/* applies attribute modifiers */