diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-05-22 05:02:36 +0200 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-02-15 16:41:59 -0300 |
commit | 8effba5658ac3026dc2b0d93d4d6186efa3d29d4 (patch) | |
tree | a60b6b0bd7dd84042b5ffd971cf39bc90e5dc078 | |
parent | 8df906dae741f28f7ce88ef29d2937446a52ddc6 (diff) | |
download | hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.tar.gz hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.tar.bz2 hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.tar.xz hercules-8effba5658ac3026dc2b0d93d4d6186efa3d29d4.zip |
Implement MSC_MAGICATTACKED cast condition for monster skills
[TMW2 CHERRYPICK]
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/mob.h | 1 | ||||
-rw-r--r-- | src/map/script.c | 1 |
3 files changed, 5 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; } diff --git a/src/map/mob.h b/src/map/mob.h index 9b0f6ffe0..608c28d61 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -321,6 +321,7 @@ enum { MSC_MASTERATTACKED, MSC_ALCHEMIST, MSC_SPAWN, + MSC_MAGICATTACKED, }; /** diff --git a/src/map/script.c b/src/map/script.c index d40f197e2..cf2a0c2d1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -27101,6 +27101,7 @@ static void script_hardcoded_constants(void) script->set_constant("MSC_MASTERATTACKED", MSC_MASTERATTACKED, false, false); script->set_constant("MSC_ALCHEMIST", MSC_ALCHEMIST, false, false); script->set_constant("MSC_SPAWN", MSC_SPAWN, false, false); + script->set_constant("MSC_MAGICATTACKED", MSC_MAGICATTACKED, false, false); script->constdb_comment("monster skill targets"); script->set_constant("MST_TARGET", MST_TARGET, false, false); |