diff options
-rw-r--r-- | src/emap/battle.c | 6 | ||||
-rw-r--r-- | src/emap/data/mobd.c | 5 | ||||
-rw-r--r-- | src/emap/mob.c | 12 | ||||
-rw-r--r-- | src/emap/struct/mobdext.h | 4 |
4 files changed, 17 insertions, 10 deletions
diff --git a/src/emap/battle.c b/src/emap/battle.c index e0b7942..454abb8 100644 --- a/src/emap/battle.c +++ b/src/emap/battle.c @@ -91,7 +91,7 @@ struct Damage ebattle_calc_weapon_attack_post(struct Damage retVal, struct block_list *src, struct block_list *target, uint16 skill_id, - uint16 skill_lv __attribute__ ((unused)), + uint16 skill_lv, int wflag __attribute__ ((unused))) { if (src == NULL) @@ -122,8 +122,8 @@ struct Damage ebattle_calc_weapon_attack_post(struct Damage retVal, int mod = 0; if (skill_id > 0) { - const int idx = skill->get_index(skill_id); - mod = data->skillAttacks[idx]; + const int idx = skill->get_ele(skill_id, skill_lv); + mod = data->eleResist[idx]; } else { diff --git a/src/emap/data/mobd.c b/src/emap/data/mobd.c index e11a222..83d4866 100644 --- a/src/emap/data/mobd.c +++ b/src/emap/data/mobd.c @@ -14,6 +14,7 @@ #include "common/strlib.h" #include "map/battle.h" #include "map/mob.h" +#include "map/map.h" #include "emap/data/mobd.h" #include "emap/struct/mobdext.h" @@ -49,8 +50,8 @@ struct MobdExt *mobd_create(void) data->walkMask = 0; for (int f = 0; f < MAX_WEAPON_TYPE; f ++) data->weaponAttacks[f] = 10000; - for (int f = 0; f < MAX_SKILL_DB; f ++) - data->skillAttacks[f] = 10000; + for (int f = 0; f < ELE_MAX; f ++) + data->eleResist[f] = 10000; data->collisionDx = -1; data->collisionDy = -1; data->collisionMask = 1; diff --git a/src/emap/mob.c b/src/emap/mob.c index e4adec5..4a4a3ba 100644 --- a/src/emap/mob.c +++ b/src/emap/mob.c @@ -210,12 +210,16 @@ static void emob_load_skillattacks(const char *type, int skill_id = 0; if (script->get_constant(type, &skill_id)) { - const int idx = skill->get_index(skill_id); - data->skillAttacks[idx] = val; + if (skill_id == ELE_ALL) { + for (int f = 0; f < ELE_MAX; f ++) + data->eleResist[f] = val; + } else { + data->eleResist[skill_id] = val; + } } else { - ShowError("Mob %d. Unknown skill name %s\n", entry->mob_id, type); + ShowError("Mob %d. Unknown elemental name %s\n", entry->mob_id, type); } } @@ -248,7 +252,7 @@ void emob_read_db_additional_fields_pre(struct mob_db **entryPtr, } } - tt = libconfig->setting_get_member(*itPtr, "SkillAttacks"); + tt = libconfig->setting_get_member(*itPtr, "EleResist"); if (tt && config_setting_is_group(tt)) { diff --git a/src/emap/struct/mobdext.h b/src/emap/struct/mobdext.h index 24c6f34..66a0cf9 100644 --- a/src/emap/struct/mobdext.h +++ b/src/emap/struct/mobdext.h @@ -4,11 +4,13 @@ #ifndef EVOL_MAP_MOBDEXT #define EVOL_MAP_MOBDEXT +#include "map/map.h" + struct MobdExt { int walkMask; int weaponAttacks[MAX_WEAPON_TYPE]; - int skillAttacks[MAX_SKILL_DB]; + unsigned short eleResist[ELE_MAX]; int collisionDx; int collisionDy; int collisionMask; |