summaryrefslogtreecommitdiff
path: root/src/emap/mob.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-01 01:30:35 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-01 01:30:35 +0300
commit4f35fa5d10ba0a30157205227f25aed6da67f4e1 (patch)
tree5d348e835494204a5b4f6ea0a70cb5d0d2dae470 /src/emap/mob.c
parenta3158d2110a2a846d39a5ddc364adb40c212241d (diff)
downloadevol-hercules-4f35fa5d10ba0a30157205227f25aed6da67f4e1.tar.gz
evol-hercules-4f35fa5d10ba0a30157205227f25aed6da67f4e1.tar.bz2
evol-hercules-4f35fa5d10ba0a30157205227f25aed6da67f4e1.tar.xz
evol-hercules-4f35fa5d10ba0a30157205227f25aed6da67f4e1.zip
Add into mob_db skill type attacks modifier.
New group in mob_db: SkillAttacks Example: SkillAttacks: { SM_BASH: 5000 // mean SM_BASH skill do 50% of normal damage } Default value is 10000 mean 100%
Diffstat (limited to 'src/emap/mob.c')
-rw-r--r--src/emap/mob.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/emap/mob.c b/src/emap/mob.c
index 534e858..f12a936 100644
--- a/src/emap/mob.c
+++ b/src/emap/mob.c
@@ -18,6 +18,7 @@
#include "map/battle.h"
#include "map/itemdb.h"
#include "map/mob.h"
+#include "map/script.h"
#include "plugins/HPMHooking.h"
@@ -199,6 +200,23 @@ static void emob_load_weaponattacks(const char *type,
data->weaponAttacks[key] = val;
}
+static void emob_load_skillattacks(const char *type,
+ int val,
+ struct MobdExt *data,
+ struct mob_db *entry)
+{
+ int skill_id = 0;
+ if (script->get_constant(type, &skill_id))
+ {
+ const int idx = skill->get_index(skill_id);
+ data->skillAttacks[idx] = val;
+ }
+ else
+ {
+ ShowError("Mob %d. Unknown skill name %s\n", entry->mob_id, type);
+ }
+}
+
void emob_read_db_additional_fields_pre(struct mob_db **entryPtr,
struct config_setting_t **itPtr,
int *nPtr __attribute__ ((unused)),
@@ -227,6 +245,18 @@ void emob_read_db_additional_fields_pre(struct mob_db **entryPtr,
emob_load_weaponattacks(config_setting_name(wpt), libconfig->setting_get_int(wpt), data, *entryPtr);
}
}
+
+ tt = libconfig->setting_get_member(*itPtr, "SkillAttacks");
+
+ if (tt && config_setting_is_group(tt))
+ {
+ int j = 0;
+ struct config_setting_t *wpt = NULL;
+ while ((wpt = libconfig->setting_get_elem(tt, j++)) != NULL)
+ {
+ emob_load_skillattacks(config_setting_name(wpt), libconfig->setting_get_int(wpt), data, *entryPtr);
+ }
+ }
}
uint32 emob_read_db_mode_sub_post(uint32 retVal,