summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-05-22 05:02:36 +0200
committerJesusaves <cpntb1@ymail.com>2021-02-15 16:41:59 -0300
commit8effba5658ac3026dc2b0d93d4d6186efa3d29d4 (patch)
treea60b6b0bd7dd84042b5ffd971cf39bc90e5dc078 /src/map/mob.c
parent8df906dae741f28f7ce88ef29d2937446a52ddc6 (diff)
downloadhercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.tar.gz
hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.tar.bz2
hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.tar.xz
hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.zip
Implement MSC_MAGICATTACKED cast condition for monster skills
[TMW2 CHERRYPICK]
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 0e89c37da..f953c3c7c 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3560,6 +3560,8 @@ static int mobskill_event(struct mob_data *md, struct block_list *src, int64 tic
res = mob->skill_use(md, tick, MSC_CLOSEDATTACKED);
else if (flag&BF_LONG && !(flag&BF_MAGIC)) //Long-attacked should not include magic.
res = mob->skill_use(md, tick, MSC_LONGRANGEATTACKED);
+ else if ((flag & BF_MAGIC) != 0)
+ res = mob->skill_use(md, tick, MSC_MAGICATTACKED);
if (!res)
//Restore previous target only if skill condition failed to trigger. [Skotlex]
@@ -5398,7 +5400,7 @@ static bool mob_skill_db_libconfig_sub_skill(struct config_setting_t *it, int n,
ms->target = MST_TARGET;
}
- if (mob->lookup_const(it, "CastCondition", &i32) && (i32 < MSC_ALWAYS || i32 > MSC_SPAWN)) {
+ if (mob->lookup_const(it, "CastCondition", &i32) && (i32 < MSC_ALWAYS || i32 > MSC_MAGICATTACKED)) {
ShowWarning("mob_skill_db_libconfig_sub_skill: Invalid skill condition %d for skill id %d in monster %d, defaulting to MSC_ALWAYS.\n", i32, skill_id, mob_id);
ms->cond1 = MSC_ALWAYS;
}