From 78b4f4420d71e2605466f247a2ec1c9ba71b0636 Mon Sep 17 00:00:00 2001 From: Aleos Date: Mon, 18 Jul 2022 13:46:41 -0400 Subject: [PATCH] Fixes AddEffWhenHit not triggering Magic or Misc (#5628) * Fixes #5623. * Fixes an issue with AddEffWhenHit not triggering on Magic or Misc type attacks. Thanks to @24msz6eo and @Atemo! --- src/map/skill.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/map/skill.cpp b/src/map/skill.cpp index fe98c99eed..9a1f843ab3 100755 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -2488,14 +2488,24 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list * sd = BL_CAST(BL_PC, src); dstsd = BL_CAST(BL_PC, bl); - if(dstsd && attack_type&BF_WEAPON) { //Counter effects. + if(dstsd && attack_type & BF_WEAPONMASK) { //Counter effects. for (const auto &it : dstsd->addeff_atked) { rate = it.rate; if (attack_type&BF_LONG) rate += it.arrow_rate; - if (!rate) + if (rate == 0) continue; + if ((it.flag&(ATF_WEAPON|ATF_MAGIC|ATF_MISC)) != (ATF_WEAPON|ATF_MAGIC|ATF_MISC)) { + // Trigger has attack type consideration. + if ((it.flag&ATF_WEAPON && attack_type&BF_WEAPON) || + (it.flag&ATF_MAGIC && attack_type&BF_MAGIC) || + (it.flag&ATF_MISC && attack_type&BF_MISC)) + ; + else + continue; + } + if ((it.flag&(ATF_LONG|ATF_SHORT)) != (ATF_LONG|ATF_SHORT)) { //Trigger has range consideration. if((it.flag&ATF_LONG && !(attack_type&BF_LONG)) || (it.flag&ATF_SHORT && !(attack_type&BF_SHORT)))