summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emap/battle.c12
-rw-r--r--src/emap/data/mobd.c5
-rw-r--r--src/emap/mob.c12
-rw-r--r--src/emap/struct/mobdext.h4
4 files changed, 20 insertions, 13 deletions
diff --git a/src/emap/battle.c b/src/emap/battle.c
index 99dcf36..101e525 100644
--- a/src/emap/battle.c
+++ b/src/emap/battle.c
@@ -94,7 +94,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)))
{
// Rebuild Infinite Defense Rule
@@ -142,8 +142,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
{
@@ -160,7 +160,7 @@ struct Damage ebattle_calc_magic_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 mflag __attribute__ ((unused)))
{
// Skip if things went wrong
@@ -257,8 +257,8 @@ struct Damage ebattle_calc_magic_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 0d2209b..379ae10 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;
/* Disabled in TMW2
data->collisionDx = -1;
data->collisionDy = -1;
diff --git a/src/emap/mob.c b/src/emap/mob.c
index 3391620..0da1a1a 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 119ad3c..cc6b9f3 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];
/* Disabled in TMW2
int collisionDx;
int collisionDy;