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!
This commit is contained in:
Aleos 2022-07-18 13:46:41 -04:00 committed by GitHub
parent c2303c8f65
commit 78b4f4420d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)))