summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.cpp143
-rw-r--r--src/map/battle.cpp275
-rw-r--r--src/map/battle.hpp33
-rw-r--r--src/map/clif.cpp158
-rw-r--r--src/map/clif.hpp23
-rw-r--r--src/map/magic-expr.cpp10
-rw-r--r--src/map/magic-interpreter.hpp2
-rw-r--r--src/map/magic-stmt.cpp36
-rw-r--r--src/map/magic.hpp4
-rw-r--r--src/map/map.cpp4
-rw-r--r--src/map/map.hpp53
-rw-r--r--src/map/mob.cpp407
-rw-r--r--src/map/mob.hpp64
-rw-r--r--src/map/mob.t.hpp93
-rw-r--r--src/map/pc.cpp184
-rw-r--r--src/map/pc.hpp6
-rw-r--r--src/map/script.cpp73
-rw-r--r--src/map/skill-pools.cpp38
-rw-r--r--src/map/skill.cpp1444
-rw-r--r--src/map/skill.hpp833
-rw-r--r--src/map/skill.t.hpp1417
21 files changed, 3226 insertions, 2074 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index de2030c..b01c801 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -3126,16 +3126,16 @@ int atcommand_gat(const int fd, struct map_session_data *sd,
int atcommand_packet(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
- int x = 0, y = 0;
+ int type = 0, flag = 0;
- if (!message || !*message || sscanf(message, "%d %d", &x, &y) < 2)
+ if (!message || !*message || sscanf(message, "%d %d", &type, &flag) < 2)
{
clif_displaymessage(fd,
"Please, enter a status type/flag (usage: @packet <status type> <flag>).");
return -1;
}
- clif_status_change(&sd->bl, x, y);
+ clif_status_change(&sd->bl, StatusChange(type), flag);
return 0;
}
@@ -4483,16 +4483,18 @@ int atcommand_allskills(const int fd, struct map_session_data *sd,
int atcommand_questskill(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
- int skill_id;
+ int skill_id_;
- if (!message || !*message || (skill_id = atoi(message)) < 0)
+ if (!message || !*message || (skill_id_ = atoi(message)) < 0)
{
clif_displaymessage(fd,
"Please, enter a quest skill number (usage: @questskill <#:0+>).");
return -1;
}
- if (skill_id >= 0 && skill_id < MAX_SKILL_DB)
+ SkillID skill_id = SkillID(skill_id_);
+
+ if (skill_id >= SkillID() && skill_id < MAX_SKILL_DB)
{
if (skill_get_inf2(skill_id) & 0x01)
{
@@ -4531,20 +4533,22 @@ int atcommand_charquestskill(const int fd, struct map_session_data *sd,
{
char character[100];
struct map_session_data *pl_sd;
- int skill_id = 0;
+ int skill_id_ = 0;
memset(character, '\0', sizeof(character));
if (!message || !*message
- || sscanf(message, "%d %99[^\n]", &skill_id, character) < 2
- || skill_id < 0)
+ || sscanf(message, "%d %99[^\n]", &skill_id_, character) < 2
+ || skill_id_ < 0)
{
clif_displaymessage(fd,
"Please, enter a quest skill number and a player name (usage: @charquestskill <#:0+> <char_name>).");
return -1;
}
- if (skill_id >= 0 && skill_id < MAX_SKILL_DB)
+ SkillID skill_id = SkillID(skill_id_);
+
+ if (skill_id >= SkillID() && skill_id < MAX_SKILL_DB)
{
if (skill_get_inf2(skill_id) & 0x01)
{
@@ -4589,16 +4593,18 @@ int atcommand_charquestskill(const int fd, struct map_session_data *sd,
int atcommand_lostskill(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
- int skill_id;
+ int skill_id_;
- if (!message || !*message || (skill_id = atoi(message)) < 0)
+ if (!message || !*message || (skill_id_ = atoi(message)) < 0)
{
clif_displaymessage(fd,
"Please, enter a quest skill number (usage: @lostskill <#:0+>).");
return -1;
}
- if (skill_id >= 0 && skill_id < MAX_SKILL)
+ SkillID skill_id = SkillID(skill_id_);
+
+ if (skill_id >= SkillID() && skill_id < MAX_SKILL)
{
if (skill_get_inf2(skill_id) & 0x01)
{
@@ -4639,20 +4645,22 @@ int atcommand_charlostskill(const int fd, struct map_session_data *sd,
{
char character[100];
struct map_session_data *pl_sd;
- int skill_id = 0;
+ int skill_id_ = 0;
memset(character, '\0', sizeof(character));
if (!message || !*message
- || sscanf(message, "%d %99[^\n]", &skill_id, character) < 2
- || skill_id < 0)
+ || sscanf(message, "%d %99[^\n]", &skill_id_, character) < 2
+ || skill_id_ < 0)
{
clif_displaymessage(fd,
"Please, enter a quest skill number and a player name (usage: @charlostskill <#:0+> <char_name>).");
return -1;
}
- if (skill_id >= 0 && skill_id < MAX_SKILL)
+ SkillID skill_id = SkillID(skill_id_);
+
+ if (skill_id >= SkillID() && skill_id < MAX_SKILL)
{
if (skill_get_inf2(skill_id) & 0x01)
{
@@ -5860,9 +5868,6 @@ const char *txt_time(unsigned int duration)
memset(temp, '\0', sizeof(temp));
memset(temp1, '\0', sizeof(temp1));
- if (duration < 0)
- duration = 0;
-
days = duration / (60 * 60 * 24);
duration = duration - (60 * 60 * 24 * days);
hours = duration / (60 * 60);
@@ -7511,14 +7516,14 @@ atcommand_skillid(const int fd, struct map_session_data *sd,
if (!message || !*message)
return -1;
skillen = strlen(message);
- while (skill_names[idx].id != 0)
+ while (skill_names[idx].id != SkillID::ZERO)
{
if ((strncasecmp(skill_names[idx].name, message, skillen) == 0) ||
(strncasecmp(skill_names[idx].desc, message, skillen) == 0))
{
char output[255];
- sprintf(output, "skill %d: %s", skill_names[idx].id,
- skill_names[idx].desc);
+ sprintf(output, "skill %d: %s",
+ uint16_t(skill_names[idx].id), skill_names[idx].desc);
clif_displaymessage(fd, output);
}
idx++;
@@ -7537,14 +7542,14 @@ atcommand_useskill(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
struct map_session_data *pl_sd = NULL;
- int skillnum;
+ int skillnum_;
int skilllv;
int inf;
char target[255];
if (!message || !*message)
return -1;
- if (sscanf(message, "%d %d %s", &skillnum, &skilllv, target) != 3)
+ if (sscanf(message, "%d %d %s", &skillnum_, &skilllv, target) != 3)
{
clif_displaymessage(fd,
"Usage: @useskill <skillnum> <skillv> <target>");
@@ -7555,6 +7560,7 @@ atcommand_useskill(const int fd, struct map_session_data *sd,
return -1;
}
+ SkillID skillnum = SkillID(skillnum_);
inf = skill_get_inf(skillnum);
if ((inf == 2) || (inf == 1))
@@ -7823,10 +7829,28 @@ int atcommand_unmute(const int fd, struct map_session_data *sd,
/* Magic atcommands by Fate */
-static int magic_base = TMW_MAGIC;
-#define magic_skills_nr 6
+static SkillID magic_skills[] =
+{
+ TMW_MAGIC,
+ TMW_MAGIC_LIFE,
+ TMW_MAGIC_WAR,
+ TMW_MAGIC_TRANSMUTE,
+ TMW_MAGIC_NATURE,
+ TMW_MAGIC_ETHER,
+};
+
+constexpr
+size_t magic_skills_nr = sizeof(magic_skills) / sizeof(magic_skills[0]);
+
static const char *magic_skill_names[magic_skills_nr] =
- { "magic", "life", "war", "transmute", "nature", "astral" };
+{
+ "magic",
+ "life",
+ "war",
+ "transmute",
+ "nature",
+ "astral"
+};
int
atcommand_magic_info(const int fd, struct map_session_data *sd,
@@ -7846,16 +7870,15 @@ atcommand_magic_info(const int fd, struct map_session_data *sd,
if ((pl_sd = map_nick2sd(character)) != NULL)
{
- int i;
-
sprintf(buf, "`%s' has the following magic skills:", character);
clif_displaymessage(fd, buf);
- for (i = 0; i < magic_skills_nr; i++)
+ for (size_t i = 0; i < magic_skills_nr; i++)
{
- sprintf(buf, "%d in %s", pl_sd->status.skill[i + magic_base].lv,
- magic_skill_names[i]);
- if (pl_sd->status.skill[i + magic_base].id == i + magic_base)
+ SkillID sk = magic_skills[i];
+ sprintf(buf, "%d in %s",
+ pl_sd->status.skill[sk].lv, magic_skill_names[i]);
+ if (pl_sd->status.skill[sk].id == sk)
clif_displaymessage(fd, buf);
}
@@ -7867,9 +7890,9 @@ atcommand_magic_info(const int fd, struct map_session_data *sd,
return -1;
}
-static void set_skill(struct map_session_data *sd, int i, int level)
+static void set_skill(struct map_session_data *sd, SkillID i, int level)
{
- sd->status.skill[i].id = level ? i : 0;
+ sd->status.skill[i].id = level ? i : SkillID();
sd->status.skill[i].lv = level;
}
@@ -7879,7 +7902,6 @@ atcommand_set_magic(const int fd, struct map_session_data *sd,
{
char character[100];
char magic_type[20];
- int skill_index = -1; // 0: all
int value;
struct map_session_data *pl_sd;
@@ -7894,22 +7916,22 @@ atcommand_set_magic(const int fd, struct map_session_data *sd,
return -1;
}
+ SkillID skill_index = SkillID::NEGATIVE;
if (!strcasecmp("all", magic_type))
- skill_index = 0;
+ skill_index = SkillID::ZERO;
else
{
- int i;
- for (i = 0; i < magic_skills_nr; i++)
+ for (size_t i = 0; i < magic_skills_nr; i++)
{
if (!strcasecmp(magic_skill_names[i], magic_type))
{
- skill_index = i + magic_base;
+ skill_index = magic_skills[i];
break;
}
}
}
- if (skill_index == -1)
+ if (skill_index == SkillID::NEGATIVE)
{
clif_displaymessage(fd,
"Incorrect school of magic. Use `magic', `nature', `life', `war', `transmute', `ether', or `all'.");
@@ -7918,10 +7940,9 @@ atcommand_set_magic(const int fd, struct map_session_data *sd,
if ((pl_sd = map_nick2sd(character)) != NULL)
{
- int i;
- if (skill_index == 0)
- for (i = 0; i < magic_skills_nr; i++)
- set_skill(pl_sd, i + magic_base, value);
+ if (skill_index == SkillID::ZERO)
+ for (SkillID sk : magic_skills)
+ set_skill(pl_sd, sk, value);
else
set_skill(pl_sd, skill_index, value);
@@ -8070,7 +8091,7 @@ int atcommand_skillpool_info(const int fd, struct map_session_data *sd,
if ((pl_sd = map_nick2sd(character)) != NULL)
{
char buf[200];
- int pool_skills[MAX_SKILL_POOL];
+ SkillID pool_skills[MAX_SKILL_POOL];
int pool_skills_nr = skill_pool(pl_sd, pool_skills);
int i;
@@ -8079,8 +8100,10 @@ int atcommand_skillpool_info(const int fd, struct map_session_data *sd,
clif_displaymessage(fd, buf);
for (i = 0; i < pool_skills_nr; ++i)
{
- sprintf(buf, " - %s [%d]: power %d", skill_name(pool_skills[i]),
- pool_skills[i], skill_power(pl_sd, pool_skills[i]));
+ sprintf(buf, " - %s [%d]: power %d",
+ skill_name(pool_skills[i]),
+ uint16_t(pool_skills[i]),
+ skill_power(pl_sd, pool_skills[i]));
clif_displaymessage(fd, buf);
}
@@ -8095,8 +8118,8 @@ int atcommand_skillpool_info(const int fd, struct map_session_data *sd,
if (lvl)
{
- sprintf(buf, " - %s [%d]: lvl %d", name,
- skill_pool_skills[i], lvl);
+ sprintf(buf, " - %s [%d]: lvl %d",
+ name, uint16_t(skill_pool_skills[i]), lvl);
clif_displaymessage(fd, buf);
}
}
@@ -8112,16 +8135,18 @@ int atcommand_skillpool_focus(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
char character[100];
- int skill;
+ int skill_;
struct map_session_data *pl_sd;
if (!message || !*message
- || sscanf(message, "%d %99[^\n]", &skill, character) < 1)
+ || sscanf(message, "%d %99[^\n]", &skill_, character) < 1)
{
clif_displaymessage(fd, "Usage: @sp-focus <skill-nr> <char_name>");
return -1;
}
+ SkillID skill = SkillID(skill_);
+
if ((pl_sd = map_nick2sd(character)) != NULL)
{
if (skill_pool_activate(pl_sd, skill))
@@ -8139,16 +8164,18 @@ int atcommand_skillpool_unfocus(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
char character[100];
- int skill;
+ int skill_;
struct map_session_data *pl_sd;
if (!message || !*message
- || sscanf(message, "%d %99[^\n]", &skill, character) < 1)
+ || sscanf(message, "%d %99[^\n]", &skill_, character) < 1)
{
clif_displaymessage(fd, "Usage: @sp-unfocus <skill-nr> <char_name>");
return -1;
}
+ SkillID skill = SkillID(skill_);
+
if ((pl_sd = map_nick2sd(character)) != NULL)
{
if (skill_pool_deactivate(pl_sd, skill))
@@ -8166,17 +8193,19 @@ int atcommand_skill_learn(const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
char character[100];
- int skill, level;
+ int skill_, level;
struct map_session_data *pl_sd;
if (!message || !*message
- || sscanf(message, "%d %d %99[^\n]", &skill, &level, character) < 1)
+ || sscanf(message, "%d %d %99[^\n]", &skill_, &level, character) < 1)
{
clif_displaymessage(fd,
"Usage: @skill-learn <skill-nr> <level> <char_name>");
return -1;
}
+ SkillID skill = SkillID(skill_);
+
if ((pl_sd = map_nick2sd(character)) != NULL)
{
set_skill(pl_sd, skill, level);
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 03c522e..126b752 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -149,7 +149,7 @@ int battle_get_max_hp(struct block_list *bl)
return ((struct map_session_data *) bl)->status.max_hp;
else
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
int max_hp = 1;
if (bl->type == BL_MOB && ((struct mob_data *) bl))
{
@@ -188,7 +188,7 @@ int battle_get_max_hp(struct block_list *bl)
int battle_get_str(struct block_list *bl)
{
int str = 0;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -228,7 +228,7 @@ int battle_get_str(struct block_list *bl)
int battle_get_agi(struct block_list *bl)
{
int agi = 0;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -267,7 +267,7 @@ int battle_get_agi(struct block_list *bl)
int battle_get_vit(struct block_list *bl)
{
int vit = 0;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -296,7 +296,7 @@ int battle_get_vit(struct block_list *bl)
int battle_get_int(struct block_list *bl)
{
int int_ = 0;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -334,7 +334,7 @@ int battle_get_int(struct block_list *bl)
int battle_get_dex(struct block_list *bl)
{
int dex = 0;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -377,7 +377,7 @@ int battle_get_dex(struct block_list *bl)
int battle_get_luk(struct block_list *bl)
{
int luk = 0;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -408,7 +408,7 @@ int battle_get_luk(struct block_list *bl)
int battle_get_flee(struct block_list *bl)
{
int flee = 1;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
@@ -447,7 +447,7 @@ int battle_get_flee(struct block_list *bl)
int battle_get_hit(struct block_list *bl)
{
int hit = 1;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
@@ -486,7 +486,7 @@ int battle_get_hit(struct block_list *bl)
int battle_get_flee2(struct block_list *bl)
{
int flee2 = 1;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
@@ -524,7 +524,7 @@ static
int battle_get_critical(struct block_list *bl)
{
int critical = 1;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(1, bl);
sc_data = battle_get_sc_data(bl);
@@ -561,7 +561,7 @@ int battle_get_critical(struct block_list *bl)
*/
int battle_get_baseatk(struct block_list *bl)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int batk = 1;
nullpo_retr(1, bl);
@@ -596,7 +596,7 @@ int battle_get_baseatk(struct block_list *bl)
*/
int battle_get_atk(struct block_list *bl)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int atk = 0;
nullpo_retr(0, bl);
@@ -653,7 +653,7 @@ int battle_get_atk2(struct block_list *bl)
return ((struct map_session_data *) bl)->watk2;
else
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
int atk2 = 0;
if (bl->type == BL_MOB && (struct mob_data *) bl)
atk2 = ((struct mob_data *) bl)->stats[MOB_ATK2];
@@ -706,7 +706,7 @@ int battle_get_atk_2(struct block_list *bl)
static
int battle_get_matk1(struct block_list *bl)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB)
@@ -733,7 +733,7 @@ int battle_get_matk1(struct block_list *bl)
static
int battle_get_matk2(struct block_list *bl)
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
nullpo_retr(0, bl);
if (bl->type == BL_MOB)
{
@@ -758,8 +758,9 @@ int battle_get_matk2(struct block_list *bl)
*/
int battle_get_def(struct block_list *bl)
{
- struct status_change *sc_data;
- int def = 0, skilltimer = -1, skillid = 0;
+ eptr<struct status_change, StatusChange> sc_data;
+ int def = 0, skilltimer = -1;
+ SkillID skillid = SkillID::ZERO;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -831,7 +832,7 @@ int battle_get_def(struct block_list *bl)
*/
int battle_get_mdef(struct block_list *bl)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int mdef = 0;
nullpo_retr(0, bl);
@@ -875,7 +876,7 @@ int battle_get_mdef(struct block_list *bl)
*/
int battle_get_def2(struct block_list *bl)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int def2 = 1;
nullpo_retr(1, bl);
@@ -910,7 +911,7 @@ int battle_get_def2(struct block_list *bl)
int battle_get_mdef2(struct block_list *bl)
{
int mdef2 = 0;
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
nullpo_retr(0, bl);
if (bl->type == BL_MOB)
@@ -944,7 +945,7 @@ int battle_get_speed(struct block_list *bl)
return ((struct map_session_data *) bl)->speed;
else
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
int speed = 1000;
if (bl->type == BL_MOB && (struct mob_data *) bl)
speed = ((struct mob_data *) bl)->stats[MOB_SPEED];
@@ -1003,7 +1004,7 @@ int battle_get_adelay(struct block_list *bl)
return (((struct map_session_data *) bl)->aspd << 1);
else
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
int adelay = 4000, aspd_rate = 100, i;
if (bl->type == BL_MOB && (struct mob_data *) bl)
adelay = ((struct mob_data *) bl)->stats[MOB_ADELAY];
@@ -1049,10 +1050,12 @@ int battle_get_adelay(struct block_list *bl)
if (sc_data[SC_STEELBODY].timer != -1) // 金剛
aspd_rate += 25;
//増速ポーション使用時は減算
- if (sc_data[i = SC_SPEEDPOTION2].timer != -1
- || sc_data[i = SC_SPEEDPOTION1].timer != -1
- || sc_data[i = SC_SPEEDPOTION0].timer != -1)
- aspd_rate -= sc_data[i].val1;
+ if (sc_data[SC_SPEEDPOTION2].timer != -1)
+ aspd_rate -= sc_data[SC_SPEEDPOTION2].val1;
+ else if (sc_data[SC_SPEEDPOTION1].timer != -1)
+ aspd_rate -= sc_data[SC_SPEEDPOTION2].val1;
+ else if (sc_data[SC_SPEEDPOTION0].timer != -1)
+ aspd_rate -= sc_data[SC_SPEEDPOTION2].val1;
// Fate's `haste' spell works the same as the above
if (sc_data[SC_HASTE].timer != -1)
aspd_rate -= sc_data[SC_HASTE].val1;
@@ -1077,7 +1080,7 @@ int battle_get_amotion(struct block_list *bl)
return ((struct map_session_data *) bl)->amotion;
else
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
int amotion = 2000, aspd_rate = 100, i;
if (bl->type == BL_MOB && (struct mob_data *) bl)
amotion = mob_db[((struct mob_data *) bl)->mob_class].amotion;
@@ -1114,10 +1117,12 @@ int battle_get_amotion(struct block_list *bl)
(sc_data[SC_DONTFORGETME].val3 >> 16);
if (sc_data[SC_STEELBODY].timer != -1) // 金剛
aspd_rate += 25;
- if (sc_data[i = SC_SPEEDPOTION2].timer != -1
- || sc_data[i = SC_SPEEDPOTION1].timer != -1
- || sc_data[i = SC_SPEEDPOTION0].timer != -1)
- aspd_rate -= sc_data[i].val1;
+ if (sc_data[SC_SPEEDPOTION2].timer != -1)
+ aspd_rate -= sc_data[SC_SPEEDPOTION2].val1;
+ else if (sc_data[SC_SPEEDPOTION1].timer != -1)
+ aspd_rate -= sc_data[SC_SPEEDPOTION1].val1;
+ else if (sc_data[SC_SPEEDPOTION0].timer != -1)
+ aspd_rate -= sc_data[SC_SPEEDPOTION0].val1;
if (sc_data[SC_HASTE].timer != -1)
aspd_rate -= sc_data[SC_HASTE].val1;
if (sc_data[SC_DEFENDER].timer != -1)
@@ -1136,7 +1141,7 @@ int battle_get_amotion(struct block_list *bl)
int battle_get_dmotion(struct block_list *bl)
{
int ret;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
sc_data = battle_get_sc_data(bl);
@@ -1166,7 +1171,7 @@ int battle_get_dmotion(struct block_list *bl)
int battle_get_element(struct block_list *bl)
{
int ret = 20;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(ret, bl);
sc_data = battle_get_sc_data(bl);
@@ -1191,7 +1196,7 @@ int battle_get_element(struct block_list *bl)
int battle_get_attack_element(struct block_list *bl)
{
int ret = 0;
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
nullpo_retr(0, bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
@@ -1224,7 +1229,7 @@ int battle_get_attack_element2(struct block_list *bl)
if (bl->type == BL_PC && (struct map_session_data *) bl)
{
int ret = ((struct map_session_data *) bl)->atk_ele_;
- struct status_change *sc_data =
+ eptr<struct status_change, StatusChange> sc_data =
((struct map_session_data *) bl)->sc_data;
if (sc_data)
@@ -1336,14 +1341,18 @@ int battle_get_stat(int stat_id /* SP_VIT or similar */ ,
}
// StatusChange系の所得
-struct status_change *battle_get_sc_data(struct block_list *bl)
+eptr<struct status_change, StatusChange> battle_get_sc_data(struct block_list *bl)
{
- nullpo_retr(NULL, bl);
- if (bl->type == BL_MOB && (struct mob_data *) bl)
- return ((struct mob_data *) bl)->sc_data;
- else if (bl->type == BL_PC && (struct map_session_data *) bl)
- return ((struct map_session_data *) bl)->sc_data;
- return NULL;
+ nullpo_retr(nullptr, bl);
+
+ switch (bl->type)
+ {
+ case BL_MOB:
+ return ((struct mob_data *)(bl))->sc_data;
+ case BL_PC:
+ return ((struct map_session_data *)(bl))->sc_data;
+ }
+ return nullptr;
}
short *battle_get_sc_count(struct block_list *bl)
@@ -1444,7 +1453,7 @@ int battle_damage(struct block_list *bl, struct block_list *target,
int damage, int flag)
{
struct map_session_data *sd = NULL;
- struct status_change *sc_data = battle_get_sc_data(target);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(target);
short *sc_count;
int i;
@@ -1492,7 +1501,7 @@ int battle_damage(struct block_list *bl, struct block_list *target,
struct map_session_data *tsd = (struct map_session_data *) target;
- if (tsd && tsd->sc_data && tsd->sc_data[SC_DEVOTION].val1)
+ if (tsd && tsd->sc_data[SC_DEVOTION].val1)
{ // ディボーションをかけられている
struct map_session_data *md =
map_id2sd(tsd->sc_data[SC_DEVOTION].val1);
@@ -1598,12 +1607,12 @@ int battle_attr_fix(int damage, int atk_elem, int def_elem)
*------------------------------------------
*/
int battle_calc_damage(struct block_list *src, struct block_list *bl,
- int damage, int div_, int skill_num, int skill_lv,
- int flag)
+ int damage, int div_,
+ SkillID skill_num, int skill_lv, int flag)
{
struct map_session_data *sd = NULL;
struct mob_data *md = NULL;
- struct status_change *sc_data, *sc;
+ eptr<struct status_change, StatusChange> sc_data;
short *sc_count;
int class_;
@@ -1700,8 +1709,9 @@ int battle_calc_damage(struct block_list *src, struct block_list *bl,
}
if (sc_data[SC_KYRIE].timer != -1 && damage > 0)
- { // キリエエレイソン
- sc = &sc_data[SC_KYRIE];
+ {
+ // キリエエレイソン
+ struct status_change *sc = &sc_data[SC_KYRIE];
sc->val2 -= damage;
if (flag & BF_WEAPON)
{
@@ -1756,10 +1766,10 @@ int battle_calc_damage(struct block_list *src, struct block_list *bl,
// リジェクトソード
if (sc_data[SC_REJECTSWORD].timer != -1 && damage > 0
&& flag & BF_WEAPON
- &&
+ && // the logic was always broken, I've simplfied to what it
+ // was doing, it's not like this will be sticking around long
((src->type == BL_PC
- && ((struct map_session_data *) src)->status.weapon == (1 || 2
- || 3))
+ && ((struct map_session_data *) src)->status.weapon == 1)
|| src->type == BL_MOB))
{
if (MRAND(100) < (10 + 5 * sc_data[SC_REJECTSWORD].val1))
@@ -1953,7 +1963,7 @@ int battle_addmastery(struct map_session_data *sd, struct block_list *target,
static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
struct block_list *target,
- int skill_num,
+ SkillID skill_num,
int skill_lv, int wflag)
{
struct map_session_data *tsd = NULL;
@@ -1968,7 +1978,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
skill_get_blewcount(skill_num, skill_lv);
int flag, skill, ac_flag = 0, dmg_lv = 0;
int t_mode = 0, t_race = 0, t_size = 1, s_race = 0, s_ele = 0;
- struct status_change *sc_data, *t_sc_data;
+ eptr<struct status_change, StatusChange> sc_data, t_sc_data;
short *sc_count;
short *option, *opt1, *opt2;
@@ -1998,7 +2008,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
t_mode = battle_get_mode(target);
t_sc_data = battle_get_sc_data(target);
- if ((skill_num == 0
+ if ((skill_num == SkillID::ZERO
|| (target->type == BL_PC && battle_config.pc_auto_counter_type & 2)
|| (target->type == BL_MOB
&& battle_config.monster_auto_counter_type & 2))
@@ -2087,7 +2097,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
if (atkmin > atkmax)
atkmin = atkmax;
- if (sc_data != NULL && sc_data[SC_MAXIMIZEPOWER].timer != -1)
+ if (sc_data && sc_data[SC_MAXIMIZEPOWER].timer != -1)
{ // マキシマイズパワー
atkmin = atkmax;
}
@@ -2100,7 +2110,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
if (cri < 1)
cri = 1;
}
- if (t_sc_data != NULL && t_sc_data[SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に
+ if (t_sc_data && t_sc_data[SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に
cri <<= 1;
if (ac_flag)
@@ -2117,7 +2127,10 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
if (tsd && tsd->critical_def)
cri = cri * (100 - tsd->critical_def) / 100;
- if ((skill_num == 0 || skill_num == KN_AUTOCOUNTER) && skill_lv >= 0 && battle_config.enemy_critical && (MRAND(1000)) < cri) // 判定(スキルの場合は無視)
+ if ((skill_num == SkillID::ZERO || skill_num == KN_AUTOCOUNTER)
+ && skill_lv >= 0 && battle_config.enemy_critical
+ && (MRAND(1000)) < cri)
+ // 判定(スキルの場合は無視)
// 敵の判定
{
damage += atkmax;
@@ -2148,7 +2161,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
damage += damage * 50 / 100;
}
- if (skill_num > 0)
+ if (skill_num != SkillID::ZERO && skill_num != SkillID::NEGATIVE)
{
int i;
if ((i = skill_get_pl(skill_num)) > 0)
@@ -2462,7 +2475,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
if (hitrate < 1000000)
hitrate = ((hitrate > 95) ? 95 : ((hitrate < 5) ? 5 : hitrate));
if (hitrate < 1000000 && // 必中攻撃
- (t_sc_data != NULL && (t_sc_data[SC_SLEEP].timer != -1 || // 睡眠は必中
+ (t_sc_data && (t_sc_data[SC_SLEEP].timer != -1 || // 睡眠は必中
t_sc_data[SC_STAN].timer != -1 || // スタンは必中
t_sc_data[SC_FREEZE].timer != -1 || (t_sc_data[SC_STONE].timer != -1 && t_sc_data[SC_STONE].val2 == 0)))) // 凍結は必中
hitrate = 1000000;
@@ -2520,7 +2533,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
// 属 性の適用
if (!((battle_config.mob_ghostring_fix == 1) && (battle_get_element(target) == 8) && (target->type == BL_PC))) // [MouseJstr]
- if (skill_num != 0 || s_ele != 0
+ if (skill_num != SkillID::ZERO || s_ele != 0
|| !battle_config.mob_attack_attr_none)
damage =
battle_attr_fix(damage, s_ele, battle_get_element(target));
@@ -2543,7 +2556,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
}
// 完全回避の判定
- if (skill_num == 0 && skill_lv >= 0 && tsd != NULL
+ if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != NULL
&& MRAND(1000) < battle_get_flee2(target))
{
damage = 0;
@@ -2553,7 +2566,7 @@ static struct Damage battle_calc_mob_weapon_attack(struct block_list *src,
if (battle_config.enemy_perfect_flee)
{
- if (skill_num == 0 && skill_lv >= 0 && tmd != NULL
+ if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != NULL
&& MRAND(1000) < battle_get_flee2(target))
{
damage = 0;
@@ -2610,7 +2623,7 @@ int battle_is_unarmed(struct block_list *bl)
*/
static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
struct block_list *target,
- int skill_num,
+ SkillID skill_num,
int skill_lv, int wflag)
{
struct map_session_data *sd = (struct map_session_data *) src, *tsd =
@@ -2626,7 +2639,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
skill_get_blewcount(skill_num, skill_lv);
int flag, skill, dmg_lv = 0;
int t_mode = 0, t_race = 0, t_size = 1, s_race = 7, s_ele = 0;
- struct status_change *sc_data, *t_sc_data;
+ eptr<struct status_change, StatusChange> sc_data, t_sc_data;
short *sc_count;
short *option, *opt1, *opt2;
int atkmax_ = 0, atkmin_ = 0, s_ele_; //二刀流用
@@ -2668,7 +2681,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
t_sc_data = battle_get_sc_data(target); //対象のステータス異常
//オートカウンター処理ここから
- if ((skill_num == 0
+ if ((skill_num == SkillID::ZERO
|| (target->type == BL_PC && battle_config.pc_auto_counter_type & 2)
|| (target->type == BL_MOB
&& battle_config.monster_auto_counter_type & 2))
@@ -2806,7 +2819,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
atkmax_ = (watk_ * sd->atkmods_[t_size]) / 100;
atkmin_ = (atkmin_ * sd->atkmods[t_size]) / 100;
}
- if ((sc_data != NULL && sc_data[SC_WEAPONPERFECTION].timer != -1)
+ if ((sc_data && sc_data[SC_WEAPONPERFECTION].timer != -1)
|| (sd->special_state.no_sizefix))
{ // ウェポンパーフェクション || ドレイクカード
atkmax = watk;
@@ -2818,7 +2831,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
if (atkmin_ > atkmax_)
atkmin_ = atkmax_;
- if (sc_data != NULL && sc_data[SC_MAXIMIZEPOWER].timer != -1)
+ if (sc_data && sc_data[SC_MAXIMIZEPOWER].timer != -1)
{ // マキシマイズパワー
atkmin = atkmax;
atkmin_ = atkmax_;
@@ -2827,20 +2840,20 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
//ダブルアタック判定
if (sd->weapontype1 == 0x01)
{
- if (skill_num == 0 && skill_lv >= 0
+ if (skill_num == SkillID::ZERO && skill_lv >= 0
&& (skill = pc_checkskill(sd, TF_DOUBLE)) > 0)
da = (MRAND(100) < (skill * 5)) ? 1 : 0;
}
//三段掌
- if (skill_num == 0 && skill_lv >= 0
+ if (skill_num == SkillID::ZERO && skill_lv >= 0
&& (skill = pc_checkskill(sd, MO_TRIPLEATTACK)) > 0
&& sd->status.weapon <= 16 && !sd->state.arrow_atk)
{
da = (MRAND(100) < (30 - skill)) ? 2 : 0;
}
- if (sd->double_rate > 0 && da == 0 && skill_num == 0 && skill_lv >= 0)
+ if (sd->double_rate > 0 && da == 0 && skill_num == SkillID::ZERO && skill_lv >= 0)
da = (MRAND(100) < sd->double_rate) ? 1 : 0;
// 過剰精錬ボーナス
@@ -2860,7 +2873,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
// カタールの場合、クリティカルを倍に
cri <<= 1;
cri -= battle_get_luk(target) * 3;
- if (t_sc_data != NULL && t_sc_data[SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に
+ if (t_sc_data && t_sc_data[SC_SLEEP].timer != -1) // 睡眠中はクリティカルが倍に
cri <<= 1;
if (ac_flag)
cri = 1000;
@@ -2880,7 +2893,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
if (tsd && tsd->critical_def)
cri = cri * (100 - tsd->critical_def) / 100;
- if (da == 0 && (skill_num == 0 || skill_num == KN_AUTOCOUNTER || skill_num == SN_SHARPSHOOTING) && skill_lv >= 0 && //ダブルアタックが発動していない
+ if (da == 0 && (skill_num == SkillID::ZERO || skill_num == KN_AUTOCOUNTER || skill_num == SN_SHARPSHOOTING) && skill_lv >= 0 && //ダブルアタックが発動していない
(MRAND(1000)) < cri) // 判定(スキルの場合は無視)
{
damage += atkmax;
@@ -3018,7 +3031,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
}
}
- if (skill_num > 0)
+ if (skill_num != SkillID::ZERO && skill_num != SkillID::NEGATIVE)
{
int i;
if ((i = skill_get_pl(skill_num)) > 0)
@@ -3680,7 +3693,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
// 回避修正
hitrate = (hitrate < 5) ? 5 : hitrate;
if (hitrate < 1000000 && // 必中攻撃
- (t_sc_data != NULL && (t_sc_data[SC_SLEEP].timer != -1 || // 睡眠は必中
+ (t_sc_data && (t_sc_data[SC_SLEEP].timer != -1 || // 睡眠は必中
t_sc_data[SC_STAN].timer != -1 || // スタンは必中
t_sc_data[SC_FREEZE].timer != -1 || (t_sc_data[SC_STONE].timer != -1 && t_sc_data[SC_STONE].val2 == 0)))) // 凍結は必中
hitrate = 1000000;
@@ -3941,7 +3954,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
}
// 完全回避の判定
- if (skill_num == 0 && skill_lv >= 0 && tsd != NULL && div_ < 255
+ if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != NULL && div_ < 255
&& MRAND(1000) < battle_get_flee2(target))
{
damage = damage2 = 0;
@@ -3952,7 +3965,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
// 対象が完全回避をする設定がONなら
if (battle_config.enemy_perfect_flee)
{
- if (skill_num == 0 && skill_lv >= 0 && tmd != NULL && div_ < 255
+ if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != NULL && div_ < 255
&& MRAND(1000) < battle_get_flee2(target))
{
damage = damage2 = 0;
@@ -4000,7 +4013,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
/* For executioner card [Valaris] */
if (src->type == BL_PC && sd->random_attack_increase_add > 0
- && sd->random_attack_increase_per > 0 && skill_num == 0)
+ && sd->random_attack_increase_per > 0 && skill_num == SkillID::ZERO)
{
if (MRAND(100) < sd->random_attack_increase_per)
{
@@ -4040,7 +4053,7 @@ static struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
*/
struct Damage battle_calc_weapon_attack(struct block_list *src,
struct block_list *target,
- int skill_num, int skill_lv,
+ SkillID skill_num, int skill_lv,
int wflag)
{
struct Damage wd;
@@ -4119,7 +4132,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,
*/
struct Damage battle_calc_magic_attack(struct block_list *bl,
struct block_list *target,
- int skill_num, int skill_lv, int flag)
+ SkillID skill_num, int skill_lv, int flag)
{
int mdef1 = battle_get_mdef(target);
int mdef2 = battle_get_mdef2(target);
@@ -4165,7 +4178,7 @@ struct Damage battle_calc_magic_attack(struct block_list *bl,
aflag = BF_MAGIC | BF_LONG | BF_SKILL;
- if (skill_num > 0)
+ if (skill_num != SkillID::ZERO && skill_num != SkillID::NEGATIVE)
{
switch (skill_num)
{ // 基本ダメージ計算(スキルごとに処理)
@@ -4452,7 +4465,7 @@ struct Damage battle_calc_magic_attack(struct block_list *bl,
*/
struct Damage battle_calc_misc_attack(struct block_list *bl,
struct block_list *target,
- int skill_num, int skill_lv, int flag)
+ SkillID skill_num, int skill_lv, int flag)
{
int int_ = battle_get_int(bl);
// int luk=battle_get_luk(bl);
@@ -4528,7 +4541,7 @@ struct Damage battle_calc_misc_attack(struct block_list *bl,
case NPC_DARKBREATH:
{
- struct status_change *sc_data = battle_get_sc_data(target);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(target);
int hitrate =
battle_get_hit(bl) - battle_get_flee(target) + 80;
hitrate = ((hitrate > 95) ? 95 : ((hitrate < 5) ? 5 : hitrate));
@@ -4608,7 +4621,7 @@ struct Damage battle_calc_misc_attack(struct block_list *bl,
*/
struct Damage battle_calc_attack(int attack_type,
struct block_list *bl,
- struct block_list *target, int skill_num,
+ struct block_list *target, SkillID skill_num,
int skill_lv, int flag)
{
struct Damage d;
@@ -4642,8 +4655,8 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
unsigned int tick, int flag)
{
struct map_session_data *sd = NULL;
- struct status_change *sc_data = battle_get_sc_data(src), *t_sc_data =
- battle_get_sc_data(target);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> t_sc_data = battle_get_sc_data(target);
short *opt1;
int race = 7, ele = 0;
int damage, rdamage = 0;
@@ -4707,7 +4720,7 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
flag & 0xff, 0);
}
else
- wd = battle_calc_weapon_attack(src, target, 0, 0, 0);
+ wd = battle_calc_weapon_attack(src, target, SkillID::ZERO, 0, 0);
// significantly increase injuries for hasted characters
if (wd.damage > 0 && (t_sc_data[SC_HASTE].timer != -1))
@@ -4781,8 +4794,8 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
if ((skilllv = pc_checkskill(sd, MO_CHAINCOMBO)) > 0)
delay += 300 * battle_config.combo_delay_rate / 100; //追加ディレイをconfにより調整
- skill_status_change_start(src, SC_COMBO, MO_TRIPLEATTACK,
- skilllv, 0, 0, delay, 0);
+ skill_status_change_start(src, SC_COMBO,
+ uint16_t(MO_TRIPLEATTACK), skilllv, 0, 0, delay, 0);
}
sd->attackabletime = sd->canmove_tick = tick + delay;
clif_combo_delay(src, delay);
@@ -4800,7 +4813,7 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
0, 1, 0, 0);
}
if (sd && sd->splash_range > 0 && (wd.damage > 0 || wd.damage2 > 0))
- skill_castend_damage_id(src, target, 0, -1, tick, 0);
+ skill_castend_damage_id(src, target, SkillID::ZERO, -1, tick, 0);
map_freeblock_lock();
if (src->type == BL_PC)
@@ -4844,7 +4857,7 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
{
if (wd.damage > 0 || wd.damage2 > 0)
{
- skill_additional_effect(src, target, 0, 0, BF_WEAPON, tick);
+ skill_additional_effect(src, target, SkillID::ZERO, 0, BF_WEAPON, tick);
if (sd)
{
if (sd->weapon_coma_ele[ele] > 0
@@ -4885,46 +4898,39 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
skilllv = 1;
if (sd)
{
- int sp = skill_get_sp(sc_data[SC_AUTOSPELL].val2,
- skilllv) * 2 / 3;
+ int sp = skill_get_sp(SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv) * 2 / 3;
if (sd->status.sp >= sp)
{
- if ((i = skill_get_inf(sc_data[SC_AUTOSPELL].val2) == 2)
- || i == 32)
+ // obviously not what was intended
+ // but this is going away soon anyway
+ i = skill_get_inf(SkillID(sc_data[SC_AUTOSPELL].val2)) == 2;
+ if (i || i == 32)
f = skill_castend_pos2(src, target->x, target->y,
- sc_data[SC_AUTOSPELL].val2,
- skilllv, tick, flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
else
{
- switch (skill_get_nk(sc_data[SC_AUTOSPELL].val2))
+ switch (skill_get_nk(SkillID(sc_data[SC_AUTOSPELL].val2)))
{
case 0:
case 2:
f = skill_castend_damage_id(src, target,
- sc_data
- [SC_AUTOSPELL].val2,
- skilllv, tick,
- flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
break;
case 1: /* 支援系 */
- if ((sc_data[SC_AUTOSPELL].val2 == AL_HEAL
- || (sc_data[SC_AUTOSPELL].val2 ==
- ALL_RESURRECTION
+ if ((SkillID(sc_data[SC_AUTOSPELL].val2) == AL_HEAL
+ || (SkillID(sc_data[SC_AUTOSPELL].val2) == ALL_RESURRECTION
&& target->type != BL_PC))
&& battle_check_undead(race, ele))
f = skill_castend_damage_id(src, target,
- sc_data
- [SC_AUTOSPELL].val2,
- skilllv,
- tick, flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
else
- f = skill_castend_nodamage_id(src,
- target,
- sc_data
- [SC_AUTOSPELL].val2,
- skilllv,
- tick,
- flag);
+ f = skill_castend_nodamage_id(src, target,
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
break;
}
}
@@ -4934,38 +4940,33 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
}
else
{
- if ((i = skill_get_inf(sc_data[SC_AUTOSPELL].val2) == 2)
- || i == 32)
+ i = skill_get_inf(SkillID(sc_data[SC_AUTOSPELL].val2)) == 2;
+ if (i || i == 32)
skill_castend_pos2(src, target->x, target->y,
- sc_data[SC_AUTOSPELL].val2, skilllv,
- tick, flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
else
{
- switch (skill_get_nk(sc_data[SC_AUTOSPELL].val2))
+ switch (skill_get_nk(SkillID(sc_data[SC_AUTOSPELL].val2)))
{
case 0:
case 2:
skill_castend_damage_id(src, target,
- sc_data
- [SC_AUTOSPELL].val2,
- skilllv, tick, flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
break;
case 1: /* 支援系 */
- if ((sc_data[SC_AUTOSPELL].val2 == AL_HEAL
- || (sc_data[SC_AUTOSPELL].val2 ==
- ALL_RESURRECTION
+ if ((SkillID(sc_data[SC_AUTOSPELL].val2) == AL_HEAL
+ || (SkillID(sc_data[SC_AUTOSPELL].val2) == ALL_RESURRECTION
&& target->type != BL_PC))
&& battle_check_undead(race, ele))
skill_castend_damage_id(src, target,
- sc_data
- [SC_AUTOSPELL].val2,
- skilllv, tick, flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
else
skill_castend_nodamage_id(src, target,
- sc_data
- [SC_AUTOSPELL].val2,
- skilllv, tick,
- flag);
+ SkillID(sc_data[SC_AUTOSPELL].val2),
+ skilllv, tick, flag);
break;
}
}
@@ -4973,7 +4974,9 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
}
if (sd)
{
- if (sd->autospell_id > 0 && sd->autospell_lv > 0
+ if (sd->autospell_id != SkillID::ZERO
+ && sd->autospell_id != SkillID::NEGATIVE
+ && sd->autospell_lv > 0
&& MRAND(100) < sd->autospell_rate)
{
int skilllv = sd->autospell_lv, i, f = 0, sp;
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index b907f17..50c3195 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -2,6 +2,9 @@
#ifndef BATTLE_HPP
#define BATTLE_HPP
+#include "../common/utils.hpp"
+#include "skill.t.hpp"
+
// ダメージ
struct Damage
{
@@ -23,28 +26,24 @@ struct block_list;
// ダメージ計算
struct Damage battle_calc_attack(int attack_type,
- struct block_list *bl,
- struct block_list *target, int skill_num,
- int skill_lv, int flag);
-struct Damage battle_calc_weapon_attack(struct block_list *bl,
- struct block_list *target,
- int skill_num, int skill_lv,
- int flag);
-struct Damage battle_calc_magic_attack(struct block_list *bl,
- struct block_list *target,
- int skill_num, int skill_lv,
- int flag);
-struct Damage battle_calc_misc_attack(struct block_list *bl,
- struct block_list *target,
- int skill_num, int skill_lv, int flag);
+ struct block_list *bl, struct block_list *target,
+ SkillID skill_num, int skill_lv, int flag);
+struct Damage battle_calc_weapon_attack(
+ struct block_list *bl, struct block_list *target,
+ SkillID skill_num, int skill_lv, int flag);
+struct Damage battle_calc_magic_attack(
+ struct block_list *bl, struct block_list *target,
+ SkillID skill_num, int skill_lv, int flag);
+struct Damage battle_calc_misc_attack(
+ struct block_list *bl, struct block_list *target,
+ SkillID skill_num, int skill_lv, int flag);
// 属性修正計算
int battle_attr_fix(int damage, int atk_elem, int def_elem);
// ダメージ最終計算
int battle_calc_damage(struct block_list *src, struct block_list *bl,
- int damage, int div_, int skill_num, int skill_lv,
- int flag);
+ int damage, int div_, SkillID skill_num, int skill_lv, int flag);
enum
{ // 最終計算のフラグ
BF_WEAPON = 0x0001,
@@ -118,7 +117,7 @@ int battle_get_mexp(struct block_list *bl);
int battle_get_stat(int stat_id /* SP_VIT or similar */ ,
struct block_list *bl);
-struct status_change *battle_get_sc_data(struct block_list *bl);
+eptr<struct status_change, StatusChange> battle_get_sc_data(struct block_list *bl);
short *battle_get_sc_count(struct block_list *bl);
short *battle_get_opt1(struct block_list *bl);
short *battle_get_opt2(struct block_list *bl);
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 9f287ae..0b95208 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -2595,9 +2595,9 @@ int clif_changeoption(struct block_list *bl)
{
uint8_t buf[32];
short option;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
static const int omask[] = { 0x10, 0x20 };
- static const int scnum[] = { SC_FALCON, SC_RIDING };
+ static const StatusChange scnum[] = { SC_FALCON, SC_RIDING };
int i;
nullpo_retr(0, bl);
@@ -3371,7 +3371,7 @@ int clif_damage(struct block_list *src, struct block_list *dst,
int div, int type, int damage2)
{
unsigned char buf[256];
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, src);
nullpo_retr(0, dst);
@@ -3731,18 +3731,19 @@ void clif_mobinsight(struct block_list *bl, va_list ap)
*
*------------------------------------------
*/
-int clif_skillinfo(struct map_session_data *sd, int skillid, int type,
+int clif_skillinfo(struct map_session_data *sd, SkillID skillid, int type,
int range)
{
- int fd, id;
+ int fd;
nullpo_retr(0, sd);
fd = sd->fd;
- if ((id = sd->status.skill[skillid].id) <= 0)
+ SkillID id = sd->status.skill[skillid].id;
+ if (id == SkillID::ZERO || id == SkillID::NEGATIVE)
return 0;
WFIFOW(fd, 0) = 0x147;
- WFIFOW(fd, 2) = id;
+ WFIFOW(fd, 2) = uint16_t(id);
if (type < 0)
WFIFOW(fd, 4) = skill_get_inf(id);
else
@@ -3774,17 +3775,19 @@ int clif_skillinfo(struct map_session_data *sd, int skillid, int type,
int clif_skillinfoblock(struct map_session_data *sd)
{
int fd;
- int i, c, len = 4, id, range;
+ int len = 4, range;
nullpo_retr(0, sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x10f;
- for (i = c = 0; i < MAX_SKILL; i++)
+ for (SkillID i : erange(SkillID(), MAX_SKILL))
{
- if ((id = sd->status.skill[i].id) != 0 && (sd->tmw_version >= 1))
- { // [Fate] Version 1 and later don't crash because of bad skill IDs anymore
- WFIFOW(fd, len) = id;
+ SkillID id = sd->status.skill[i].id;
+ if (id != SkillID::ZERO && sd->tmw_version >= 1)
+ {
+ // [Fate] Version 1 and later don't crash because of bad skill IDs anymore
+ WFIFOW(fd, len) = uint16_t(id);
WFIFOW(fd, len + 2) = skill_get_inf(id);
WFIFOW(fd, len + 4) =
skill_db[i].poolflags | (sd->status.
@@ -3800,7 +3803,6 @@ int clif_skillinfoblock(struct map_session_data *sd)
WFIFOB(fd, len + 36) =
(sd->status.skill[i].lv < skill_get_max_raise(id)) ? 1 : 0;
len += 37;
- c++;
}
}
WFIFOW(fd, 2) = len;
@@ -3813,7 +3815,7 @@ int clif_skillinfoblock(struct map_session_data *sd)
* スキル割り振り通知
*------------------------------------------
*/
-int clif_skillup(struct map_session_data *sd, int skill_num)
+int clif_skillup(struct map_session_data *sd, SkillID skill_num)
{
int range, fd;
@@ -3821,7 +3823,7 @@ int clif_skillup(struct map_session_data *sd, int skill_num)
fd = sd->fd;
WFIFOW(fd, 0) = 0x10e;
- WFIFOW(fd, 2) = skill_num;
+ WFIFOW(fd, 2) = uint16_t(skill_num);
WFIFOW(fd, 4) = sd->status.skill[skill_num].lv;
WFIFOW(fd, 6) = skill_get_sp(skill_num, sd->status.skill[skill_num].lv);
range = skill_get_range(skill_num, sd->status.skill[skill_num].lv);
@@ -3842,7 +3844,7 @@ int clif_skillup(struct map_session_data *sd, int skill_num)
*/
int clif_skillcasting(struct block_list *bl,
int src_id, int dst_id, int dst_x, int dst_y,
- int skill_num, int casttime)
+ SkillID skill_num, int casttime)
{
unsigned char buf[32];
WBUFW(buf, 0) = 0x13e;
@@ -3850,7 +3852,7 @@ int clif_skillcasting(struct block_list *bl,
WBUFL(buf, 6) = dst_id;
WBUFW(buf, 10) = dst_x;
WBUFW(buf, 12) = dst_y;
- WBUFW(buf, 14) = skill_num; //魔法詠唱スキル
+ WBUFW(buf, 14) = uint16_t(skill_num); //魔法詠唱スキル
WBUFL(buf, 16) = skill_get_pl(skill_num); //属性
WBUFL(buf, 20) = casttime; //skill詠唱時間
clif_send(buf, packet_len_table[0x13e], bl, AREA);
@@ -3879,7 +3881,7 @@ int clif_skillcastcancel(struct block_list *bl)
* スキル詠唱失敗
*------------------------------------------
*/
-int clif_skill_fail(struct map_session_data *sd, int skill_id, int type,
+int clif_skill_fail(struct map_session_data *sd, SkillID skill_id, int type,
int btype)
{
int fd;
@@ -3894,7 +3896,7 @@ int clif_skill_fail(struct map_session_data *sd, int skill_id, int type,
}
WFIFOW(fd, 0) = 0x110;
- WFIFOW(fd, 2) = skill_id;
+ WFIFOW(fd, 2) = uint16_t(skill_id);
WFIFOW(fd, 4) = btype;
WFIFOW(fd, 6) = 0;
WFIFOB(fd, 8) = 0;
@@ -3910,10 +3912,10 @@ int clif_skill_fail(struct map_session_data *sd, int skill_id, int type,
*/
int clif_skill_damage(struct block_list *src, struct block_list *dst,
unsigned int tick, int sdelay, int ddelay, int damage,
- int div, int skill_id, int skill_lv, int type)
+ int div, SkillID skill_id, int skill_lv, int type)
{
unsigned char buf[64];
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, src);
nullpo_retr(0, dst);
@@ -3933,7 +3935,7 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst,
}
WBUFW(buf, 0) = 0x1de;
- WBUFW(buf, 2) = skill_id;
+ WBUFW(buf, 2) = uint16_t(skill_id);
WBUFL(buf, 4) = src->id;
WBUFL(buf, 8) = dst->id;
WBUFL(buf, 12) = tick;
@@ -3954,10 +3956,10 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst,
*/
int clif_skill_damage2(struct block_list *src, struct block_list *dst,
unsigned int tick, int sdelay, int ddelay, int damage,
- int div, int skill_id, int skill_lv, int type)
+ int div, SkillID skill_id, int skill_lv, int type)
{
unsigned char buf[64];
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, src);
nullpo_retr(0, dst);
@@ -3977,7 +3979,7 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst,
}
WBUFW(buf, 0) = 0x115;
- WBUFW(buf, 2) = skill_id;
+ WBUFW(buf, 2) = uint16_t(skill_id);
WBUFL(buf, 4) = src->id;
WBUFL(buf, 8) = dst->id;
WBUFL(buf, 12) = tick;
@@ -3999,7 +4001,7 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst,
*------------------------------------------
*/
int clif_skill_nodamage(struct block_list *src, struct block_list *dst,
- int skill_id, int heal, int fail)
+ SkillID skill_id, int heal, int fail)
{
unsigned char buf[32];
@@ -4007,7 +4009,7 @@ int clif_skill_nodamage(struct block_list *src, struct block_list *dst,
nullpo_retr(0, dst);
WBUFW(buf, 0) = 0x11a;
- WBUFW(buf, 2) = skill_id;
+ WBUFW(buf, 2) = uint16_t(skill_id);
WBUFW(buf, 4) = (heal > 0x7fff) ? 0x7fff : heal;
WBUFL(buf, 6) = dst->id;
WBUFL(buf, 10) = src->id;
@@ -4021,7 +4023,7 @@ int clif_skill_nodamage(struct block_list *src, struct block_list *dst,
* 場所スキルエフェクト
*------------------------------------------
*/
-int clif_skill_poseffect(struct block_list *src, int skill_id, int val,
+int clif_skill_poseffect(struct block_list *src, SkillID skill_id, int val,
int x, int y, int tick)
{
unsigned char buf[32];
@@ -4029,7 +4031,7 @@ int clif_skill_poseffect(struct block_list *src, int skill_id, int val,
nullpo_retr(0, src);
WBUFW(buf, 0) = 0x117;
- WBUFW(buf, 2) = skill_id;
+ WBUFW(buf, 2) = uint16_t(skill_id);
WBUFL(buf, 4) = src->id;
WBUFW(buf, 8) = val;
WBUFW(buf, 10) = x;
@@ -4117,7 +4119,7 @@ int clif_skill_delunit(struct skill_unit *unit)
* ワープ場所選択
*------------------------------------------
*/
-int clif_skill_warppoint(struct map_session_data *sd, int skill_num,
+int clif_skill_warppoint(struct map_session_data *sd, SkillID skill_num,
const char *map1, const char *map2,
const char *map3, const char *map4)
{
@@ -4127,7 +4129,7 @@ int clif_skill_warppoint(struct map_session_data *sd, int skill_num,
fd = sd->fd;
WFIFOW(fd, 0) = 0x11c;
- WFIFOW(fd, 2) = skill_num;
+ WFIFOW(fd, 2) = uint16_t(skill_num);
memcpy(WFIFOP(fd, 4), map1, 16);
memcpy(WFIFOP(fd, 20), map2, 16);
memcpy(WFIFOP(fd, 36), map3, 16);
@@ -4213,14 +4215,14 @@ int clif_skill_estimation(struct map_session_data *sd,
* 状態異常アイコン/メッセージ表示
*------------------------------------------
*/
-int clif_status_change(struct block_list *bl, int type, int flag)
+int clif_status_change(struct block_list *bl, StatusChange type, int flag)
{
unsigned char buf[16];
nullpo_retr(0, bl);
WBUFW(buf, 0) = 0x0196;
- WBUFW(buf, 2) = type;
+ WBUFW(buf, 2) = uint16_t(type);
WBUFL(buf, 4) = bl->id;
WBUFB(buf, 8) = flag;
clif_send(buf, packet_len_table[0x196], bl, AREA);
@@ -4611,7 +4613,7 @@ int clif_item_repair_list(struct map_session_data *sd)
* アイテムによる一時的なスキル効果
*------------------------------------------
*/
-int clif_item_skill(struct map_session_data *sd, int skillid, int skilllv,
+int clif_item_skill(struct map_session_data *sd, SkillID skillid, int skilllv,
const char *name)
{
int range, fd;
@@ -4620,7 +4622,7 @@ int clif_item_skill(struct map_session_data *sd, int skillid, int skilllv,
fd = sd->fd;
WFIFOW(fd, 0) = 0x147;
- WFIFOW(fd, 2) = skillid;
+ WFIFOW(fd, 2) = uint16_t(skillid);
WFIFOW(fd, 4) = skill_get_inf(skillid);
WFIFOW(fd, 6) = 0;
WFIFOW(fd, 8) = skilllv;
@@ -5195,31 +5197,31 @@ int clif_autospell(struct map_session_data *sd, int skilllv)
WFIFOW(fd, 0) = 0x1cd;
if (skilllv > 0 && pc_checkskill(sd, MG_NAPALMBEAT) > 0)
- WFIFOL(fd, 2) = MG_NAPALMBEAT;
+ WFIFOL(fd, 2) = uint16_t(MG_NAPALMBEAT);
else
WFIFOL(fd, 2) = 0x00000000;
if (skilllv > 1 && pc_checkskill(sd, MG_COLDBOLT) > 0)
- WFIFOL(fd, 6) = MG_COLDBOLT;
+ WFIFOL(fd, 6) = uint16_t(MG_COLDBOLT);
else
WFIFOL(fd, 6) = 0x00000000;
if (skilllv > 1 && pc_checkskill(sd, MG_FIREBOLT) > 0)
- WFIFOL(fd, 10) = MG_FIREBOLT;
+ WFIFOL(fd, 10) = uint16_t(MG_FIREBOLT);
else
WFIFOL(fd, 10) = 0x00000000;
if (skilllv > 1 && pc_checkskill(sd, MG_LIGHTNINGBOLT) > 0)
- WFIFOL(fd, 14) = MG_LIGHTNINGBOLT;
+ WFIFOL(fd, 14) = uint16_t(MG_LIGHTNINGBOLT);
else
WFIFOL(fd, 14) = 0x00000000;
if (skilllv > 4 && pc_checkskill(sd, MG_SOULSTRIKE) > 0)
- WFIFOL(fd, 18) = MG_SOULSTRIKE;
+ WFIFOL(fd, 18) = uint16_t(MG_SOULSTRIKE);
else
WFIFOL(fd, 18) = 0x00000000;
if (skilllv > 7 && pc_checkskill(sd, MG_FIREBALL) > 0)
- WFIFOL(fd, 22) = MG_FIREBALL;
+ WFIFOL(fd, 22) = uint16_t(MG_FIREBALL);
else
WFIFOL(fd, 22) = 0x00000000;
if (skilllv > 9 && pc_checkskill(sd, MG_FROSTDIVER) > 0)
- WFIFOL(fd, 26) = MG_FROSTDIVER;
+ WFIFOL(fd, 26) = uint16_t(MG_FROSTDIVER);
else
WFIFOL(fd, 26) = 0x00000000;
@@ -5922,7 +5924,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd)
&& (sd->opt1
|| (sd->opt2 && !(night_flag == 1 && sd->opt2 == STATE_BLIND))))
|| sd->skilltimer != -1 || (DIFF_TICK(tick, sd->canact_tick) < 0)
- || (sd->sc_data && sd->sc_data[SC_DANCING].timer != -1
+ || (sd->sc_data[SC_DANCING].timer != -1
&& sd->sc_data[SC_DANCING].val4
&& (sg = (struct skill_unit_group *) sd->sc_data[SC_DANCING].val2)
&& sg->src_id == sd->bl.id))
@@ -6078,7 +6080,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd)
}
if (is_atcommand(fd, sd, message, 0) != AtCommand_None
- || (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1 //バーサーク時は会話も不可
+ || ((sd->sc_data[SC_BERSERK].timer != -1 //バーサーク時は会話も不可
|| sd->sc_data[SC_NOCHAT].timer != -1)))//チャット禁止
{
free(buf);
@@ -6214,7 +6216,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd)
clif_send(buf, packet_len_table[0xc0], &sd->bl, AREA);
}
else
- clif_skill_fail(sd, 1, 0, 1);
+ clif_skill_fail(sd, SkillID::ONE, 0, 1);
}
/*==========================================
@@ -6248,7 +6250,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd)
return;
}
if (sd->npc_id != 0 || sd->opt1 > 0 || sd->status.option & 2 || sd->state.storage_open ||
- (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ ((sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
sd->sc_data[SC_DANCING].timer != -1)))
return;
@@ -6273,7 +6275,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd)
{
if (DIFF_TICK(tick, sd->canact_tick) < 0)
{
- clif_skill_fail(sd, 1, 4, 0);
+ clif_skill_fail(sd, SkillID::ONE, 4, 0);
return;
}
}
@@ -6370,7 +6372,7 @@ void clif_parse_Wis(int fd, struct map_session_data *sd)
}
if (is_atcommand(fd, sd, message, 0) != AtCommand_None
- || (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1
+ || ((sd->sc_data[SC_BERSERK].timer != -1
|| sd->sc_data[SC_NOCHAT].timer != -1)))
{
free(buf);
@@ -6483,7 +6485,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
return;
}
- if (sd->npc_id != 0 || sd->opt1 > 0 || (sd->sc_data &&
+ if (sd->npc_id != 0 || sd->opt1 > 0 || (
(sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
sd->sc_data[SC_BERSERK].timer != -1 || //バーサーク
@@ -6525,7 +6527,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
return;
}
if (sd->npc_id != 0 || sd->opt1 > 0 ||
- (sd->sc_data && (sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ ((sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
sd->sc_data[SC_BERSERK].timer != -1))) //バーサーク
{
@@ -6553,7 +6555,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
clif_clearchar_area(&sd->bl, 1);
return;
}
- if (sd->npc_id != 0 || sd->opt1 > 0 || (sd->sc_data &&
+ if (sd->npc_id != 0 || sd->opt1 > 0 || (
(sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
sd->sc_data[SC_BERSERK].timer != -1 || //バーサーク
@@ -6585,8 +6587,7 @@ void clif_parse_EquipItem(int fd, struct map_session_data *sd)
index = RFIFOW(fd, 2) - 2;
if (sd->npc_id != 0)
return;
- if (sd->sc_data
- && (sd->sc_data[SC_BLADESTOP].timer != -1
+ if ((sd->sc_data[SC_BLADESTOP].timer != -1
|| sd->sc_data[SC_BERSERK].timer != -1))
return;
@@ -6624,14 +6625,11 @@ void clif_parse_UnequipItem(int fd, struct map_session_data *sd)
return;
}
index = RFIFOW(fd, 2) - 2;
- if (sd->status.inventory[index].broken == 1 && sd->sc_data
- && sd->sc_data[SC_BROKNWEAPON].timer != -1)
+ if (sd->status.inventory[index].broken == 1 && sd->sc_data[SC_BROKNWEAPON].timer != -1)
skill_status_change_end(&sd->bl, SC_BROKNWEAPON, -1);
- if (sd->status.inventory[index].broken == 1 && sd->sc_data
- && sd->sc_data[SC_BROKNARMOR].timer != -1)
+ if (sd->status.inventory[index].broken == 1 && sd->sc_data[SC_BROKNARMOR].timer != -1)
skill_status_change_end(&sd->bl, SC_BROKNARMOR, -1);
- if (sd->sc_data
- && (sd->sc_data[SC_BLADESTOP].timer != -1
+ if ((sd->sc_data[SC_BLADESTOP].timer != -1
|| sd->sc_data[SC_BERSERK].timer != -1))
return;
@@ -6786,7 +6784,7 @@ void clif_parse_TradeRequest(int fd, struct map_session_data *sd)
trade_traderequest(sd, RFIFOL(sd->fd, 2));
}
else
- clif_skill_fail(sd, 1, 0, 0);
+ clif_skill_fail(sd, SkillID::ONE, 0, 0);
}
/*==========================================
@@ -6933,7 +6931,7 @@ void clif_parse_StatusUp(int fd, struct map_session_data *sd)
static
void clif_parse_SkillUp(int fd, struct map_session_data *sd)
{
- pc_skillup(sd, RFIFOW(fd, 2));
+ pc_skillup(sd, SkillID(RFIFOW(fd, 2)));
}
/*==========================================
@@ -6943,7 +6941,7 @@ void clif_parse_SkillUp(int fd, struct map_session_data *sd)
static
void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
{
- int skillnum, skilllv, lv, target_id;
+ int skilllv, lv, target_id;
unsigned int tick = gettick();
nullpo_retv(sd);
@@ -6954,7 +6952,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
return;
skilllv = RFIFOW(fd, 2);
- skillnum = RFIFOW(fd, 4);
+ SkillID skillnum = SkillID(RFIFOW(fd, 4));
target_id = RFIFOL(fd, 6);
if (sd->skilltimer != -1)
@@ -6975,7 +6973,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- if (sd->skillitem >= 0 && sd->skillitem == skillnum)
+ if (sd->skillitem != SkillID::NEGATIVE && sd->skillitem == skillnum)
{
if (skilllv != sd->skillitemlv)
skilllv = sd->skillitemlv;
@@ -6983,12 +6981,13 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
}
else
{
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
if (skillnum == MO_EXTREMITYFIST)
{
if ((sd->sc_data[SC_COMBO].timer == -1
- || (sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH
- && sd->sc_data[SC_COMBO].val1 != CH_CHAINCRUSH)))
+ || (sd->sc_data[SC_COMBO].val1_sk() != MO_COMBOFINISH
+ && sd->sc_data[SC_COMBO].val1_sk() != CH_CHAINCRUSH)))
{
if (!sd->state.skill_flag)
{
@@ -7021,7 +7020,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
static
void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd)
{
- int skillnum, skilllv, lv, x, y;
+ int skilllv, lv, x, y;
unsigned int tick = gettick();
int skillmoreinfo;
@@ -7036,7 +7035,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd)
skillmoreinfo = -1;
skilllv = RFIFOW(fd, 2);
- skillnum = RFIFOW(fd, 4);
+ SkillID skillnum = SkillID(RFIFOW(fd, 4));
x = RFIFOW(fd, 6);
y = RFIFOW(fd, 8);
if (RFIFOW(fd, 0) == 0x190)
@@ -7067,7 +7066,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd)
return;
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- if (sd->skillitem >= 0 && sd->skillitem == skillnum)
+ if (sd->skillitem != SkillID::NEGATIVE && sd->skillitem == skillnum)
{
if (skilllv != sd->skillitemlv)
skilllv = sd->skillitemlv;
@@ -7075,7 +7074,8 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd)
}
else
{
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
if ((lv = pc_checkskill(sd, skillnum)) > 0)
{
if (skilllv > lv)
@@ -7099,7 +7099,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data *sd)
if (sd->chatID)
return;
- if (sd->npc_id != 0 || (sd->sc_data &&
+ if (sd->npc_id != 0 || (
(sd->sc_data[SC_TRICKDEAD].timer != -1 ||
sd->sc_data[SC_BERSERK].timer != -1 ||
sd->sc_data[SC_NOCHAT].timer != -1 ||
@@ -7110,7 +7110,8 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data *sd)
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
- skill_castend_map(sd, RFIFOW(fd, 2), (const char *)RFIFOP(fd, 4));
+ SkillID skill_id = SkillID(RFIFOW(fd, 2));
+ skill_castend_map(sd, skill_id, (const char *)RFIFOP(fd, 4));
}
/*==========================================
@@ -7225,7 +7226,8 @@ void clif_parse_ItemIdentify(int fd, struct map_session_data *sd)
static
void clif_parse_AutoSpell(int fd, struct map_session_data *sd)
{
- skill_autospell(sd, RFIFOW(fd, 2));
+ SkillID skill_id = SkillID(RFIFOW(fd, 2));
+ skill_autospell(sd, skill_id);
}
/*==========================================
@@ -7416,7 +7418,7 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd)
party_create(sd, (const char *)RFIFOP(fd, 2));
}
else
- clif_skill_fail(sd, 1, 0, 4);
+ clif_skill_fail(sd, SkillID::ONE, 0, 4);
}
/*==========================================
@@ -7440,7 +7442,7 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
party_create(sd, (const char *)RFIFOP(fd, 2));
}
else
- clif_skill_fail(sd, 1, 0, 4);
+ clif_skill_fail(sd, SkillID::ONE, 0, 4);
}
/*==========================================
@@ -7474,7 +7476,7 @@ void clif_parse_ReplyPartyInvite(int fd, struct map_session_data *sd)
else
{
party_reply_invite(sd, RFIFOL(fd, 2), 0);
- clif_skill_fail(sd, 1, 0, 4);
+ clif_skill_fail(sd, SkillID::ONE, 0, 4);
}
}
@@ -7532,7 +7534,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd)
}
if (is_atcommand(fd, sd, message, 0) != AtCommand_None
- || (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1 //バーサーク時は会話も不可
+ || ((sd->sc_data[SC_BERSERK].timer != -1 //バーサーク時は会話も不可
|| sd->sc_data[SC_NOCHAT].timer != -1))) //チャット禁止
{
free(buf);
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index c3d2555..2214e48 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -121,31 +121,31 @@ int clif_npc_class_change(struct block_list *bl, int npc_class, int type);
int clif_mob_class_change(struct mob_data *md, int mob_class);
int clif_mob_equip(struct mob_data *md, int nameid); // [Valaris]
-int clif_skillinfo(struct map_session_data *sd, int skillid, int type,
+int clif_skillinfo(struct map_session_data *sd, SkillID skillid, int type,
int range);
int clif_skillinfoblock(struct map_session_data *sd);
-int clif_skillup(struct map_session_data *sd, int skill_num);
+int clif_skillup(struct map_session_data *sd, SkillID skill_num);
int clif_skillcasting(struct block_list *bl,
int src_id, int dst_id, int dst_x, int dst_y,
- int skill_num, int casttime);
+ SkillID skill_num, int casttime);
int clif_skillcastcancel(struct block_list *bl);
-int clif_skill_fail(struct map_session_data *sd, int skill_id, int type,
+int clif_skill_fail(struct map_session_data *sd, SkillID skill_id, int type,
int btype);
int clif_skill_damage(struct block_list *src, struct block_list *dst,
unsigned int tick, int sdelay, int ddelay, int damage,
- int div, int skill_id, int skill_lv, int type);
+ int div, SkillID skill_id, int skill_lv, int type);
int clif_skill_damage2(struct block_list *src, struct block_list *dst,
unsigned int tick, int sdelay, int ddelay,
- int damage, int div, int skill_id, int skill_lv,
+ int damage, int div, SkillID skill_id, int skill_lv,
int type);
int clif_skill_nodamage(struct block_list *src, struct block_list *dst,
- int skill_id, int heal, int fail);
-int clif_skill_poseffect(struct block_list *src, int skill_id, int val,
+ SkillID skill_id, int heal, int fail);
+int clif_skill_poseffect(struct block_list *src, SkillID skill_id, int val,
int x, int y, int tick);
int clif_skill_estimation(struct map_session_data *sd,
struct block_list *dst);
-int clif_skill_warppoint(struct map_session_data *sd, int skill_num,
+int clif_skill_warppoint(struct map_session_data *sd, SkillID skill_num,
const char *map1, const char *map2,
const char *map3, const char *map4);
int clif_skill_memo(struct map_session_data *sd, int flag);
@@ -166,7 +166,8 @@ int clif_bladestop(struct block_list *src, struct block_list *dst,
int boolean);
int clif_changemapcell(int m, int x, int y, int cell_type, int type);
-int clif_status_change(struct block_list *bl, int type, int flag);
+int clif_status_change(struct block_list *bl,
+ StatusChange type, int flag);
int clif_wis_message(int fd, const char *nick, const char *mes, int mes_len);
int clif_wis_end(int fd, int flag);
@@ -189,7 +190,7 @@ int clif_item_identify_list(struct map_session_data *sd);
int clif_item_identified(struct map_session_data *sd, int idx, int flag);
int clif_item_repair_list(struct map_session_data *sd);
-int clif_item_skill(struct map_session_data *sd, int skillid, int skilllv,
+int clif_item_skill(struct map_session_data *sd, SkillID skillid, int skilllv,
const char *name);
int clif_mvp_effect(struct map_session_data *sd);
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index 7207afc..a53f939 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -553,12 +553,13 @@ static int fun_is_in(env_t * env, int args_nr, val_t * result, val_t * args)
static int fun_skill(env_t * env, int args_nr, val_t * result, val_t * args)
{
if (ETY(0) != BL_PC
+ // don't convert to enum until after the range check
|| ARGINT(1) < 0
- || ARGINT(1) >= MAX_SKILL
- || ARGPC(0)->status.skill[ARGINT(1)].id != ARGINT(1))
+ || ARGINT(1) >= uint16_t(MAX_SKILL)
+ || ARGPC(0)->status.skill[SkillID(ARGINT(1))].id != SkillID(ARGINT(1)))
RESULTINT = 0;
else
- RESULTINT = ARGPC(0)->status.skill[ARGINT(1)].lv;
+ RESULTINT = ARGPC(0)->status.skill[SkillID(ARGINT(1))].lv;
return 0;
}
@@ -974,7 +975,8 @@ fun_running_status_update(env_t * env, int args_nr, val_t * result,
if (ETY(0) != BL_PC && ETY(0) != BL_MOB)
return 1;
- RESULTINT = battle_get_sc_data(ARGENTITY(0))[ARGINT(1)].timer != -1;
+ StatusChange sc = StatusChange(ARGINT(1));
+ RESULTINT = battle_get_sc_data(ARGENTITY(0))[sc].timer != -1;
return 0;
}
diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp
index 39a057c..2414a7a 100644
--- a/src/map/magic-interpreter.hpp
+++ b/src/map/magic-interpreter.hpp
@@ -405,7 +405,7 @@ typedef struct cont_activation_record
typedef struct status_change_ref
{
- int sc_type;
+ StatusChange sc_type;
int bl_id;
} status_change_ref_t;
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index b98130e..859d2cd 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -112,21 +112,22 @@ void spell_free_invocation(invocation_t * invocation)
}
static void
-char_set_weapon_icon(character_t * subject, int count, int icon, int look)
+char_set_weapon_icon(character_t * subject, int count,
+ StatusChange icon, int look)
{
- const int old_icon = subject->attack_spell_icon_override;
+ const StatusChange old_icon = subject->attack_spell_icon_override;
subject->attack_spell_icon_override = icon;
subject->attack_spell_look_override = look;
- if (old_icon && old_icon != icon)
+ if (old_icon != StatusChange::ZERO && old_icon != icon)
clif_status_change(&subject->bl, old_icon, 0);
clif_fixpcpos(subject);
if (count)
{
clif_changelook(&subject->bl, LOOK_WEAPON, look);
- if (icon)
+ if (icon != StatusChange::ZERO)
clif_status_change(&subject->bl, icon, 1);
}
else
@@ -157,9 +158,8 @@ static void char_set_attack_info(character_t * subject, int speed, int range)
void magic_stop_completely(character_t * c)
{
- int i;
// Zap all status change references to spells
- for (i = 0; i < MAX_STATUSCHANGE; i++)
+ for (StatusChange i : erange(StatusChange(), MAX_STATUSCHANGE))
c->sc_data[i].spell_invocation = 0;
while (c->active_spells)
@@ -172,7 +172,7 @@ void magic_stop_completely(character_t * c)
if (attack_spell)
spell_free_invocation(attack_spell);
c->attack_spell_override = 0;
- char_set_weapon_icon(c, 0, 0, 0);
+ char_set_weapon_icon(c, 0, StatusChange::ZERO, 0);
char_set_attack_info(c, 0, 0);
}
}
@@ -464,7 +464,8 @@ static int op_banish(env_t * env, int args_nr, val_t * args)
}
static void
-record_status_change(invocation_t * invocation, int bl_id, int sc_id)
+record_status_change(invocation_t * invocation, int bl_id,
+ StatusChange sc_id)
{
int index = invocation->status_change_refs_nr++;
status_change_ref_t *cr;
@@ -484,12 +485,12 @@ static int op_status_change(env_t * env, int args_nr, val_t * args)
? VAR(VAR_INVOCATION).v.v_int : 0;
invocation_t *invocation = (invocation_t *) map_id2bl(invocation_id);
- skill_status_effect(subject, ARGINT(1), ARGINT(2), ARGINT(3),
- ARGINT(4), ARGINT(5), ARGINT(6), 0,
- invocation_id);
+ skill_status_effect(subject, StatusChange(ARGINT(1)),
+ ARGINT(2), ARGINT(3), ARGINT(4), ARGINT(5),
+ ARGINT(6), 0, invocation_id);
if (invocation && subject->type == BL_PC)
- record_status_change(invocation, subject->id, ARGINT(1));
+ record_status_change(invocation, subject->id, StatusChange(ARGINT(1)));
return 0;
}
@@ -498,7 +499,8 @@ static int op_stop_status_change(env_t * env, int args_nr, val_t * args)
{
entity_t *subject = ARGENTITY(0);
- skill_status_change_end(subject, ARGINT(1), -1);
+ StatusChange sc = StatusChange(ARGINT(1));
+ skill_status_change_end(subject, sc, -1);
return 0;
}
@@ -509,7 +511,7 @@ static int op_override_attack(env_t * env, int args_nr, val_t * args)
int charges = ARGINT(1);
int attack_delay = ARGINT(2);
int attack_range = ARGINT(3);
- int icon = ARGINT(4);
+ StatusChange icon = StatusChange(ARGINT(4));
int look = ARGINT(5);
int stopattack = ARGINT(6);
character_t *subject;
@@ -885,8 +887,8 @@ op_t *magic_get_op(char *name, int *index)
}
void
-spell_effect_report_termination(int invocation_id, int bl_id, int sc_id,
- int supplanted)
+spell_effect_report_termination(int invocation_id, int bl_id,
+ StatusChange sc_id, int supplanted)
{
int i;
int index = -1;
@@ -1578,7 +1580,7 @@ int spell_attack(int caster_id, int target_id)
else if (!invocation || caster->attack_spell_charges <= 0)
{
caster->attack_spell_override = 0;
- char_set_weapon_icon(caster, 0, 0, 0);
+ char_set_weapon_icon(caster, 0, StatusChange::ZERO, 0);
char_set_attack_info(caster, 0, 0);
if (stop_attack)
diff --git a/src/map/magic.hpp b/src/map/magic.hpp
index f7e832c..fecb975 100644
--- a/src/map/magic.hpp
+++ b/src/map/magic.hpp
@@ -40,8 +40,8 @@ void magic_unshroud(character_t * character);
* \param supplanted Whether the status_change finished normally (0) or was supplanted by a new status_change (1)
*/
void
-spell_effect_report_termination(int invocation, int bl_id, int sc_id,
- int supplanted);
+spell_effect_report_termination(int invocation, int bl_id,
+ StatusChange sc_id, int supplanted);
/**
* Initialise all spells, read config data
diff --git a/src/map/map.cpp b/src/map/map.cpp
index a6b8b08..dbdafdc 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -688,7 +688,7 @@ int map_delobjectnofree(int id, int type)
{
fprintf(stderr, "Incorrect type: expected %d, got %d\n", type,
object[id]->type);
- *((char *) 0) = 0; // break for backtrace
+ abort();
}
map_delblock(object[id]);
@@ -1115,7 +1115,7 @@ int map_quit(struct map_session_data *sd)
skill_castcancel(&sd->bl, 0); // 詠唱を中断する
skill_stop_dancing(&sd->bl, 1); // ダンス/演奏中断
- if (sd->sc_data && sd->sc_data[SC_BERSERK].timer != -1) //バーサーク中の終了はHPを100に
+ if (sd->sc_data[SC_BERSERK].timer != -1) //バーサーク中の終了はHPを100に
sd->status.hp = 100;
skill_status_change_clear(&sd->bl, 1); // ステータス異常を解除する
diff --git a/src/map/map.hpp b/src/map/map.hpp
index a94b46f..18b1e8d 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -7,10 +7,13 @@
#include <time.h>
#include <sys/time.h>
#include <netinet/in.h>
+
#include "../common/mmo.hpp"
#include "../common/timer.hpp"
#include "../common/db.hpp"
#include "script.hpp"
+#include "mob.t.hpp"
+#include "skill.t.hpp"
#ifndef MAX
# define MAX(x,y) (((x)>(y)) ? (x) : (y))
@@ -31,7 +34,6 @@
#define DAMAGELOG_SIZE 30
#define LOOTITEM_SIZE 10
#define MAX_SKILL_LEVEL 100
-#define MAX_STATUSCHANGE 200
#define MAX_SKILLUNITGROUP 32
#define MAX_MOBSKILLUNITGROUP 8
#define MAX_SKILLUNITGROUPTICKSET 128
@@ -60,11 +62,6 @@
#define OPTION_SCRIBE 0x2000 // [Fate] Auto-logging of nearby comments
#define OPTION_CHASEWALK 0x4000
-// Below are special clif_changestatus() IDs reserved for option updates
-#define CLIF_OPTION_SC_BASE 0x1000
-#define CLIF_OPTION_SC_INVISIBILITY (CLIF_OPTION_SC_BASE)
-#define CLIF_OPTION_SC_SCRIBE (CLIF_OPTION_SC_BASE + 1)
-
enum
{ BL_NUL, BL_PC, BL_NPC, BL_MOB, BL_ITEM, BL_CHAT, BL_SKILL, BL_SPELL };
enum
@@ -97,6 +94,7 @@ struct status_change
{
int timer;
int val1, val2, val3, val4;
+ SkillID val1_sk() { return SkillID(val1); }
int spell_invocation; /* [Fate] If triggered by a spell, record here */
};
@@ -122,7 +120,8 @@ struct skill_unit_group
unsigned int tick;
int limit, interval;
- int skill_id, skill_lv;
+ SkillID skill_id;
+ int skill_lv;
int val1, val2;
char *valstr;
int unit_id;
@@ -142,7 +141,8 @@ struct skill_timerskill
int target_id;
int map;
short x, y;
- short skill_id, skill_lv;
+ SkillID skill_id;
+ short skill_lv;
int type;
int flag;
};
@@ -247,7 +247,8 @@ struct map_session_data
struct invocation *active_spells; // [Fate] Singly-linked list of active spells linked to this PC
int attack_spell_override; // [Fate] When an attack spell is active for this player, they trigger it
// like a weapon. Check pc_attack_timer() for details.
- short attack_spell_icon_override; // Weapon equipment slot (slot 4) item override
+ // Weapon equipment slot (slot 4) item override
+ StatusChange attack_spell_icon_override;
short attack_spell_look_override; // Weapon `look' (attack animation) override
short attack_spell_charges; // [Fate] Remaining number of charges for the attack spell
short attack_spell_delay; // [Fate] ms delay after spell attack
@@ -259,10 +260,14 @@ struct map_session_data
int skilltimer;
int skilltarget;
short skillx, skilly;
- short skillid, skilllv;
- short skillitem, skillitemlv;
- short skillid_old, skilllv_old;
- short skillid_dance, skilllv_dance;
+ SkillID skillid;
+ short skilllv;
+ SkillID skillitem;
+ short skillitemlv;
+ SkillID skillid_old;
+ short skilllv_old;
+ SkillID skillid_dance;
+ short skilllv_dance;
struct skill_unit_group skillunit[MAX_SKILLUNITGROUP];
struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET];
struct skill_timerskill skilltimerskill[MAX_SKILLTIMERSKILL];
@@ -295,13 +300,13 @@ struct map_session_data
int atk_ele, def_ele, star, overrefine;
int castrate, hprate, sprate, dsprate;
int addele[10], addrace[12], addsize[3], subele[10], subrace[12];
- int addeff[10], addeff2[10], reseff[10];
+ earray<int, BadSC, BadSC::COUNT> addeff, addeff2, reseff;
int watk_, watk_2, atkmods_[3], addele_[10], addrace_[12], addsize_[3]; //二刀流のために追加
int atk_ele_, star_, overrefine_; //二刀流のために追加
int base_atk, atk_rate;
int arrow_atk, arrow_ele, arrow_cri, arrow_hit, arrow_range;
- int arrow_addele[10], arrow_addrace[12], arrow_addsize[3],
- arrow_addeff[10], arrow_addeff2[10];
+ int arrow_addele[10], arrow_addrace[12], arrow_addsize[3];
+ earray<int, BadSC, BadSC::COUNT> arrow_addeff, arrow_addeff2;
int nhealhp, nhealsp, nshealhp, nshealsp, nsshealhp, nsshealsp;
int aspd_rate, speed_rate, hprecov_rate, sprecov_rate, critical_def,
double_rate;
@@ -331,7 +336,8 @@ struct map_session_data
int double_add_rate, speed_add_rate, aspd_add_rate, perfect_hit_add,
get_zeny_add_num;
short splash_range, splash_add_range;
- short autospell_id, autospell_lv, autospell_rate;
+ SkillID autospell_id;
+ short autospell_lv, autospell_rate;
short hp_drain_rate, hp_drain_per, sp_drain_rate, sp_drain_per;
short hp_drain_rate_, hp_drain_per_, sp_drain_rate_, sp_drain_per_;
int short_weapon_damage_return, long_weapon_damage_return;
@@ -354,7 +360,7 @@ struct map_session_data
int regstr_num;
struct script_regstr *regstr;
- struct status_change sc_data[MAX_STATUSCHANGE];
+ earray<struct status_change, StatusChange, MAX_STATUSCHANGE> sc_data;
short sc_count;
struct square dev;
@@ -378,7 +384,9 @@ struct map_session_data
char eventqueue[MAX_EVENTQUEUE][50];
int eventtimer[MAX_EVENTTIMER];
- int last_skillid, last_skilllv; // Added by RoVeRT
+ SkillID last_skillid;
+ int last_skilllv;
+
struct
{
char name[24];
@@ -490,7 +498,7 @@ struct mob_data
struct
{
unsigned state:8;
- unsigned skillstate:8;
+ MSS skillstate;
unsigned targettype:1;
unsigned steal_flag:1;
unsigned steal_coin_flag:1;
@@ -519,7 +527,7 @@ struct mob_data
struct item *lootitem;
short lootitem_count;
- struct status_change sc_data[MAX_STATUSCHANGE];
+ earray<struct status_change, StatusChange, MAX_STATUSCHANGE> sc_data;
short sc_count;
short opt1, opt2, opt3, option;
short min_chase;
@@ -529,7 +537,8 @@ struct mob_data
int skilltimer;
int skilltarget;
short skillx, skilly;
- short skillid, skilllv, skillidx;
+ SkillID skillid;
+ short skilllv, skillidx;
unsigned int skilldelay[MAX_MOBSKILL];
int def_ele;
int master_id, master_dist;
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 8d58cb9..d1f431f 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -40,14 +40,21 @@ struct mob_db mob_db[2001];
* Local prototype declaration (only required thing)
*------------------------------------------
*/
-static int distance(int, int, int, int);
-static int mob_makedummymobdb(int);
-static void mob_timer(timer_id, tick_t, custom_id_t, custom_data_t);
+static
+int distance(int, int, int, int);
+static
+int mob_makedummymobdb(int);
+static
+void mob_timer(timer_id, tick_t, custom_id_t, custom_data_t);
+static
int mobskill_deltimer(struct mob_data *md);
-int mob_skillid2skillidx(int mob_class, int skillid);
+static
+int mob_skillid2skillidx(int mob_class, SkillID skillid);
+static
int mobskill_use_id(struct mob_data *md, struct block_list *target,
int skill_idx);
-static int mob_unlocktarget(struct mob_data *md, int tick);
+static
+int mob_unlocktarget(struct mob_data *md, int tick);
/*==========================================
* Mob is searched with a name.
@@ -867,7 +874,7 @@ static int mob_attack(struct mob_data *md, unsigned int tick, int data)
//clif_fixmobpos(md);
md->state.skillstate = MSS_ATTACK;
- if (mobskill_use(md, tick, -2)) // スキル使用
+ if (mobskill_use(md, tick, MSC::NEVER_EQUAL))
return 0;
md->target_lv = battle_weapon_attack(&md->bl, tbl, tick, 0);
@@ -1243,18 +1250,18 @@ int mob_spawn(int id)
md->skilltimer = -1;
for (i = 0, c = tick - 1000 * 3600 * 10; i < MAX_MOBSKILL; i++)
md->skilldelay[i] = c;
- md->skillid = 0;
+ md->skillid = SkillID();
md->skilllv = 0;
memset(md->dmglog, 0, sizeof(md->dmglog));
if (md->lootitem)
- memset(md->lootitem, 0, sizeof(md->lootitem));
+ memset(md->lootitem, 0, sizeof(*md->lootitem));
md->lootitem_count = 0;
for (i = 0; i < MAX_MOBSKILLTIMERSKILL; i++)
md->skilltimerskill[i].timer = -1;
- for (i = 0; i < MAX_STATUSCHANGE; i++)
+ for (StatusChange i : erange(StatusChange(), MAX_STATUSCHANGE))
{
md->sc_data[i].timer = -1;
md->sc_data[i].val1 = md->sc_data[i].val2 = md->sc_data[i].val3 =
@@ -1416,7 +1423,7 @@ int mob_can_reach(struct mob_data *md, struct block_list *bl, int range)
int mob_target(struct mob_data *md, struct block_list *bl, int dist)
{
struct map_session_data *sd;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
short *option;
int mode, race;
@@ -2015,7 +2022,7 @@ void mob_ai_sub_hard(struct block_list *bl, va_list ap)
if (!mob_can_move(md)) // 動けない状態にある
return;
md->state.skillstate = MSS_CHASE; // 突撃時スキル
- mobskill_use(md, tick, -1);
+ mobskill_use(md, tick, MSC::ANY);
// if(md->timer != -1 && (DIFF_TICK(md->next_walktime,tick)<0 || distance(md->to_x,md->to_y,tsd->bl.x,tsd->bl.y)<2) )
if (md->timer != -1 && md->state.state != MS_ATTACK
&& (DIFF_TICK(md->next_walktime, tick) < 0
@@ -2119,7 +2126,7 @@ void mob_ai_sub_hard(struct block_list *bl, va_list ap)
if (!mob_can_move(md)) // 動けない状態にある
return;
md->state.skillstate = MSS_LOOT; // ルート時スキル使用
- mobskill_use(md, tick, -1);
+ mobskill_use(md, tick, MSC::ANY);
// if(md->timer != -1 && (DIFF_TICK(md->next_walktime,tick)<0 || distance(md->to_x,md->to_y,tbl->x,tbl->y)<2) )
if (md->timer != -1 && md->state.state != MS_ATTACK
&& (DIFF_TICK(md->next_walktime, tick) < 0
@@ -2177,7 +2184,7 @@ void mob_ai_sub_hard(struct block_list *bl, va_list ap)
}
// It is skill use at the time of /standby at the time of a walk.
- if (mobskill_use(md, tick, -1))
+ if (mobskill_use(md, tick, MSC::ANY))
return;
// 歩行処理
@@ -2540,7 +2547,9 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage,
if (md->bl.prev != NULL)
{
mob_changestate(md, MS_DEAD, 0);
- mobskill_use(md, tick, -1); // It is skill at the time of death.
+ // It is skill at the time of death.
+ mobskill_use(md, tick, MSC::ANY);
+
clif_clearchar_area(&md->bl, 1);
map_delblock(&md->bl);
mob_setdelayspawn(md->bl.id);
@@ -2669,7 +2678,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage,
map_freeblock_lock();
mob_changestate(md, MS_DEAD, 0);
- mobskill_use(md, tick, -1); // 死亡時スキル
+ mobskill_use(md, tick, MSC::ANY);
memset(tmpsd, 0, sizeof(tmpsd));
memset(pt, 0, sizeof(pt));
@@ -3060,7 +3069,7 @@ int mob_class_change(struct mob_data *md, int *value)
for (i = 0, c = tick - 1000 * 3600 * 10; i < MAX_MOBSKILL; i++)
md->skilldelay[i] = c;
- md->skillid = 0;
+ md->skillid = SkillID();
md->skilllv = 0;
if (md->lootitem == NULL && mob_db[mob_class].mode & 0x02)
@@ -3384,7 +3393,7 @@ int mob_counttargeted(struct mob_data *md, struct block_list *src,
*MOBskillから該当skillidのskillidxを返す
*------------------------------------------
*/
-int mob_skillid2skillidx(int mob_class, int skillid)
+int mob_skillid2skillidx(int mob_class, SkillID skillid)
{
int i;
struct mob_skill *ms = mob_db[mob_class].skill;
@@ -3429,20 +3438,18 @@ void mobskill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_
return;
md->skilltimer = -1;
- //沈黙や状態異常など
- if (md->sc_data)
- {
- if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
- || md->sc_data[SC_ROKISWEIL].timer != -1
- || md->sc_data[SC_STEELBODY].timer != -1)
- return;
- if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
- return;
- if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
- return;
- if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
- return;
- }
+
+ if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
+ || md->sc_data[SC_ROKISWEIL].timer != -1
+ || md->sc_data[SC_STEELBODY].timer != -1)
+ return;
+ if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
+ return;
+ if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
+ return;
+ if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
+ return;
+
if (md->skillid != NPC_EMOTION)
md->last_thinktime = tick + battle_get_adelay(&md->bl);
@@ -3456,7 +3463,7 @@ void mobskill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_
if (md->skillid == PR_LEXAETERNA)
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
if (sc_data
&& (sc_data[SC_FREEZE].timer != -1
|| (sc_data[SC_STONE].timer != -1
@@ -3484,8 +3491,8 @@ void mobskill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_
md->skilldelay[md->skillidx] = tick;
if (battle_config.mob_skill_log == 1)
- printf("MOB skill castend skill=%d, mob_class = %d\n", md->skillid,
- md->mob_class);
+ printf("MOB skill castend skill=%d, mob_class = %d\n",
+ uint16_t(md->skillid), md->mob_class);
mob_stop_walking(md, 0);
switch (skill_get_nk(md->skillid))
@@ -3534,19 +3541,17 @@ void mobskill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data
return;
md->skilltimer = -1;
- if (md->sc_data)
- {
- if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
- || md->sc_data[SC_ROKISWEIL].timer != -1
- || md->sc_data[SC_STEELBODY].timer != -1)
- return;
- if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
- return;
- if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
- return;
- if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
- return;
- }
+
+ if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
+ || md->sc_data[SC_ROKISWEIL].timer != -1
+ || md->sc_data[SC_STEELBODY].timer != -1)
+ return;
+ if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
+ return;
+ if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
+ return;
+ if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
+ return;
if (battle_config.monster_skill_reiteration == 0)
{
@@ -3634,8 +3639,8 @@ void mobskill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data
md->skilldelay[md->skillidx] = tick;
if (battle_config.mob_skill_log == 1)
- printf("MOB skill castend skill=%d, mob_class = %d\n", md->skillid,
- md->mob_class);
+ printf("MOB skill castend skill=%d, mob_class = %d\n",
+ uint16_t(md->skillid), md->mob_class);
mob_stop_walking(md, 0);
skill_castend_pos2(&md->bl, md->skillx, md->skilly, md->skillid,
@@ -3653,7 +3658,8 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target,
{
int casttime, range;
struct mob_skill *ms;
- int skill_id, skill_lv, forcecast = 0;
+ SkillID skill_id;
+ int skill_lv, forcecast = 0;
nullpo_retr(0, md);
nullpo_retr(0, ms = &mob_db[md->mob_class].skill[skill_idx]);
@@ -3667,20 +3673,16 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target,
skill_id = ms->skill_id;
skill_lv = ms->skill_lv;
- // 沈黙や異常
- if (md->sc_data)
- {
- if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
- || md->sc_data[SC_ROKISWEIL].timer != -1
- || md->sc_data[SC_STEELBODY].timer != -1)
- return 0;
- if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
- return 0;
- if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
- return 0;
- if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
- return 0;
- }
+ if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
+ || md->sc_data[SC_ROKISWEIL].timer != -1
+ || md->sc_data[SC_STEELBODY].timer != -1)
+ return 0;
+ if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
+ return 0;
+ if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
+ return 0;
+ if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
+ return 0;
if (md->option & 4 && skill_id == TF_HIDING)
return 0;
@@ -3727,7 +3729,8 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target,
if (battle_config.mob_skill_log == 1)
printf("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n",
- target->id, skill_id, skill_lv, casttime, md->mob_class);
+ target->id, uint16_t(skill_id), skill_lv,
+ casttime, md->mob_class);
if (casttime > 0 || forcecast)
{ // 詠唱が必要
@@ -3784,7 +3787,7 @@ int mobskill_use_pos(struct mob_data *md,
int casttime = 0, range;
struct mob_skill *ms;
struct block_list bl;
- int skill_id, skill_lv;
+ int skill_lv;
nullpo_retr(0, md);
nullpo_retr(0, ms = &mob_db[md->mob_class].skill[skill_idx]);
@@ -3792,23 +3795,19 @@ int mobskill_use_pos(struct mob_data *md,
if (md->bl.prev == NULL)
return 0;
- skill_id = ms->skill_id;
+ SkillID skill_id = ms->skill_id;
skill_lv = ms->skill_lv;
- //沈黙や状態異常など
- if (md->sc_data)
- {
- if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
- || md->sc_data[SC_ROKISWEIL].timer != -1
- || md->sc_data[SC_STEELBODY].timer != -1)
- return 0;
- if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
- return 0;
- if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
- return 0;
- if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
- return 0;
- }
+ if (md->opt1 > 0 || md->sc_data[SC_DIVINA].timer != -1
+ || md->sc_data[SC_ROKISWEIL].timer != -1
+ || md->sc_data[SC_STEELBODY].timer != -1)
+ return 0;
+ if (md->sc_data[SC_AUTOCOUNTER].timer != -1 && md->skillid != KN_AUTOCOUNTER) //オートカウンター
+ return 0;
+ if (md->sc_data[SC_BLADESTOP].timer != -1) //白刃取り
+ return 0;
+ if (md->sc_data[SC_BERSERK].timer != -1) //バーサーク
+ return 0;
if (md->option & 2)
return 0;
@@ -3831,7 +3830,8 @@ int mobskill_use_pos(struct mob_data *md,
if (battle_config.mob_skill_log == 1)
printf("MOB skill use target_pos= (%d,%d) skill=%d lv=%d cast=%d, mob_class = %d\n",
- skill_x, skill_y, skill_id, skill_lv, casttime, md->mob_class);
+ skill_x, skill_y, uint16_t(skill_id), skill_lv,
+ casttime, md->mob_class);
if (casttime > 0) // A cast time is required.
clif_skillcasting(&md->bl,
@@ -3910,7 +3910,6 @@ struct mob_data *mob_getfriendhpltmaxrate(struct mob_data *md, int rate)
static
void mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
{
- int cond1, cond2;
struct mob_data **fr, *md, *mmd;
int flag = 0;
@@ -3921,15 +3920,16 @@ void mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
if (mmd->bl.id == bl->id)
return;
- cond1 = va_arg(ap, int);
- cond2 = va_arg(ap, int);
+ MSC cond1 = va_arg(ap, MSC);
+ StatusChange cond2 = va_arg(ap, StatusChange);
fr = va_arg(ap, struct mob_data **);
- if (cond2 == -1)
+ if (cond2 == StatusChange::ANY_BAD)
{
- int j;
- for (j = SC_STONE; j <= SC_BLIND && !flag; j++)
+ for (StatusChange j : MAJOR_STATUS_EFFECTS)
{
flag = (md->sc_data[j].timer != -1);
+ if (flag)
+ break;
}
}
else
@@ -3939,8 +3939,8 @@ void mob_getfriendstatus_sub(struct block_list *bl, va_list ap)
}
static
-struct mob_data *mob_getfriendstatus(struct mob_data *md, int cond1,
- int cond2)
+struct mob_data *mob_getfriendstatus(struct mob_data *md,
+ MSC cond1, StatusChange cond2)
{
struct mob_data *fr = NULL;
const int r = 8;
@@ -3957,7 +3957,8 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md, int cond1,
* Skill use judging
*------------------------------------------
*/
-int mobskill_use(struct mob_data *md, unsigned int tick, int event)
+int mobskill_use(struct mob_data *md, unsigned int tick,
+ MSC event, SkillID skill)
{
struct mob_skill *ms;
// struct block_list *target=NULL;
@@ -3979,7 +3980,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
for (int ii = 0; ii < mob_db[md->mob_class].maxskill; ii++)
{
- int c2 = ms[ii].cond2, flag = 0;
+ int flag = 0;
struct mob_data *fmd = NULL;
// ディレイ中
@@ -3987,10 +3988,10 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
continue;
// 状態判定
- if (ms[ii].state >= 0 && ms[ii].state != md->state.skillstate)
+ if (ms[ii].state != MSS::ANY && ms[ii].state != md->state.skillstate)
continue;
- // 条件判定
+ // Note: these *may* both be MSC::ANY
flag = (event == ms[ii].cond1);
if (!flag)
{
@@ -4000,53 +4001,55 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
flag = 1;
break;
case MSC_MYHPLTMAXRATE: // HP< maxhp%
- flag = (md->hp < max_hp * c2 / 100);
+ flag = (md->hp < max_hp * ms[ii].cond2i / 100);
break;
case MSC_MYSTATUSON: // status[num] on
case MSC_MYSTATUSOFF: // status[num] off
- if (ms[ii].cond2 == -1)
+ if (ms[ii].cond2sc() == StatusChange::ANY_BAD)
{
- int j;
- for (j = SC_STONE; j <= SC_BLIND && !flag; j++)
+ for (StatusChange j : MAJOR_STATUS_EFFECTS)
{
flag = (md->sc_data[j].timer != -1);
+ if (flag)
+ break;
}
}
else
- flag = (md->sc_data[ms[ii].cond2].timer != -1);
+ flag = (md->sc_data[ms[ii].cond2sc()].timer != -1);
flag ^= (ms[ii].cond1 == MSC_MYSTATUSOFF);
break;
case MSC_FRIENDHPLTMAXRATE: // friend HP < maxhp%
flag =
((fmd =
mob_getfriendhpltmaxrate(md,
- ms[ii].cond2)) != NULL);
+ ms[ii].cond2i)) != NULL);
break;
case MSC_FRIENDSTATUSON: // friend status[num] on
case MSC_FRIENDSTATUSOFF: // friend status[num] off
flag =
((fmd =
mob_getfriendstatus(md, ms[ii].cond1,
- ms[ii].cond2)) != NULL);
+ ms[ii].cond2sc())) != NULL);
break;
case MSC_NOTINTOWN: // Only outside of towns.
flag = !map[md->bl.m].flag.town;
break;
case MSC_SLAVELT: // slave < num
- flag = (mob_countslave(md) < c2);
+ flag = (mob_countslave(md) < ms[ii].cond2i);
break;
case MSC_ATTACKPCGT: // attack pc > num
- flag = (mob_counttargeted(md, NULL, 0) > c2);
+ flag = (mob_counttargeted(md, NULL, 0) > ms[ii].cond2i);
break;
case MSC_SLAVELE: // slave <= num
- flag = (mob_countslave(md) <= c2);
+ flag = (mob_countslave(md) <= ms[ii].cond2i);
break;
case MSC_ATTACKPCGE: // attack pc >= num
- flag = (mob_counttargeted(md, NULL, 0) >= c2);
+ flag = (mob_counttargeted(md, NULL, 0) >= ms[ii].cond2i);
break;
case MSC_SKILLUSED: // specificated skill used
- flag = ((event & 0xffff) == MSC_SKILLUSED
- && ((event >> 16) == c2 || c2 == 0));
+ flag = (event == MSC_SKILLUSED
+ && (skill == ms[ii].cond2sk()
+ || ms[ii].cond2sk() == SkillID::ZERO));
break;
}
}
@@ -4089,8 +4092,9 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
// 自分の周囲
if (ms[ii].target >= MST_AROUND1)
{
- int bx = x, by = y, i = 0, c, m = bl->m, r =
- ms[i].target - MST_AROUND1;
+ int bx = x, by = y, i = 0, c, m = bl->m;
+ // the enum values for radii are adjacent
+ int r = int(ms[i].target) - int(MST_AROUND1);
do
{
bx = x + MRAND((r * 2 + 3)) - r;
@@ -4109,8 +4113,8 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
// 相手の周囲
if (ms[ii].target >= MST_AROUND5)
{
- int bx = x, by = y, i = 0, c, m = bl->m, r =
- (ms[i].target - MST_AROUND5) + 1;
+ int bx = x, by = y, i = 0, c, m = bl->m;
+ int r = int(ms[i].target) - int(MST_AROUND5) + 1;
do
{
bx = x + MRAND((r * 2 + 1)) - r;
@@ -4580,108 +4584,79 @@ static int mob_readskilldb(void)
const struct
{
char str[32];
- int id;
+ MSC id;
} cond1[] =
{
- {
- "always", MSC_ALWAYS},
- {
- "myhpltmaxrate", MSC_MYHPLTMAXRATE},
- {
- "friendhpltmaxrate", MSC_FRIENDHPLTMAXRATE},
- {
- "mystatuson", MSC_MYSTATUSON},
- {
- "mystatusoff", MSC_MYSTATUSOFF},
- {
- "friendstatuson", MSC_FRIENDSTATUSON},
- {
- "friendstatusoff", MSC_FRIENDSTATUSOFF},
- {
- "notintown", MSC_NOTINTOWN},
- {
- "attackpcgt", MSC_ATTACKPCGT},
- {
- "attackpcge", MSC_ATTACKPCGE},
- {
- "slavelt", MSC_SLAVELT},
- {
- "slavele", MSC_SLAVELE},
- {
- "closedattacked", MSC_CLOSEDATTACKED},
- {
- "longrangeattacked", MSC_LONGRANGEATTACKED},
- {
- "skillused", MSC_SKILLUSED},
- {
- "casttargeted", MSC_CASTTARGETED},}, cond2[] =
+ {"always", MSC_ALWAYS},
+ {"myhpltmaxrate", MSC_MYHPLTMAXRATE},
+ {"friendhpltmaxrate", MSC_FRIENDHPLTMAXRATE},
+ {"mystatuson", MSC_MYSTATUSON},
+ {"mystatusoff", MSC_MYSTATUSOFF},
+ {"friendstatuson", MSC_FRIENDSTATUSON},
+ {"friendstatusoff", MSC_FRIENDSTATUSOFF},
+ {"notintown", MSC_NOTINTOWN},
+ {"attackpcgt", MSC_ATTACKPCGT},
+ {"attackpcge", MSC_ATTACKPCGE},
+ {"slavelt", MSC_SLAVELT},
+ {"slavele", MSC_SLAVELE},
+ {"closedattacked", MSC_CLOSEDATTACKED},
+ {"longrangeattacked", MSC_LONGRANGEATTACKED},
+ {"skillused", MSC_SKILLUSED},
+ {"casttargeted", MSC_CASTTARGETED},
+ };
+ const struct
{
- {
- "anybad", -1},
- {
- "stone", SC_STONE},
- {
- "freeze", SC_FREEZE},
- {
- "stan", SC_STAN},
- {
- "sleep", SC_SLEEP},
- {
- "poison", SC_POISON},
- {
- "curse", SC_CURSE},
- {
- "silence", SC_SILENCE},
- {
- "confusion", SC_CONFUSION},
- {
- "blind", SC_BLIND},
- {
- "hiding", SC_HIDING},
- {
- "sight", SC_SIGHT},}, state[] =
+ char str[32];
+ StatusChange id;
+ } cond2[] =
{
- {
- "any", -1},
- {
- "idle", MSS_IDLE},
- {
- "walk", MSS_WALK},
- {
- "attack", MSS_ATTACK},
- {
- "dead", MSS_DEAD},
- {
- "loot", MSS_LOOT},
- {
- "chase", MSS_CHASE},}, target[] =
+ {"anybad", StatusChange::ANY_BAD},
+ {"stone", SC_STONE},
+ {"freeze", SC_FREEZE},
+ {"stan", SC_STAN},
+ {"sleep", SC_SLEEP},
+ {"poison", SC_POISON},
+ {"curse", SC_CURSE},
+ {"silence", SC_SILENCE},
+ {"confusion", SC_CONFUSION},
+ {"blind", SC_BLIND},
+ {"hiding", SC_HIDING},
+ {"sight", SC_SIGHT},
+ };
+ const struct
{
- {
- "target", MST_TARGET},
- {
- "self", MST_SELF},
- {
- "friend", MST_FRIEND},
- {
- "master", MST_MASTER},
- {
- "around5", MST_AROUND5},
- {
- "around6", MST_AROUND6},
- {
- "around7", MST_AROUND7},
- {
- "around8", MST_AROUND8},
- {
- "around1", MST_AROUND1},
- {
- "around2", MST_AROUND2},
- {
- "around3", MST_AROUND3},
- {
- "around4", MST_AROUND4},
- {
- "around", MST_AROUND},};
+ char str[32];
+ MSS id;
+ } state[] =
+ {
+ {"any", MSS::ANY},
+ {"idle", MSS_IDLE},
+ {"walk", MSS_WALK},
+ {"attack", MSS_ATTACK},
+ {"dead", MSS_DEAD},
+ {"loot", MSS_LOOT},
+ {"chase", MSS_CHASE},
+ };
+ const struct
+ {
+ char str[32];
+ MST id;
+ } target[] =
+ {
+ {"target", MST_TARGET},
+ {"self", MST_SELF},
+ {"friend", MST_FRIEND},
+ {"master", MST_MASTER},
+ {"around5", MST_AROUND5},
+ {"around6", MST_AROUND6},
+ {"around7", MST_AROUND7},
+ {"around8", MST_AROUND8},
+ {"around1", MST_AROUND1},
+ {"around2", MST_AROUND2},
+ {"around3", MST_AROUND3},
+ {"around4", MST_AROUND4},
+ {"around", MST_AROUND},
+ };
int x;
const char *filename[] = { "db/mob_skill_db.txt", "db/mob_skill_db2.txt" };
@@ -4725,7 +4700,7 @@ static int mob_readskilldb(void)
}
for (i = 0; i < MAX_MOBSKILL; i++)
- if ((ms = &mob_db[mob_id].skill[i])->skill_id == 0)
+ if ((ms = &mob_db[mob_id].skill[i])->skill_id == SkillID::ZERO)
break;
if (i == MAX_MOBSKILL)
{
@@ -4734,13 +4709,13 @@ static int mob_readskilldb(void)
continue;
}
- ms->state = atoi(sp[2]);
+ ms->state = MSS(atoi(sp[2]));
for (j = 0; j < sizeof(state) / sizeof(state[0]); j++)
{
if (strcmp(sp[2], state[j].str) == 0)
ms->state = state[j].id;
}
- ms->skill_id = atoi(sp[3]);
+ ms->skill_id = SkillID(atoi(sp[3]));
ms->skill_lv = atoi(sp[4]);
ms->permillage = atoi(sp[5]);
@@ -4749,23 +4724,25 @@ static int mob_readskilldb(void)
ms->cancel = atoi(sp[8]);
if (strcmp(sp[8], "yes") == 0)
ms->cancel = 1;
- ms->target = atoi(sp[9]);
+ ms->target = MST(atoi(sp[9]));
for (j = 0; j < sizeof(target) / sizeof(target[0]); j++)
{
if (strcmp(sp[9], target[j].str) == 0)
ms->target = target[j].id;
}
- ms->cond1 = -1;
+ ms->cond1 = MSC::ANY;
for (j = 0; j < sizeof(cond1) / sizeof(cond1[0]); j++)
{
if (strcmp(sp[10], cond1[j].str) == 0)
ms->cond1 = cond1[j].id;
}
- ms->cond2 = atoi(sp[11]);
+ // sometimes legitimately an integer
+ // in fact, with current data it always is. Yay!
+ ms->cond2i = atoi(sp[11]);
for (j = 0; j < sizeof(cond2) / sizeof(cond2[0]); j++)
{
if (strcmp(sp[11], cond2[j].str) == 0)
- ms->cond2 = cond2[j].id;
+ ms->cond2i = int(cond2[j].id);
}
ms->val[0] = atoi(sp[12]);
ms->val[1] = atoi(sp[13]);
diff --git a/src/map/mob.hpp b/src/map/mob.hpp
index f1416d7..02197cf 100644
--- a/src/map/mob.hpp
+++ b/src/map/mob.hpp
@@ -1,18 +1,26 @@
// $Id: mob.h,v 1.4 2004/09/25 05:32:18 MouseJstr Exp $
#ifndef MOB_HPP
#define MOB_HPP
+
+#include "mob.t.hpp"
#include "../common/timer.hpp"
+#include "skill.t.hpp"
+
#define MAX_RANDOMMONSTER 3
struct mob_skill
{
- short state;
- short skill_id, skill_lv;
+ MSS state;
+ SkillID skill_id;
+ short skill_lv;
short permillage;
int casttime, delay;
short cancel;
- short cond1, cond2;
- short target;
+ MSC cond1;
+ int cond2i;
+ StatusChange cond2sc() { return StatusChange(cond2i); }
+ SkillID cond2sk() { return SkillID(cond2i); };
+ MST target;
int val[5];
short emotion;
};
@@ -48,51 +56,6 @@ struct mob_db
};
extern struct mob_db mob_db[];
-enum
-{
- MST_TARGET = 0,
- MST_SELF,
- MST_FRIEND,
- MST_MASTER,
- MST_AROUND5,
- MST_AROUND6,
- MST_AROUND7,
- MST_AROUND8,
- MST_AROUND1,
- MST_AROUND2,
- MST_AROUND3,
- MST_AROUND4,
- MST_AROUND = MST_AROUND4,
-
- MSC_ALWAYS = 0x0000,
- MSC_MYHPLTMAXRATE = 0x0001,
- MSC_FRIENDHPLTMAXRATE = 0x0010,
- MSC_MYSTATUSON = 0x0020,
- MSC_MYSTATUSOFF = 0x0021,
- MSC_FRIENDSTATUSON = 0x0030,
- MSC_FRIENDSTATUSOFF = 0x0031,
- MSC_NOTINTOWN = 0x0032,
-
- MSC_ATTACKPCGT = 0x0100,
- MSC_ATTACKPCGE = 0x0101,
- MSC_SLAVELT = 0x0110,
- MSC_SLAVELE = 0x0111,
- MSC_CLOSEDATTACKED = 0x1000,
- MSC_LONGRANGEATTACKED = 0x1001,
- MSC_SKILLUSED = 0x1010,
- MSC_CASTTARGETED = 0x1011,
-};
-
-enum
-{
- MSS_IDLE, // 待機
- MSS_WALK, // 移動
- MSS_ATTACK, // 攻撃
- MSS_DEAD, // 死亡
- MSS_LOOT, // ルート
- MSS_CHASE, // 突撃
-};
-
int mobdb_searchname(const char *str);
int mobdb_checkid(const int id);
int mob_once_spawn(struct map_session_data *sd, const char *mapname,
@@ -139,7 +102,8 @@ int mob_counttargeted(struct mob_data *md, struct block_list *src,
int mob_class_change(struct mob_data *md, int *value);
int mob_warp(struct mob_data *md, int m, int x, int y, int type);
-int mobskill_use(struct mob_data *md, unsigned int tick, int event);
+int mobskill_use(struct mob_data *md, unsigned int tick,
+ MSC event, SkillID skill=SkillID::ZERO);
int mobskill_event(struct mob_data *md, int flag);
void mobskill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t data);
void mobskill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t data);
diff --git a/src/map/mob.t.hpp b/src/map/mob.t.hpp
new file mode 100644
index 0000000..edbbf40
--- /dev/null
+++ b/src/map/mob.t.hpp
@@ -0,0 +1,93 @@
+#ifndef MOB_T_HPP
+#define MOB_T_HPP
+
+enum class MST
+{
+ MST_TARGET = 0,
+#define MST_TARGET MST::MST_TARGET
+ MST_SELF,
+#define MST_SELF MST::MST_SELF
+ MST_FRIEND,
+#define MST_FRIEND MST::MST_FRIEND
+ MST_MASTER,
+#define MST_MASTER MST::MST_MASTER
+ MST_AROUND5,
+#define MST_AROUND5 MST::MST_AROUND5
+ MST_AROUND6,
+#define MST_AROUND6 MST::MST_AROUND6
+ MST_AROUND7,
+#define MST_AROUND7 MST::MST_AROUND7
+ MST_AROUND8,
+#define MST_AROUND8 MST::MST_AROUND8
+ MST_AROUND1,
+#define MST_AROUND1 MST::MST_AROUND1
+ MST_AROUND2,
+#define MST_AROUND2 MST::MST_AROUND2
+ MST_AROUND3,
+#define MST_AROUND3 MST::MST_AROUND3
+ MST_AROUND4,
+#define MST_AROUND4 MST::MST_AROUND4
+ MST_AROUND = MST_AROUND4,
+#define MST_AROUND MST::MST_AROUND
+};
+
+enum class MSC : uint16_t
+{
+ // used as something that never compares true
+ NEVER_EQUAL = 0xfffe,
+ ANY = 0xffff,
+
+ MSC_ALWAYS = 0x0000,
+#define MSC_ALWAYS MSC::MSC_ALWAYS
+ MSC_MYHPLTMAXRATE = 0x0001,
+#define MSC_MYHPLTMAXRATE MSC::MSC_MYHPLTMAXRATE
+ MSC_FRIENDHPLTMAXRATE = 0x0010,
+#define MSC_FRIENDHPLTMAXRATE MSC::MSC_FRIENDHPLTMAXRATE
+ MSC_MYSTATUSON = 0x0020,
+#define MSC_MYSTATUSON MSC::MSC_MYSTATUSON
+ MSC_MYSTATUSOFF = 0x0021,
+#define MSC_MYSTATUSOFF MSC::MSC_MYSTATUSOFF
+ MSC_FRIENDSTATUSON = 0x0030,
+#define MSC_FRIENDSTATUSON MSC::MSC_FRIENDSTATUSON
+ MSC_FRIENDSTATUSOFF = 0x0031,
+#define MSC_FRIENDSTATUSOFF MSC::MSC_FRIENDSTATUSOFF
+ MSC_NOTINTOWN = 0x0032,
+#define MSC_NOTINTOWN MSC::MSC_NOTINTOWN
+
+ MSC_ATTACKPCGT = 0x0100,
+#define MSC_ATTACKPCGT MSC::MSC_ATTACKPCGT
+ MSC_ATTACKPCGE = 0x0101,
+#define MSC_ATTACKPCGE MSC::MSC_ATTACKPCGE
+ MSC_SLAVELT = 0x0110,
+#define MSC_SLAVELT MSC::MSC_SLAVELT
+ MSC_SLAVELE = 0x0111,
+#define MSC_SLAVELE MSC::MSC_SLAVELE
+ MSC_CLOSEDATTACKED = 0x1000,
+#define MSC_CLOSEDATTACKED MSC::MSC_CLOSEDATTACKED
+ MSC_LONGRANGEATTACKED = 0x1001,
+#define MSC_LONGRANGEATTACKED MSC::MSC_LONGRANGEATTACKED
+ MSC_SKILLUSED = 0x1010,
+#define MSC_SKILLUSED MSC::MSC_SKILLUSED
+ MSC_CASTTARGETED = 0x1011,
+#define MSC_CASTTARGETED MSC::MSC_CASTTARGETED
+};
+
+enum class MSS : uint8_t
+{
+ ANY = 0xff,
+
+ MSS_IDLE = 0,
+#define MSS_IDLE MSS::MSS_IDLE
+ MSS_WALK,
+#define MSS_WALK MSS::MSS_WALK
+ MSS_ATTACK,
+#define MSS_ATTACK MSS::MSS_ATTACK
+ MSS_DEAD,
+#define MSS_DEAD MSS::MSS_DEAD
+ MSS_LOOT,
+#define MSS_LOOT MSS::MSS_LOOT
+ MSS_CHASE,
+#define MSS_CHASE MSS::MSS_CHASE
+};
+
+#endif
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index c3f4533..6446044 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -77,11 +77,12 @@ static int exp_table[14][MAX_LEVEL];
static char statp[255][7];
static struct
{
- int id;
+ SkillID id;
int max;
struct
{
- short id, lv;
+ SkillID id;
+ short lv;
} need[6];
} skill_tree[3][MAX_PC_CLASS][100];
@@ -623,7 +624,7 @@ int pc_setequipindex(struct map_session_data *sd)
int pc_isequip(struct map_session_data *sd, int n)
{
struct item_data *item;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
//転生や養子の場合の元の職業を算出する
nullpo_retr(0, sd);
@@ -673,7 +674,7 @@ int pc_breakweapon(struct map_session_data *sd)
return -1;
if (sd->unbreakable >= MRAND(100))
return 0;
- if (sd->sc_data && sd->sc_data[SC_CP_WEAPON].timer != -1)
+ if (sd->sc_data[SC_CP_WEAPON].timer != -1)
return 0;
for (i = 0; i < MAX_INVENTORY; i++)
@@ -718,7 +719,7 @@ int pc_breakarmor(struct map_session_data *sd)
return -1;
if (sd->unbreakable >= MRAND(100))
return 0;
- if (sd->sc_data && sd->sc_data[SC_CP_ARMOR].timer != -1)
+ if (sd->sc_data[SC_CP_ARMOR].timer != -1)
return 0;
for (i = 0; i < MAX_INVENTORY; i++)
@@ -798,7 +799,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time,
sd->attacktimer = -1;
sd->followtimer = -1; // [MouseJstr]
sd->skilltimer = -1;
- sd->skillitem = -1;
+ sd->skillitem = SkillID::NEGATIVE;
sd->skillitemlv = -1;
sd->invincible_timer = -1;
sd->sg_count = 0;
@@ -847,7 +848,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time,
pc_checkitem(sd);
// ステータス異常の初期化
- for (int i = 0; i < MAX_STATUSCHANGE; i++)
+ for (StatusChange i : erange(StatusChange(), MAX_STATUSCHANGE))
{
sd->sc_data[i].timer = -1;
sd->sc_data[i].val1 = sd->sc_data[i].val2 = sd->sc_data[i].val3 =
@@ -1133,15 +1134,19 @@ int pc_calc_skilltree(struct map_session_data *sd)
&& pc_isGM(sd) >= battle_config.gm_allskill)
{
// 全てのスキル
- for (i = 1; i < 158; i++)
+
+ // Restoring oritinal values
+ // This one is probably more correct than the copypasta
+ for (SkillID i : erange(NV_EMOTE, NPC_PIERCINGATT))
sd->status.skill[i].id = i;
- for (i = 210; i < 291; i++)
+ for (SkillID i : erange(RG_SNATCHER, SA_MONOCELL))
sd->status.skill[i].id = i;
- for (i = 304; i < 337; i++)
+ for (SkillID i : erange(BD_ADAPTATION, SkillID(uint16_t(WE_CALLPARTNER) + 1)))
sd->status.skill[i].id = i;
if (battle_config.enable_upper_class)
- { //confで無効でなければ読み込む
- for (i = 355; i < MAX_SKILL; i++)
+ {
+ //confで無効でなければ読み込む
+ for (SkillID i : erange(LK_AURABLADE, MAX_SKILL))
sd->status.skill[i].id = i;
}
@@ -1152,21 +1157,25 @@ int pc_calc_skilltree(struct map_session_data *sd)
do
{
flag = 0;
- for (i = 0;(id = skill_tree[s][c][i].id) > 0; i++)
+ SkillID id;
+ for (i = 0;
+ (id = skill_tree[s][c][i].id) != SkillID::ZERO
+ && id != SkillID::NEGATIVE;
+ i++)
{
int j, f = 1;
if (!battle_config.skillfree)
{
for (j = 0; j < 5; j++)
{
- if (skill_tree[s][c][i].need[j].id &&
- pc_checkskill(sd,
+ if (skill_tree[s][c][i].need[j].id != SkillID::ZERO
+ && pc_checkskill(sd,
skill_tree[s][c][i].need[j].id) <
skill_tree[s][c][i].need[j].lv)
f = 0;
}
}
- if (f && sd->status.skill[id].id == 0)
+ if (f && sd->status.skill[id].id == SkillID::ZERO)
{
sd->status.skill[id].id = id;
flag = 1;
@@ -1243,7 +1252,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
int b_aspd, b_watk, b_def, b_watk2, b_def2, b_flee2, b_critical,
b_attackrange, b_matk1, b_matk2, b_mdef, b_mdef2, b_class;
int b_base_atk;
- struct skill b_skill[MAX_SKILL];
+ earray<struct skill, SkillID, MAX_SKILL> b_skill;
int i, bl, index;
int skill, aspd_rate, wele, wele_, def_ele, refinedef = 0;
int str, dstr, dex;
@@ -1263,7 +1272,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
b_max_weight = sd->max_weight;
memcpy(b_paramb, &sd->paramb, sizeof(b_paramb));
memcpy(b_parame, &sd->paramc, sizeof(b_parame));
- memcpy(b_skill, &sd->status.skill, sizeof(b_skill));
+ b_skill = sd->status.skill;
b_hit = sd->hit;
b_flee = sd->flee;
b_aspd = sd->aspd;
@@ -1356,9 +1365,12 @@ int pc_calcstatus(struct map_session_data *sd, int first)
memset(sd->addsize_, 0, sizeof(sd->addsize_));
memset(sd->subele, 0, sizeof(sd->subele));
memset(sd->subrace, 0, sizeof(sd->subrace));
- memset(sd->addeff, 0, sizeof(sd->addeff));
- memset(sd->addeff2, 0, sizeof(sd->addeff2));
- memset(sd->reseff, 0, sizeof(sd->reseff));
+ for (int& ire : sd->addeff)
+ ire = 0;
+ for (int& ire : sd->addeff2)
+ ire = 0;
+ for (int& ire : sd->reseff)
+ ire = 0;
memset(&sd->special_state, 0, sizeof(sd->special_state));
memset(sd->weapon_coma_ele, 0, sizeof(sd->weapon_coma_ele));
memset(sd->weapon_coma_race, 0, sizeof(sd->weapon_coma_race));
@@ -1385,8 +1397,10 @@ int pc_calcstatus(struct map_session_data *sd, int first)
memset(sd->arrow_addele, 0, sizeof(sd->arrow_addele));
memset(sd->arrow_addrace, 0, sizeof(sd->arrow_addrace));
memset(sd->arrow_addsize, 0, sizeof(sd->arrow_addsize));
- memset(sd->arrow_addeff, 0, sizeof(sd->arrow_addeff));
- memset(sd->arrow_addeff2, 0, sizeof(sd->arrow_addeff2));
+ for (int& ire : sd->arrow_addeff)
+ ire = 0;
+ for (int& ire : sd->arrow_addeff2)
+ ire = 0;
memset(sd->magic_addele, 0, sizeof(sd->magic_addele));
memset(sd->magic_addrace, 0, sizeof(sd->magic_addrace));
memset(sd->magic_subrace, 0, sizeof(sd->magic_subrace));
@@ -1411,7 +1425,8 @@ int pc_calcstatus(struct map_session_data *sd, int first)
sd->speed_add_rate = sd->aspd_add_rate = 100;
sd->double_add_rate = sd->perfect_hit_add = sd->get_zeny_add_num = 0;
sd->splash_range = sd->splash_add_range = 0;
- sd->autospell_id = sd->autospell_lv = sd->autospell_rate = 0;
+ sd->autospell_id = SkillID::ZERO;
+ sd->autospell_lv = sd->autospell_rate = 0;
sd->hp_drain_rate = sd->hp_drain_per = sd->sp_drain_rate =
sd->sp_drain_per = 0;
sd->hp_drain_rate_ = sd->hp_drain_per_ = sd->sp_drain_rate_ =
@@ -1922,7 +1937,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
if (sd->hprate != 100)
sd->status.max_hp = sd->status.max_hp * sd->hprate / 100;
- if (sd->sc_data && sd->sc_data[SC_BERSERK].timer != -1)
+ if (sd->sc_data[SC_BERSERK].timer != -1)
{ // バーサーク
sd->status.max_hp = sd->status.max_hp * 3;
sd->status.hp = sd->status.hp * 3;
@@ -2186,8 +2201,13 @@ int pc_calcstatus(struct map_session_data *sd, int first)
(sd->sc_data[SC_DONTFORGETME].val3 & 0xffff)) /
100;
}
- if (sd->sc_data[i = SC_SPEEDPOTION2].timer != -1 || sd->sc_data[i = SC_SPEEDPOTION1].timer != -1 || sd->sc_data[i = SC_SPEEDPOTION0].timer != -1) // 増 速ポーション
- aspd_rate -= sd->sc_data[i].val1;
+ {
+ StatusChange i;
+ if (sd->sc_data[i = SC_SPEEDPOTION2].timer != -1
+ || sd->sc_data[i = SC_SPEEDPOTION1].timer != -1
+ || sd->sc_data[i = SC_SPEEDPOTION0].timer != -1)
+ aspd_rate -= sd->sc_data[i].val1;
+ }
if (sd->sc_data[SC_HASTE].timer != -1)
aspd_rate -= sd->sc_data[SC_HASTE].val1;
@@ -2315,7 +2335,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
(sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1 * 5)) / 100;
}
if (sd->sc_data[SC_ENCPOISON].timer != -1)
- sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2;
+ sd->addeff[BadSC::POISON] += sd->sc_data[SC_ENCPOISON].val2;
if (sd->sc_data[SC_DANCING].timer != -1)
{ // 演奏/ダンス使用中
@@ -2391,7 +2411,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
clif_changelook(&sd->bl, LOOK_WEAPON, 0);
}
- if (memcmp(b_skill, sd->status.skill, sizeof(sd->status.skill))
+ if (memcmp(&b_skill, &sd->status.skill, sizeof(sd->status.skill))
|| b_attackrange != sd->attackrange)
clif_skillinfoblock(sd); // スキル送信
@@ -2910,19 +2930,19 @@ int pc_bonus2(struct map_session_data *sd, int type, int type2, int val)
break;
case SP_ADDEFF:
if (sd->state.lr_flag != 2)
- sd->addeff[type2] += val;
+ sd->addeff[BadSC(type2)] += val;
else
- sd->arrow_addeff[type2] += val;
+ sd->arrow_addeff[BadSC(type2)] += val;
break;
case SP_ADDEFF2:
if (sd->state.lr_flag != 2)
- sd->addeff2[type2] += val;
+ sd->addeff2[BadSC(type2)] += val;
else
- sd->arrow_addeff2[type2] += val;
+ sd->arrow_addeff2[BadSC(type2)] += val;
break;
case SP_RESEFF:
if (sd->state.lr_flag != 2)
- sd->reseff[type2] += val;
+ sd->reseff[BadSC(type2)] += val;
break;
case SP_MAGIC_ADDELE:
if (sd->state.lr_flag != 2)
@@ -3123,7 +3143,7 @@ int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3,
case SP_AUTOSPELL:
if (sd->state.lr_flag != 2)
{
- sd->autospell_id = type2;
+ sd->autospell_id = SkillID(type2);
sd->autospell_lv = type3;
sd->autospell_rate = val;
}
@@ -3142,7 +3162,7 @@ int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3,
* スクリプトによるスキル所得
*------------------------------------------
*/
-int pc_skill(struct map_session_data *sd, int id, int level, int flag)
+int pc_skill(struct map_session_data *sd, SkillID id, int level, int flag)
{
nullpo_retr(0, sd);
@@ -4021,7 +4041,7 @@ int pc_steal_coin(struct map_session_data *sd, struct block_list *bl)
{
int rate, skill;
struct mob_data *md = (struct mob_data *) bl;
- if (md && !md->state.steal_coin_flag && md->sc_data
+ if (md && !md->state.steal_coin_flag
&& md->sc_data[SC_STONE].timer == -1
&& md->sc_data[SC_FREEZE].timer == -1)
{
@@ -4429,7 +4449,7 @@ static void pc_walk(timer_id tid, tick_t tick, custom_id_t id, custom_data_t dat
break;
}
// 被ディボーション検査
- if (sd->sc_data && sd->sc_data[SC_DEVOTION].val1)
+ if (sd->sc_data[SC_DEVOTION].val1)
{
skill_devotion2(&sd->bl, sd->sc_data[SC_DEVOTION].val1);
}
@@ -4617,15 +4637,10 @@ int pc_movepos(struct map_session_data *sd, int dst_x, int dst_y)
* スキルの検索 所有していた場合Lvが返る
*------------------------------------------
*/
-int pc_checkskill(struct map_session_data *sd, int skill_id)
+int pc_checkskill(struct map_session_data *sd, SkillID skill_id)
{
if (sd == NULL)
return 0;
- if (skill_id >= 10000)
- {
- // was: guild skills
- return 0;
- }
if (sd->status.skill[skill_id].id == skill_id)
return (sd->status.skill[skill_id].lv);
@@ -4647,9 +4662,6 @@ int pc_checkallowskill(struct map_session_data *sd)
{
nullpo_retr(0, sd);
- if (sd->sc_data == NULL)
- return 0;
-
if (!(skill_get_weapontype(KN_TWOHANDQUICKEN) & (1 << sd->status.weapon))
&& sd->sc_data[SC_TWOHANDQUICKEN].timer != -1)
{ // 2HQ
@@ -4787,7 +4799,7 @@ void pc_attack_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t da
{
struct map_session_data *sd;
struct block_list *bl;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
short *opt;
int dist, skill, range;
int attack_spell_delay;
@@ -4828,9 +4840,9 @@ void pc_attack_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t da
if ((opt = battle_get_option(bl)) != NULL && *opt & 0x46)
return;
- if (((sc_data = battle_get_sc_data(bl)) != NULL
+ if (((sc_data = battle_get_sc_data(bl))
&& sc_data[SC_TRICKDEAD].timer != -1)
- || ((sc_data = battle_get_sc_data(bl)) != NULL
+ || ((sc_data = battle_get_sc_data(bl))
&& sc_data[SC_BASILICA].timer != -1))
return;
@@ -4842,7 +4854,7 @@ void pc_attack_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t da
{
if (DIFF_TICK(tick, sd->canact_tick) < 0)
{
- clif_skill_fail(sd, 1, 4, 0);
+ clif_skill_fail(sd, SkillID::ONE, 4, 0);
return;
}
}
@@ -5117,13 +5129,13 @@ int pc_checkbaselevelup(struct map_session_data *sd)
static
int pc_skillpt_potential(struct map_session_data *sd)
{
- int skill_id;
int potential = 0;
#define RAISE_COST(x) (((x)*((x)-1))>>1)
- for (skill_id = 0; skill_id < MAX_SKILL; skill_id++)
- if (sd->status.skill[skill_id].id != 0
+ for (SkillID skill_id = SkillID(); skill_id < MAX_SKILL;
+ skill_id = SkillID(uint16_t(skill_id) + 1))
+ if (sd->status.skill[skill_id].id != SkillID::ZERO
&& sd->status.skill[skill_id].lv < skill_db[skill_id].max_raise)
potential += RAISE_COST(skill_db[skill_id].max_raise)
- RAISE_COST(sd->status.skill[skill_id].lv);
@@ -5562,11 +5574,11 @@ int pc_statusup2(struct map_session_data *sd, int type, int val)
* スキルポイント割り振り
*------------------------------------------
*/
-int pc_skillup(struct map_session_data *sd, int skill_num)
+int pc_skillup(struct map_session_data *sd, SkillID skill_num)
{
nullpo_retr(0, sd);
- if (sd->status.skill[skill_num].id != 0
+ if (sd->status.skill[skill_num].id != SkillID::ZERO
&& sd->status.skill_point >= sd->status.skill[skill_num].lv
&& sd->status.skill[skill_num].lv < skill_db[skill_num].max_raise)
{
@@ -5578,7 +5590,7 @@ int pc_skillup(struct map_session_data *sd, int skill_num)
clif_updatestatus(sd, SP_SKILLPOINT);
clif_skillinfoblock(sd);
MAP_LOG_PC(sd, "SKILLUP %d %d %d",
- skill_num, sd->status.skill[skill_num].lv, skill_power(sd, skill_num));
+ uint16_t(skill_num), sd->status.skill[skill_num].lv, skill_power(sd, skill_num));
}
return 0;
@@ -5601,25 +5613,35 @@ int pc_allskillup(struct map_session_data *sd)
c = s_class.job;
s = (s_class.upper == 1) ? 1 : 0; //転生以外は通常のスキル?
- for (i = 0; i < MAX_SKILL; i++)
- sd->status.skill[i].id = 0;
+ for (SkillID i : erange(SkillID(), MAX_SKILL))
+ sd->status.skill[i].id = SkillID::ZERO;
if (battle_config.gm_allskill > 0
&& pc_isGM(sd) >= battle_config.gm_allskill)
{
// 全てのスキル
- for (i = 1; i < 158; i++)
+
+ // Note: I restored to the original value, not the new ones.
+ // However, I left the MAX_SKILL, which was wrong and is fixed.
+ for (SkillID i : erange(NV_EMOTE, NPC_PIERCINGATT))
sd->status.skill[i].lv = skill_get_max(i);
- for (i = 210; i < 291; i++)
+ // Skip NPC_*
+ for (SkillID i : erange(RG_SNATCHER, SA_MONOCELL))
sd->status.skill[i].lv = skill_get_max(i);
- for (i = 304; i < MAX_SKILL; i++)
+ // Not sure why these few are skipped though
+ for (SkillID i : erange(BD_ADAPTATION, MAX_SKILL))
sd->status.skill[i].lv = skill_get_max(i);
}
else
{
- for (i = 0;(id = skill_tree[s][c][i].id) > 0; i++)
+ SkillID id;
+ for (i = 0;
+ (id = skill_tree[s][c][i].id) != SkillID::ZERO
+ && id != SkillID::NEGATIVE;
+ i++)
{
- if (sd->status.skill[id].id == 0 && skill_get_inf2(id) & 0x01)
+ if (sd->status.skill[id].id == SkillID::ZERO
+ && skill_get_inf2(id) & 0x01)
sd->status.skill[id].lv = skill_get_max(id);
}
}
@@ -5634,11 +5656,9 @@ int pc_allskillup(struct map_session_data *sd)
*/
int pc_resetlvl(struct map_session_data *sd, int type)
{
- int i;
-
nullpo_retr(0, sd);
- for (i = 1; i < MAX_SKILL; i++)
+ for (SkillID i : erange(SkillID(1), MAX_SKILL))
{
sd->status.skill[i].lv = 0;
}
@@ -5703,7 +5723,7 @@ int pc_resetlvl(struct map_session_data *sd, int type)
clif_updatestatus(sd, SP_UDEX);
clif_updatestatus(sd, SP_ULUK); // End Addition
- for (i = 0; i < 11; i++)
+ for (int i = 0; i < 11; i++)
{ // unequip items that can't be equipped by base 1 [Valaris]
if (sd->equip_index[i] >= 0)
if (!pc_isequip(sd, sd->equip_index[i]))
@@ -5779,13 +5799,13 @@ int pc_resetstate(struct map_session_data *sd)
*/
int pc_resetskill(struct map_session_data *sd)
{
- int i, skill;
+ int skill;
nullpo_retr(0, sd);
sd->status.skill_point += pc_calc_skillpoint(sd);
- for (i = 1; i < MAX_SKILL; i++)
+ for (SkillID i : erange(SkillID(1), MAX_SKILL))
if ((skill = pc_checkskill(sd, i)) > 0)
{
sd->status.skill[i].lv = 0;
@@ -6337,7 +6357,7 @@ int pc_heal(struct map_session_data *sd, int hp, int sp)
sp = 0;
}
- if (sd->sc_data && sd->sc_data[SC_BERSERK].timer != -1) //バーサーク中は回復させないらしい
+ if (sd->sc_data[SC_BERSERK].timer != -1) //バーサーク中は回復させないらしい
return 0;
if (hp + sd->status.hp > sd->status.max_hp)
@@ -6449,7 +6469,7 @@ static int pc_itemheal_effect(struct map_session_data *sd, int hp, int sp)
nullpo_retr(0, sd);
- if (sd->sc_data && sd->sc_data[SC_GOSPEL].timer != -1) //バーサーク中は回復させないらしい
+ if (sd->sc_data[SC_GOSPEL].timer != -1) //バーサーク中は回復させないらしい
return 0;
if (sd->state.potionpitcher_flag)
@@ -6773,7 +6793,7 @@ int pc_setcart(struct map_session_data *sd, int type)
clif_cart_itemlist(sd);
clif_cart_equiplist(sd);
clif_updatestatus(sd, SP_CARTINFO);
- clif_status_change(&sd->bl, 0x0c, 0);
+ clif_status_change(&sd->bl, StatusChange::CART, 0);
}
else
{
@@ -7543,7 +7563,7 @@ int pc_unequipitem(struct map_session_data *sd, int n, int type)
if (!type)
pc_checkallowskill(sd);
if (sd->weapontype1 == 0 && sd->weapontype2 == 0)
- skill_encchant_eremental_end(&sd->bl, -1); //武器持ち誓えは無条件で属性付与解除
+ skill_encchant_eremental_end(&sd->bl, StatusChange::NEGATIVE1);
}
else
{
@@ -8098,7 +8118,7 @@ static int pc_natural_heal_sp(struct map_session_data *sd)
static int pc_spirit_heal_hp(struct map_session_data *sd, int level)
{
int bonus_hp, interval = battle_config.natural_heal_skill_interval;
- struct status_change *sc_data = battle_get_sc_data(&sd->bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(&sd->bl);
nullpo_retr(0, sd);
@@ -8273,7 +8293,7 @@ static int pc_natural_heal_sub(struct map_session_data *sd, va_list ap)
&& !pc_ishiding(sd) && sd->sc_data[SC_POISON].timer == -1)
{
pc_natural_heal_hp(sd);
- if (sd->sc_data && sd->sc_data[SC_EXTREMITYFIST].timer == -1 && //阿修羅状態ではSPが回復しない
+ if (sd->sc_data[SC_EXTREMITYFIST].timer == -1 && //阿修羅状態ではSPが回復しない
sd->sc_data[SC_DANCING].timer == -1 && //ダンス状態ではSPが回復しない
sd->sc_data[SC_BERSERK].timer == -1 //バーサーク状態ではSPが回復しない
)
@@ -8457,7 +8477,7 @@ void pc_setstand(struct map_session_data *sd)
{
nullpo_retv(sd);
- if (sd->sc_data && sd->sc_data[SC_TENSIONRELAX].timer != -1)
+ if (sd->sc_data[SC_TENSIONRELAX].timer != -1)
skill_status_change_end(&sd->bl, SC_TENSIONRELAX, -1);
sd->state.dead_sit = 0;
@@ -8643,16 +8663,16 @@ int pc_readdb(void)
if (j < 13)
continue;
i = atoi(split[0]);
- for (j = 0; skill_tree[0][i][j].id; j++);
- skill_tree[0][i][j].id = atoi(split[1]);
+ for (j = 0; skill_tree[0][i][j].id != SkillID::ZERO; j++);
+ skill_tree[0][i][j].id = SkillID(atoi(split[1]));
skill_tree[0][i][j].max = atoi(split[2]);
- skill_tree[2][i][j].id = atoi(split[1]); //養子職は良く分からないので暫定
+ skill_tree[2][i][j].id = SkillID(atoi(split[1])); //養子職は良く分からないので暫定
skill_tree[2][i][j].max = atoi(split[2]); //養子職は良く分からないので暫定
for (k = 0; k < 5; k++)
{
- skill_tree[0][i][j].need[k].id = atoi(split[k * 2 + 3]);
+ skill_tree[0][i][j].need[k].id = SkillID(atoi(split[k * 2 + 3]));
skill_tree[0][i][j].need[k].lv = atoi(split[k * 2 + 4]);
- skill_tree[2][i][j].need[k].id = atoi(split[k * 2 + 3]); //養子職は良く分からないので暫定
+ skill_tree[2][i][j].need[k].id = SkillID(atoi(split[k * 2 + 3])); //養子職は良く分からないので暫定
skill_tree[2][i][j].need[k].lv = atoi(split[k * 2 + 4]); //養子職は良く分からないので暫定
}
}
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index 9027694..2f53f8e 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -45,7 +45,7 @@ int pc_equippoint(struct map_session_data *sd, int n);
int pc_breakweapon(struct map_session_data *sd); // weapon breaking [Valaris]
int pc_breakarmor(struct map_session_data *sd); // armor breaking [Valaris]
-int pc_checkskill(struct map_session_data *sd, int skill_id);
+int pc_checkskill(struct map_session_data *sd, SkillID skill_id);
int pc_checkallowskill(struct map_session_data *sd);
int pc_checkequip(struct map_session_data *sd, int pos);
@@ -90,7 +90,7 @@ int pc_calcstatus(struct map_session_data *, int);
int pc_bonus(struct map_session_data *, int, int);
int pc_bonus2(struct map_session_data *sd, int, int, int);
int pc_bonus3(struct map_session_data *sd, int, int, int, int);
-int pc_skill(struct map_session_data *, int, int, int);
+int pc_skill(struct map_session_data *, SkillID, int, int);
int pc_insert_card(struct map_session_data *sd, int idx_card,
int idx_equip);
@@ -124,7 +124,7 @@ int pc_nextjobafter(struct map_session_data *); // [Valaris]
int pc_need_status_point(struct map_session_data *, int);
int pc_statusup(struct map_session_data *, int);
int pc_statusup2(struct map_session_data *, int, int);
-int pc_skillup(struct map_session_data *, int);
+int pc_skillup(struct map_session_data *, SkillID);
int pc_allskillup(struct map_session_data *);
int pc_resetlvl(struct map_session_data *, int type);
int pc_resetstate(struct map_session_data *);
diff --git a/src/map/script.cpp b/src/map/script.cpp
index e2181e2..6ed0863 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -3378,10 +3378,10 @@ void builtin_bonus3(ScriptState *st)
*/
void builtin_skill(ScriptState *st)
{
- int id, level, flag = 1;
+ int level, flag = 1;
struct map_session_data *sd;
- id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
level = conv_num(st, &(st->stack->stack_data[st->start + 3]));
if (st->end > st->start + 4)
flag = conv_num(st, &(st->stack->stack_data[st->start + 4]));
@@ -3397,14 +3397,14 @@ void builtin_skill(ScriptState *st)
*/
void builtin_setskill(ScriptState *st)
{
- int id, level;
+ int level;
struct map_session_data *sd;
- id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
level = conv_num(st, &(st->stack->stack_data[st->start + 3]));
sd = script_rid2sd(st);
- sd->status.skill[id].id = level ? id : 0;
+ sd->status.skill[id].id = level ? id : SkillID();
sd->status.skill[id].lv = level;
clif_skillinfoblock(sd);
}
@@ -3415,7 +3415,7 @@ void builtin_setskill(ScriptState *st)
*/
void builtin_getskilllv(ScriptState *st)
{
- int id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
push_val(st->stack, ScriptCode::INT, pc_checkskill(script_rid2sd(st), id));
}
@@ -3769,10 +3769,10 @@ void builtin_openstorage(ScriptState *st)
*/
void builtin_itemskill(ScriptState *st)
{
- int id, lv;
+ int lv;
struct map_session_data *sd = script_rid2sd(st);
- id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
lv = conv_num(st, &(st->stack->stack_data[st->start + 3]));
const char *str = conv_str(st, &(st->stack->stack_data[st->start + 4]));
@@ -4349,8 +4349,8 @@ void builtin_hideonnpc(ScriptState *st)
void builtin_sc_start(ScriptState *st)
{
struct block_list *bl;
- int type, tick, val1;
- type = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ int tick, val1;
+ StatusChange type = StatusChange(conv_num(st, &(st->stack->stack_data[st->start + 2])));
tick = conv_num(st, &(st->stack->stack_data[st->start + 3]));
val1 = conv_num(st, &(st->stack->stack_data[st->start + 4]));
if (st->end > st->start + 5) //指定したキャラを状態異常にする
@@ -4370,8 +4370,8 @@ void builtin_sc_start(ScriptState *st)
void builtin_sc_start2(ScriptState *st)
{
struct block_list *bl;
- int type, tick, val1, per;
- type = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ int tick, val1, per;
+ StatusChange type = StatusChange(conv_num(st, &(st->stack->stack_data[st->start + 2])));
tick = conv_num(st, &(st->stack->stack_data[st->start + 3]));
val1 = conv_num(st, &(st->stack->stack_data[st->start + 4]));
per = conv_num(st, &(st->stack->stack_data[st->start + 5]));
@@ -4393,8 +4393,7 @@ void builtin_sc_start2(ScriptState *st)
void builtin_sc_end(ScriptState *st)
{
struct block_list *bl;
- int type;
- type = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ StatusChange type = StatusChange(conv_num(st, &(st->stack->stack_data[st->start + 2])));
bl = map_id2bl(st->rid);
if (bl->type == BL_PC
&& ((struct map_session_data *) bl)->state.potionpitcher_flag)
@@ -4407,8 +4406,7 @@ void builtin_sc_end(ScriptState *st)
void builtin_sc_check(ScriptState *st)
{
struct block_list *bl;
- int type;
- type = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ StatusChange type = StatusChange(conv_num(st, &(st->stack->stack_data[st->start + 2])));
bl = map_id2bl(st->rid);
if (bl->type == BL_PC
&& ((struct map_session_data *) bl)->state.potionpitcher_flag)
@@ -4426,9 +4424,9 @@ void builtin_getscrate(ScriptState *st)
{
struct block_list *bl;
int sc_def = 100, sc_def_mdef2, sc_def_vit2, sc_def_int2, sc_def_luk2;
- int type, rate, luk;
+ int rate, luk;
- type = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ StatusChange type = StatusChange(conv_num(st, &(st->stack->stack_data[st->start + 2])));
rate = conv_num(st, &(st->stack->stack_data[st->start + 3]));
if (st->end > st->start + 4) //指定したキャラの耐性を計算する
bl = map_id2bl(conv_num(st, &(st->stack->stack_data[st->start + 6])));
@@ -5567,15 +5565,17 @@ void builtin_getinventorylist(ScriptState *st)
void builtin_getskilllist(ScriptState *st)
{
struct map_session_data *sd = script_rid2sd(st);
- int i, j = 0;
+ int j = 0;
if (!sd)
return;
- for (i = 0; i < MAX_SKILL; i++)
+ for (SkillID i : erange(SkillID(), MAX_SKILL))
{
- if (sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0)
+ if (sd->status.skill[i].id != SkillID::ZERO
+ && sd->status.skill[i].id != SkillID::NEGATIVE
+ && sd->status.skill[i].lv > 0)
{
pc_setreg(sd, add_str("@skilllist_id") + (j << 24),
- sd->status.skill[i].id);
+ uint16_t(sd->status.skill[i].id));
pc_setreg(sd, add_str("@skilllist_lv") + (j << 24),
sd->status.skill[i].lv);
pc_setreg(sd, add_str("@skilllist_flag") + (j << 24),
@@ -5589,7 +5589,7 @@ void builtin_getskilllist(ScriptState *st)
void builtin_get_activated_pool_skills(ScriptState *st)
{
struct map_session_data *sd = script_rid2sd(st);
- int pool_skills[MAX_SKILL_POOL];
+ SkillID pool_skills[MAX_SKILL_POOL];
int skill_pool_size = skill_pool(sd, pool_skills);
int i, count = 0;
@@ -5598,12 +5598,12 @@ void builtin_get_activated_pool_skills(ScriptState *st)
for (i = 0; i < skill_pool_size; i++)
{
- int skill_id = pool_skills[i];
+ SkillID skill_id = pool_skills[i];
if (sd->status.skill[skill_id].id == skill_id)
{
pc_setreg(sd, add_str("@skilllist_id") + (count << 24),
- sd->status.skill[skill_id].id);
+ uint16_t(sd->status.skill[skill_id].id));
pc_setreg(sd, add_str("@skilllist_lv") + (count << 24),
sd->status.skill[skill_id].lv);
pc_setreg(sd, add_str("@skilllist_flag") + (count << 24),
@@ -5617,9 +5617,6 @@ void builtin_get_activated_pool_skills(ScriptState *st)
}
-extern int skill_pool_skills[];
-extern int skill_pool_skills_size;
-
void builtin_get_unactivated_pool_skills(ScriptState *st)
{
struct map_session_data *sd = script_rid2sd(st);
@@ -5630,12 +5627,12 @@ void builtin_get_unactivated_pool_skills(ScriptState *st)
for (i = 0; i < skill_pool_skills_size; i++)
{
- int skill_id = skill_pool_skills[i];
+ SkillID skill_id = skill_pool_skills[i];
if (sd->status.skill[skill_id].id == skill_id && !(sd->status.skill[skill_id].flags & SKILL_POOL_ACTIVATED))
{
pc_setreg(sd, add_str("@skilllist_id") + (count << 24),
- sd->status.skill[skill_id].id);
+ uint16_t(sd->status.skill[skill_id].id));
pc_setreg(sd, add_str("@skilllist_lv") + (count << 24),
sd->status.skill[skill_id].lv);
pc_setreg(sd, add_str("@skilllist_flag") + (count << 24),
@@ -5659,12 +5656,12 @@ void builtin_get_pool_skills(ScriptState *st)
for (i = 0; i < skill_pool_skills_size; i++)
{
- int skill_id = skill_pool_skills[i];
+ SkillID skill_id = skill_pool_skills[i];
if (sd->status.skill[skill_id].id == skill_id)
{
pc_setreg(sd, add_str("@skilllist_id") + (count << 24),
- sd->status.skill[skill_id].id);
+ uint16_t(sd->status.skill[skill_id].id));
pc_setreg(sd, add_str("@skilllist_lv") + (count << 24),
sd->status.skill[skill_id].lv);
pc_setreg(sd, add_str("@skilllist_flag") + (count << 24),
@@ -5681,7 +5678,7 @@ void builtin_get_pool_skills(ScriptState *st)
void builtin_activate_pool_skill(ScriptState *st)
{
struct map_session_data *sd = script_rid2sd(st);
- int skill_id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID skill_id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
skill_pool_activate(sd, skill_id);
clif_skillinfoblock(sd);
@@ -5691,7 +5688,7 @@ void builtin_activate_pool_skill(ScriptState *st)
void builtin_deactivate_pool_skill(ScriptState *st)
{
struct map_session_data *sd = script_rid2sd(st);
- int skill_id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID skill_id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
skill_pool_deactivate(sd, skill_id);
clif_skillinfoblock(sd);
@@ -5701,7 +5698,7 @@ void builtin_deactivate_pool_skill(ScriptState *st)
void builtin_check_pool_skill(ScriptState *st)
{
struct map_session_data *sd = script_rid2sd(st);
- int skill_id = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID skill_id = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
push_val(st->stack, ScriptCode::INT, skill_pool_is_activated(sd, skill_id));
@@ -5823,7 +5820,7 @@ void builtin_npcskilleffect(ScriptState *st)
{
struct npc_data *nd = (struct npc_data *) map_id2bl(st->oid);
- int skillid = conv_num(st, &(st->stack->stack_data[st->start + 2]));
+ SkillID skillid = SkillID(conv_num(st, &(st->stack->stack_data[st->start + 2])));
int skilllv = conv_num(st, &(st->stack->stack_data[st->start + 3]));
int x = conv_num(st, &(st->stack->stack_data[st->start + 4]));
int y = conv_num(st, &(st->stack->stack_data[st->start + 5]));
@@ -6601,7 +6598,7 @@ void run_func(ScriptState *st)
{
if (battle_config.error_log)
printf("run_func : %s? (%d(%d))\n", str_buf + str_data[func].str,
- func, str_data[func].type);
+ func, uint8_t(str_data[func].type));
push_val(st->stack, ScriptCode::INT, 0);
}
@@ -6728,7 +6725,7 @@ void run_script_main(const ScriptCode *script, int pos_, int rid, int oid,
default:
if (battle_config.error_log)
- printf("unknown command : %d @ %d\n", c, pos_);
+ printf("unknown command : %d @ %d\n", uint8_t(c), pos_);
st->state = END;
break;
}
diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp
index f827427..f363262 100644
--- a/src/map/skill-pools.cpp
+++ b/src/map/skill-pools.cpp
@@ -24,10 +24,10 @@
#include "memwatch.hpp"
#endif
-int skill_pool_skills[MAX_POOL_SKILLS];
+SkillID skill_pool_skills[MAX_POOL_SKILLS];
int skill_pool_skills_size = 0;
-void skill_pool_register(int id)
+void skill_pool_register(SkillID id)
{
if (skill_pool_skills_size + 1 >= MAX_POOL_SKILLS)
{
@@ -39,21 +39,13 @@ void skill_pool_register(int id)
skill_pool_skills[skill_pool_skills_size++] = id;
}
-const char *skill_name(int skill)
-{
- if (skill > 0 && skill < MAX_SKILL_DB)
- return skill_names[skill].desc;
- else
- return NULL;
-}
-
-int skill_pool(struct map_session_data *sd, int *skills)
+int skill_pool(struct map_session_data *sd, SkillID *skills)
{
int i, count = 0;
for (i = 0; count < MAX_SKILL_POOL && i < skill_pool_skills_size; i++)
{
- int skill_id = skill_pool_skills[i];
+ SkillID skill_id = skill_pool_skills[i];
if (sd->status.skill[skill_id].flags & SKILL_POOL_ACTIVATED)
{
if (skills)
@@ -71,7 +63,7 @@ void skill_pool_empty(struct map_session_data *sd)
for (i = 0; i < skill_pool_skills_size; i++)
{
- int skill_id = skill_pool_skills[i];
+ SkillID skill_id = skill_pool_skills[i];
sd->status.skill[skill_id].flags = 0;
}
}
@@ -86,7 +78,7 @@ int skill_pool_max(struct map_session_data *sd)
return sd->status.skill[TMW_SKILLPOOL].lv;
}
-int skill_pool_activate(struct map_session_data *sd, int skill_id)
+int skill_pool_activate(struct map_session_data *sd, SkillID skill_id)
{
if (sd->status.skill[skill_id].flags & SKILL_POOL_ACTIVATED)
return 0; // Already there
@@ -95,26 +87,26 @@ int skill_pool_activate(struct map_session_data *sd, int skill_id)
{
sd->status.skill[skill_id].flags |= SKILL_POOL_ACTIVATED;
pc_calcstatus(sd, 0);
- MAP_LOG_PC(sd, "SKILL-ACTIVATE %d %d %d", skill_id,
- sd->status.skill[skill_id].lv, skill_power(sd,
- skill_id));
+ MAP_LOG_PC(sd, "SKILL-ACTIVATE %d %d %d",
+ uint16_t(skill_id), sd->status.skill[skill_id].lv,
+ skill_power(sd, skill_id));
return 0;
}
return 1; // failed
}
-int skill_pool_is_activated(struct map_session_data *sd, int skill_id)
+int skill_pool_is_activated(struct map_session_data *sd, SkillID skill_id)
{
return sd->status.skill[skill_id].flags & SKILL_POOL_ACTIVATED;
}
-int skill_pool_deactivate(struct map_session_data *sd, int skill_id)
+int skill_pool_deactivate(struct map_session_data *sd, SkillID skill_id)
{
if (sd->status.skill[skill_id].flags & SKILL_POOL_ACTIVATED)
{
sd->status.skill[skill_id].flags &= ~SKILL_POOL_ACTIVATED;
- MAP_LOG_PC(sd, "SKILL-DEACTIVATE %d", skill_id);
+ MAP_LOG_PC(sd, "SKILL-DEACTIVATE %d", uint16_t(skill_id));
pc_calcstatus(sd, 0);
return 0;
}
@@ -122,12 +114,12 @@ int skill_pool_deactivate(struct map_session_data *sd, int skill_id)
return 1;
}
-int skill_stat(int skill_id)
+int skill_stat(SkillID skill_id)
{
return skill_db[skill_id].stat;
}
-int skill_power(struct map_session_data *sd, int skill_id)
+int skill_power(struct map_session_data *sd, SkillID skill_id)
{
int stat = skill_stat(skill_id);
int stat_value, skill_value;
@@ -149,7 +141,7 @@ int skill_power(struct map_session_data *sd, int skill_id)
return result;
}
-int skill_power_bl(struct block_list *bl, int skill)
+int skill_power_bl(struct block_list *bl, SkillID skill)
{
if (bl->type == BL_PC)
return skill_power((struct map_session_data *) bl, skill);
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 4cd0c06..5f0336f 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -31,234 +31,476 @@
#define STATE_BLIND 0x10
+// This table appears to be wrong
/* スキル番号=>ステータス異常番号変換テーブル */
-int SkillStatusChangeTable[] = { /* skill.hのenumのSC_***とあわせること */
-/* 0- */
- -1, -1, -1, -1, -1, -1,
+earray<StatusChange, SkillID, MAX_SKILL_DB> SkillStatusChangeTable =
+{
+ // 0-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_PROVOKE, /* プロボック */
- -1, 1, -1,
-/* 10- */
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 10-
SC_SIGHT, /* サイト */
- -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_FREEZE, /* フロストダイバー */
SC_STONE, /* ストーンカース */
- -1, -1, -1,
-/* 20- */
- -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 20-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_RUWACH, /* ルアフ */
- -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_INCREASEAGI, /* 速度増加 */
-/* 30- */
+ // 30-
SC_DECREASEAGI, /* 速度減少 */
- -1,
+ StatusChange::NEGATIVE1,
SC_SIGNUMCRUCIS, /* シグナムクルシス */
SC_ANGELUS, /* エンジェラス */
SC_BLESSING, /* ブレッシング */
- -1, -1, -1, -1, -1,
-/* 40- */
- -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 40-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_CONCENTRATE, /* 集中力向上 */
- -1, -1, -1, -1,
-/* 50- */
- -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 50-
+ StatusChange::NEGATIVE1,
SC_HIDING, /* ハイディング */
- -1, -1, -1, -1, -1, -1, -1, -1,
-/* 60- */
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 60-
SC_TWOHANDQUICKEN, /* 2HQ */
SC_AUTOCOUNTER,
- -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_IMPOSITIO, /* インポシティオマヌス */
SC_SUFFRAGIUM, /* サフラギウム */
SC_ASPERSIO, /* アスペルシオ */
SC_BENEDICTIO, /* 聖体降福 */
-/* 70- */
- -1,
+ // 70-
+ StatusChange::NEGATIVE1,
SC_SLOWPOISON,
- -1,
+ StatusChange::NEGATIVE1,
SC_KYRIE, /* キリエエレイソン */
SC_MAGNIFICAT, /* マグニフィカート */
SC_GLORIA, /* グロリア */
SC_DIVINA, /* レックスディビーナ */
- -1,
+ StatusChange::NEGATIVE1,
SC_AETERNA, /* レックスエーテルナ */
- -1,
-/* 80- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 90- */
- -1, -1,
+ StatusChange::NEGATIVE1,
+ // 80-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 90-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_QUAGMIRE, /* クァグマイア */
- -1, -1, -1, -1, -1, -1, -1,
-/* 100- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 110- */
- -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 100-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 110-
+ StatusChange::NEGATIVE1,
SC_ADRENALINE, /* アドレナリンラッシュ */
SC_WEAPONPERFECTION, /* ウェポンパーフェクション */
SC_OVERTHRUST, /* オーバートラスト */
SC_MAXIMIZEPOWER, /* マキシマイズパワー */
- -1, -1, -1, -1, -1,
-/* 120- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 130- */
- -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 120-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 130-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_CLOAKING, /* クローキング */
SC_STAN, /* ソニックブロー */
- -1,
+ StatusChange::NEGATIVE1,
SC_ENCPOISON, /* エンチャントポイズン */
SC_POISONREACT, /* ポイズンリアクト */
-/* 140- */
+ // 140-
SC_POISON, /* ベノムダスト */
SC_SPLASHER, /* ベナムスプラッシャー */
- -1,
+ StatusChange::NEGATIVE1,
SC_TRICKDEAD, /* 死んだふり */
- -1, -1, -1, -1, -1, -1,
-/* 150- */
- -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 150-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_LOUD, /* ラウドボイス */
- -1,
+ StatusChange::NEGATIVE1,
SC_ENERGYCOAT, /* エナジーコート */
- -1, -1,
-/* 160- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 160-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 170-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_SELFDESTRUCTION,
- -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 180-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 190-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 200-
+ StatusChange::NEGATIVE1,
SC_KEEPING,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_BARRIER,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_HALLUCINATION,
- -1, -1,
-/* 210- */
- -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 210-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_STRIPWEAPON,
SC_STRIPSHIELD,
SC_STRIPARMOR,
SC_STRIPHELM,
- -1,
-/* 220- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 230- */
- -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ // 220-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 230-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_CP_WEAPON,
SC_CP_SHIELD,
SC_CP_ARMOR,
SC_CP_HELM,
- -1, -1,
-/* 240- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 240-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_AUTOGUARD,
-/* 250- */
- -1, -1,
+ // 250-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_REFLECTSHIELD,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_DEVOTION,
SC_PROVIDENCE,
SC_DEFENDER,
SC_SPEARSQUICKEN,
- -1,
-/* 260- */
- -1, -1, -1, -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ // 260-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_STEELBODY,
SC_BLADESTOP_WAIT,
-/* 270- */
+ // 270-
SC_EXPLOSIONSPIRITS,
SC_EXTREMITYFIST,
- -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_MAGICROD,
- -1, -1, -1,
-/* 280- */
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 280-
SC_FLAMELAUNCHER,
SC_FROSTWEAPON,
SC_LIGHTNINGLOADER,
SC_SEISMICWEAPON,
- -1,
+ StatusChange::NEGATIVE1,
SC_VOLCANO,
SC_DELUGE,
SC_VIOLENTGALE,
SC_LANDPROTECTOR,
- -1,
-/* 290- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 300- */
- -1, -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ // 290-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 300-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_LULLABY,
SC_RICHMANKIM,
SC_ETERNALCHAOS,
SC_DRUMBATTLE,
-/* 310- */
+ // 310-
SC_NIBELUNGEN,
SC_ROKISWEIL,
SC_INTOABYSS,
SC_SIEGFRIED,
- -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_DISSONANCE,
- -1,
+ StatusChange::NEGATIVE1,
SC_WHISTLE,
-/* 320- */
+ // 320-
SC_ASSNCROS,
SC_POEMBRAGI,
SC_APPLEIDUN,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_UGLYDANCE,
- -1,
+ StatusChange::NEGATIVE1,
SC_HUMMING,
SC_DONTFORGETME,
SC_FORTUNE,
-/* 330- */
+ // 330-
SC_SERVICE4U,
SC_SELFDESTRUCTION,
- -1, -1, -1, -1, -1, -1, -1, -1,
-/* 340- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 350- */
- -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 340-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 350-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_AURABLADE,
SC_PARRYING,
SC_CONCENTRATION,
SC_TENSIONRELAX,
SC_BERSERK,
-/* 360- */
+ // 360-
SC_BERSERK,
SC_ASSUMPTIO,
SC_BASILICA,
- -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_MAGICPOWER,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_GOSPEL,
-/* 370- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-/* 380- */
+ // 370-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 380-
SC_TRUESIGHT,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_WINDWALK,
SC_MELTDOWN,
- -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_CARTBOOST,
- -1,
+ StatusChange::NEGATIVE1,
SC_CHASEWALK,
-/* 390- */
+ // 390-
SC_REJECTSWORD,
- -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_MARIONETTE,
- -1,
+ StatusChange::NEGATIVE1,
SC_HEADCRUSH,
SC_JOINTBEAT,
-/* 400 */
- -1, -1,
+ // 400-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
SC_MINDBREAKER,
SC_MEMORIZE,
SC_FOGWALL,
SC_SPIDERWEB,
- -1, -1, -1, -1,
-/* 410- */
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ // 410-
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
+ StatusChange::NEGATIVE1,
};
-struct skill_name_db skill_names[] = {
+struct skill_name_db skill_names[] =
+{
{AC_CHARGEARROW, "CHARGEARROW", "Charge_Arrow"},
{AC_CONCENTRATION, "CONCENTRATION", "Improve_Concentration"},
{AC_DOUBLE, "DOUBLE", "Double_Strafe"},
@@ -711,7 +953,7 @@ struct skill_name_db skill_names[] = {
{WZ_STORMGUST, "STORMGUST", "Storm_Gust"},
{WZ_VERMILION, "VERMILION", "Lord_of_Vermilion"},
{WZ_WATERBALL, "WATERBALL", "Water_Ball"},
- {0, 0, 0}
+ {SkillID::ZERO, nullptr, nullptr}
};
static const int dirx[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
@@ -719,138 +961,146 @@ static const int diry[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
static int rdamage;
-/* スキルデータベース */
-struct skill_db skill_db[MAX_SKILL_DB];
+earray<struct skill_db, SkillID, MAX_SKILL_DB> skill_db;
#define UNARMED_PLAYER_DAMAGE_MIN(bl) (skill_power_bl((bl), TMW_BRAWLING) >> 4) // +50 for 200
#define UNARMED_PLAYER_DAMAGE_MAX(bl) (skill_power_bl((bl), TMW_BRAWLING)) // +200 for 200
-int skill_get_hit(int id)
+int skill_get_hit(SkillID id)
{
return skill_db[id].hit;
}
-int skill_get_inf(int id)
+int skill_get_inf(SkillID id)
{
return skill_db[id].inf;
}
-int skill_get_pl(int id)
+int skill_get_pl(SkillID id)
{
return skill_db[id].pl;
}
-int skill_get_nk(int id)
+int skill_get_nk(SkillID id)
{
return skill_db[id].nk;
}
-int skill_get_max(int id)
+int skill_get_max(SkillID id)
{
return skill_db[id].max;
}
-int skill_get_max_raise(int id)
+int skill_get_max_raise(SkillID id)
{
return skill_db[id].max_raise;
}
-int skill_get_range(int id, int lv)
+int skill_get_range(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].range[lv - 1];
}
-int skill_get_hp(int id, int lv)
+int skill_get_hp(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].hp[lv - 1];
}
-int skill_get_sp(int id, int lv)
+int skill_get_sp(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].sp[lv - 1];
}
-int skill_get_zeny(int id, int lv)
+int skill_get_zeny(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].zeny[lv - 1];
}
-int skill_get_num(int id, int lv)
+int skill_get_num(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].num[lv - 1];
}
-int skill_get_cast(int id, int lv)
+int skill_get_cast(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].cast[lv - 1];
}
-int skill_get_delay(int id, int lv)
+int skill_get_delay(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].delay[lv - 1];
}
-int skill_get_time(int id, int lv)
+int skill_get_time(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].upkeep_time[lv - 1];
}
-int skill_get_time2(int id, int lv)
+int skill_get_time2(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].upkeep_time2[lv - 1];
}
-int skill_get_castdef(int id)
+int skill_get_castdef(SkillID id)
{
return skill_db[id].cast_def_rate;
}
-int skill_get_weapontype(int id)
+int skill_get_weapontype(SkillID id)
{
return skill_db[id].weapon;
}
-int skill_get_inf2(int id)
+int skill_get_inf2(SkillID id)
{
return skill_db[id].inf2;
}
-int skill_get_maxcount(int id)
+int skill_get_maxcount(SkillID id)
{
return skill_db[id].maxcount;
}
-int skill_get_blewcount(int id, int lv)
+int skill_get_blewcount(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].blewcount[lv - 1];
}
-int skill_get_mhp(int id, int lv)
+int skill_get_mhp(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].mhp[lv - 1];
}
static
-int skill_get_castnodex(int id, int lv)
+int skill_get_castnodex(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].castnodex[lv - 1];
}
/* プロトタイプ */
+static
struct skill_unit_group *skill_unitsetting(struct block_list *src,
- int skillid, int skilllv, int x,
- int y, int flag);
+ SkillID skillid, int skilllv,
+ int x, int y, int flag);
+static
int skill_check_condition(struct map_session_data *sd, int type);
+static
void skill_frostjoke_scream(struct block_list *bl, va_list ap);
+static
void skill_status_change_timer_sub(struct block_list *bl, va_list ap);
+static
void skill_attack_area(struct block_list *bl, va_list ap);
+static
void skill_clear_element_field(struct block_list *bl);
+static
void skill_landprotector(struct block_list *bl, va_list ap);
+static
void skill_trap_splash(struct block_list *bl, va_list ap);
+static
void skill_count_target(struct block_list *bl, va_list ap);
// [MouseJstr] - skill ok to cast? and when?
-static int skillnotok(int skillid, struct map_session_data *sd)
+static int skillnotok(SkillID skillid, struct map_session_data *sd)
{
if (sd == 0)
return 0;
@@ -877,7 +1127,7 @@ static int distance(int x0, int y0, int x1, int y1)
}
/* スキルユニットIDを返す(これもデータベースに入れたいな) */
-int skill_get_unit_id(int id, int flag)
+int skill_get_unit_id(SkillID id, int flag)
{
switch (id)
@@ -1023,20 +1273,9 @@ int skill_get_unit_id(int id, int flag)
*------------------------------------------
*/
int skill_additional_effect(struct block_list *src, struct block_list *bl,
- int skillid, int skilllv, int attack_type,
+ SkillID skillid, int skilllv, int attack_type,
unsigned int tick)
{
- /* MOB追加効果スキル用 */
- const int sc[] = {
- SC_POISON, SC_BLIND, SC_SILENCE, SC_STAN,
- SC_STONE, SC_CURSE, SC_SLEEP
- };
- const int sc2[] = {
- MG_STONECURSE, MG_FROSTDIVER, NPC_STUNATTACK,
- NPC_SLEEPATTACK, TF_POISON, NPC_CURSEATTACK,
- NPC_SILENCEATTACK, 0, NPC_BLINDATTACK
- };
-
struct map_session_data *sd = NULL;
struct map_session_data *dstsd = NULL;
struct mob_data *md = NULL;
@@ -1104,7 +1343,7 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl,
switch (skillid)
{
- case 0: /* 通常攻撃 */
+ case SkillID::ZERO: /* 通常攻撃 */
/* 自動鷹 */
if (sd && pc_isfalcon(sd) && sd->status.weapon == 11
&& (skill = pc_checkskill(sd, HT_BLITZBEAT)) > 0
@@ -1183,7 +1422,7 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl,
case WZ_STORMGUST: /* ストームガスト */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
if (sc_data)
{
sc_data[SC_FREEZE].val3++;
@@ -1290,31 +1529,49 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl,
case NPC_PETRIFYATTACK:
if (MRAND(100) < sc_def_mdef)
- skill_status_change_start(bl, sc[skillid - NPC_POISON],
+ skill_status_change_start(bl, SC_STONE,
skilllv, 0, 0, 0,
skill_get_time2(skillid, skilllv),
0);
break;
case NPC_POISON:
+ if (MRAND(100) <
+ 50 - (sc_def_vit >> 2) - (sc_def_phys_shield_spell) +
+ (skilllv >> 2))
+ skill_status_change_start(bl, SC_POISON,
+ skilllv, 0, 0, 0, skilllv, 0);
+ break;
case NPC_SILENCEATTACK:
+ if (MRAND(100) <
+ 50 - (sc_def_vit >> 2) - (sc_def_phys_shield_spell) +
+ (skilllv >> 2))
+ skill_status_change_start(bl, SC_SILENCE,
+ skilllv, 0, 0, 0, skilllv, 0);
+ break;
case NPC_STUNATTACK:
if (MRAND(100) <
50 - (sc_def_vit >> 2) - (sc_def_phys_shield_spell) +
(skilllv >> 2))
- skill_status_change_start(bl, sc[skillid - NPC_POISON],
+ skill_status_change_start(bl, SC_STAN,
skilllv, 0, 0, 0, skilllv, 0);
break;
case NPC_CURSEATTACK:
if (MRAND(100) < sc_def_luk)
- skill_status_change_start(bl, sc[skillid - NPC_POISON],
+ skill_status_change_start(bl, SC_CURSE,
skilllv, 0, 0, 0,
skill_get_time2(skillid, skilllv),
0);
break;
case NPC_SLEEPATTACK:
+ if (MRAND(100) < sc_def_int)
+ skill_status_change_start(bl, SC_SLEEP,
+ skilllv, 0, 0, 0,
+ skill_get_time2(skillid, skilllv),
+ 0);
+ break;
case NPC_BLINDATTACK:
if (MRAND(100) < sc_def_int)
- skill_status_change_start(bl, sc[skillid - NPC_POISON],
+ skill_status_change_start(bl, SC_BLIND,
skilllv, 0, 0, 0,
skill_get_time2(skillid, skilllv),
0);
@@ -1418,107 +1675,78 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl,
break;
}
- if (sd && skillid != MC_CARTREVOLUTION && attack_type & BF_WEAPON)
- { /* カードによる追加効果 */
- int i;
- int sc_def_card = 100;
+ if (not (sd && skillid != MC_CARTREVOLUTION && attack_type & BF_WEAPON))
+ return 0;
+ earray<int, BadSC, BadSC::COUNT> arr_sc_def_card1 =
+ {
+ sc_def_mdef, // stone
+ sc_def_mdef, // freeze
+ sc_def_vit, // stan
+ sc_def_int, // sleep
+ sc_def_vit, // poison
+ sc_def_luk, // curse
+ sc_def_vit, // silence
+ sc_def_int, // confusion
+ sc_def_int, // blind
+ }, arr_sc_def_card2 =
+ {
+ sc_def_mdef2, // stone
+ sc_def_mdef2, // freeze
+ sc_def_vit2, // stan
+ sc_def_int2, // sleep
+ sc_def_vit2, // poison
+ sc_def_luk2, // curse
+ sc_def_vit2, // silence
+ sc_def_int2, // confusion
+ sc_def_int2, // blind
+ };
- for (i = SC_STONE; i <= SC_BLIND; i++)
+ earray<SkillID, BadSC, BadSC::COUNT> sc2 =
+ {
+ MG_STONECURSE, // stone
+ MG_FROSTDIVER, // freeze
+ NPC_STUNATTACK, // stan
+ NPC_SLEEPATTACK, // sleep
+ TF_POISON, // poison
+ NPC_CURSEATTACK, // curse
+ NPC_SILENCEATTACK, // silence
+ SkillID::ZERO, // confusion
+ NPC_BLINDATTACK, // blind
+ };
+
+ for (BadSC bi : erange(BadSC(), BadSC::COUNT))
+ {
+ StatusChange si = BadSC_to_SC(bi);
+ int sc_def_card1 = arr_sc_def_card1[bi];
+ int eff1 = sd->addeff[bi];
+ if (sd->state.arrow_atk)
+ eff1 += sd->arrow_addeff[bi];
+ if (MRAND(10000) < eff1 * sc_def_card1 / 100)
{
- //対象に状態異常
- if (i == SC_STONE || i == SC_FREEZE)
- sc_def_card = sc_def_mdef;
- else if (i == SC_STAN || i == SC_POISON || i == SC_SILENCE)
- sc_def_card = sc_def_vit;
- else if (i == SC_SLEEP || i == SC_CONFUSION || i == SC_BLIND)
- sc_def_card = sc_def_int;
- else if (i == SC_CURSE)
- sc_def_card = sc_def_luk;
+ if (battle_config.battle_log)
+ printf("PC %d skill_addeff: cardによる異常発動 %d %d\n",
+ sd->bl.id, uint16_t(si), eff1);
- if (!sd->state.arrow_atk)
- {
- if (MRAND(10000) <
- (sd->addeff[i - SC_STONE]) * sc_def_card / 100)
- {
- if (battle_config.battle_log)
- printf("PC %d skill_addeff: cardによる異常発動 %d %d\n",
- sd->bl.id, i, sd->addeff[i - SC_STONE]);
- skill_status_change_start(bl, i, 7, 0, 0, 0,
- (i ==
- SC_CONFUSION) ? 10000 +
- 7000 :
- skill_get_time2(sc2
- [i -
- SC_STONE],
- 7), 0);
- }
- }
- else
- {
- if (MRAND(10000) <
- (sd->addeff[i - SC_STONE] +
- sd->arrow_addeff[i - SC_STONE]) * sc_def_card / 100)
- {
- if (battle_config.battle_log)
- printf("PC %d skill_addeff: cardによる異常発動 %d %d\n",
- sd->bl.id, i, sd->addeff[i - SC_STONE]);
- skill_status_change_start(bl, i, 7, 0, 0, 0,
- (i ==
- SC_CONFUSION) ? 10000 +
- 7000 :
- skill_get_time2(sc2
- [i -
- SC_STONE],
- 7), 0);
- }
- }
- //自分に状態異常
- if (i == SC_STONE || i == SC_FREEZE)
- sc_def_card = sc_def_mdef2;
- else if (i == SC_STAN || i == SC_POISON || i == SC_SILENCE)
- sc_def_card = sc_def_vit2;
- else if (i == SC_SLEEP || i == SC_CONFUSION || i == SC_BLIND)
- sc_def_card = sc_def_int2;
- else if (i == SC_CURSE)
- sc_def_card = sc_def_luk2;
+ skill_status_change_start(bl, si, 7, 0, 0, 0,
+ (bi == BadSC::CONFUSION)
+ ? 10000 + 7000
+ : skill_get_time2(sc2[bi], 7),
+ 0);
+ }
- if (!sd->state.arrow_atk)
- {
- if (MRAND(10000) <
- (sd->addeff2[i - SC_STONE]) * sc_def_card / 100)
- {
- if (battle_config.battle_log)
- printf("PC %d skill_addeff: cardによる異常発動 %d %d\n",
- src->id, i, sd->addeff2[i - SC_STONE]);
- skill_status_change_start(src, i, 7, 0, 0, 0,
- (i ==
- SC_CONFUSION) ? 10000 +
- 7000 :
- skill_get_time2(sc2
- [i -
- SC_STONE],
- 7), 0);
- }
- }
- else
- {
- if (MRAND(10000) <
- (sd->addeff2[i - SC_STONE] +
- sd->arrow_addeff2[i - SC_STONE]) * sc_def_card / 100)
- {
- if (battle_config.battle_log)
- printf("PC %d skill_addeff: cardによる異常発動 %d %d\n",
- src->id, i, sd->addeff2[i - SC_STONE]);
- skill_status_change_start(src, i, 7, 0, 0, 0,
- (i ==
- SC_CONFUSION) ? 10000 +
- 7000 :
- skill_get_time2(sc2
- [i -
- SC_STONE],
- 7), 0);
- }
- }
+ int sc_def_card2 = arr_sc_def_card2[bi];
+ int eff2 = sd->addeff2[bi];
+
+ if (MRAND(10000) < eff2 * sc_def_card2 / 100)
+ {
+ if (battle_config.battle_log)
+ printf("PC %d skill_addeff: cardによる異常発動 %d %d\n",
+ src->id, uint16_t(si), eff2);
+ skill_status_change_start(src, si, 7, 0, 0, 0,
+ (bi == BadSC::CONFUSION)
+ ? 10000 + 7000
+ : skill_get_time2(sc2[bi], 7),
+ 0);
}
}
return 0;
@@ -1620,7 +1848,7 @@ int skill_blown(struct block_list *src, struct block_list *target, int count)
}
else
{
-// struct status_change *sc_data=battle_get_sc_data(target);
+// eptr<struct status_change, StatusChange> sc_data=battle_get_sc_data(target);
if (moveblock)
map_delblock(target);
target->x = nx;
@@ -1671,11 +1899,11 @@ int skill_blown(struct block_list *src, struct block_list *target, int count)
*/
int skill_attack(int attack_type, struct block_list *src,
- struct block_list *dsrc, struct block_list *bl, int skillid,
- int skilllv, unsigned int tick, int flag)
+ struct block_list *dsrc, struct block_list *bl,
+ SkillID skillid, int skilllv, unsigned int tick, int flag)
{
struct Damage dmg;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int type, lv, damage;
rdamage = 0;
@@ -1786,7 +2014,9 @@ int skill_attack(int attack_type, struct block_list *src,
if (pc_checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0) //猛龍拳(MO_COMBOFINISH)取得&気球保持時は+300ms
delay += 300 * battle_config.combo_delay_rate / 100; //追加ディレイをconfにより調整
- skill_status_change_start(src, SC_COMBO, MO_CHAINCOMBO, skilllv, 0, 0, delay, 0); //コンボ状態に
+ skill_status_change_start(src, SC_COMBO,
+ uint16_t(MO_CHAINCOMBO), skilllv,
+ 0, 0, delay, 0); //コンボ状態に
}
sd->attackabletime = sd->canmove_tick = tick + delay;
clif_combo_delay(src, delay); //コンボディレイパケットの送信
@@ -1810,7 +2040,9 @@ int skill_attack(int attack_type, struct block_list *src,
&& sd->spiritball > 1))
delay += 300 * battle_config.combo_delay_rate / 100; //追加ディレイをconfにより調整
- skill_status_change_start(src, SC_COMBO, MO_COMBOFINISH, skilllv, 0, 0, delay, 0); //コンボ状態に
+ skill_status_change_start(src, SC_COMBO,
+ uint16_t(MO_COMBOFINISH), skilllv,
+ 0, 0, delay, 0); //コンボ状態に
}
sd->attackabletime = sd->canmove_tick = tick + delay;
clif_combo_delay(src, delay); //コンボディレイパケットの送信
@@ -1826,7 +2058,9 @@ int skill_attack(int attack_type, struct block_list *src,
if (pc_checkskill(sd, CH_CHAINCRUSH) > 0) //連柱崩撃(CH_CHAINCRUSH)取得時は+300ms
delay += 300 * battle_config.combo_delay_rate / 100; //追加ディレイをconfにより調整
- skill_status_change_start(src, SC_COMBO, CH_TIGERFIST, skilllv, 0, 0, delay, 0); //コンボ状態に
+ skill_status_change_start(src, SC_COMBO,
+ uint16_t(CH_TIGERFIST), skilllv,
+ 0, 0, delay, 0); //コンボ状態に
}
sd->attackabletime = sd->canmove_tick = tick + delay;
clif_combo_delay(src, delay); //コンボディレイパケットの送信
@@ -1845,7 +2079,9 @@ int skill_attack(int attack_type, struct block_list *src,
&& sd->sc_data[SC_EXPLOSIONSPIRITS].timer != -1)
delay += 300 * battle_config.combo_delay_rate / 100; //追加ディレイをconfにより調整
- skill_status_change_start(src, SC_COMBO, CH_CHAINCRUSH, skilllv, 0, 0, delay, 0); //コンボ状態に
+ skill_status_change_start(src,
+ SC_COMBO, uint16_t(CH_CHAINCRUSH), skilllv,
+ 0, 0, delay, 0); //コンボ状態に
}
sd->attackabletime = sd->canmove_tick = tick + delay;
clif_combo_delay(src, delay); //コンボディレイパケットの送信
@@ -1928,7 +2164,7 @@ int skill_attack(int attack_type, struct block_list *src,
clif_skill_damage(dsrc, bl, tick, dmg.amotion, dmg.dmotion,
damage, dmg.div_, skillid,
(lv != 0) ? lv : skilllv,
- (skillid == 0) ? 5 : type);
+ (skillid == SkillID::ZERO) ? 5 : type);
}
if (dmg.blewcount > 0)
{ /* 吹き飛ばし処理とそのパケット */
@@ -1998,11 +2234,11 @@ int skill_attack(int attack_type, struct block_list *src,
target = md->target_id;
if (src->type == BL_PC)
md->target_id = src->id;
- mobskill_use(md, tick, MSC_SKILLUSED | (skillid << 16));
+ mobskill_use(md, tick, MSC_SKILLUSED, skillid);
md->target_id = target;
}
else
- mobskill_use(md, tick, MSC_SKILLUSED | (skillid << 16));
+ mobskill_use(md, tick, MSC_SKILLUSED, skillid);
}
}
}
@@ -2098,7 +2334,7 @@ void skill_check_unit_range_sub(struct block_list *bl, va_list ap)
struct skill_unit *unit;
int *c, x, y, range, sx[4], sy[4];
int t_range, tx[4], ty[4];
- int i, r_flag, skillid;
+ int i, r_flag;
nullpo_retv(bl);
nullpo_retv(ap);
@@ -2114,7 +2350,7 @@ void skill_check_unit_range_sub(struct block_list *bl, va_list ap)
x = va_arg(ap, int);
y = va_arg(ap, int);
range = va_arg(ap, int);
- skillid = va_arg(ap, int);
+ SkillID skillid = va_arg(ap, SkillID);
if (skillid == MG_SAFETYWALL || skillid == AL_PNEUMA)
{
@@ -2169,7 +2405,7 @@ void skill_check_unit_range_sub(struct block_list *bl, va_list ap)
(*c)++;
}
-int skill_check_unit_range(int m, int x, int y, int range, int skillid)
+int skill_check_unit_range(int m, int x, int y, int range, SkillID skillid)
{
int c = 0;
@@ -2392,7 +2628,8 @@ static void skill_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
*------------------------------------------
*/
int skill_addtimerskill(struct block_list *src, unsigned int tick,
- int target, int x, int y, int skill_id, int skill_lv,
+ int target, int x, int y,
+ SkillID skill_id, int skill_lv,
int type, int flag)
{
int i;
@@ -2503,8 +2740,8 @@ int skill_cleartimerskill(struct block_list *src)
*------------------------------------------
*/
int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
- int skillid, int skilllv, unsigned int tick,
- int flag)
+ SkillID skillid, int skilllv,
+ unsigned int tick, int flag)
{
struct map_session_data *sd = NULL;
@@ -2593,7 +2830,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
break;
case MO_INVESTIGATE: /* 発勁 */
{
- struct status_change *sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick,
flag);
if (sc_data[SC_BLADESTOP].timer != -1)
@@ -2628,7 +2865,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
if ((dist > 0 && !map_check_dir(dir, t_dir))
|| bl->type == BL_SKILL)
{
- struct status_change *sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
if (sc_data && sc_data[SC_HIDING].timer != -1)
skill_status_change_end(src, SC_HIDING, -1); // ハイディング解除
skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick,
@@ -2650,7 +2887,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
break;
case MO_FINGEROFFENSIVE: /* 指弾 */
{
- struct status_change *sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
if (!battle_config.finger_offensive_type)
skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick,
@@ -2674,7 +2911,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
break;
case MO_CHAINCOMBO: /* 連打掌 */
{
- struct status_change *sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick,
flag);
if (sc_data && sc_data[SC_BLADESTOP].timer != -1)
@@ -2690,7 +2927,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
break;
case MO_EXTREMITYFIST: /* 阿修羅覇鳳拳 */
{
- struct status_change *sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
if (sd)
{
@@ -3099,7 +3336,7 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
}
}
break;
- case 0:
+ case SkillID::ZERO:
if (sd)
{
if (flag & 3)
@@ -3136,8 +3373,8 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
*------------------------------------------
*/
int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
- int skillid, int skilllv, unsigned int tick,
- int flag)
+ SkillID skillid, int skilllv,
+ unsigned int tick, int flag)
{
struct map_session_data *sd = NULL;
struct map_session_data *dstsd = NULL;
@@ -3362,7 +3599,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case PR_LEXDIVINA: /* レックスディビーナ */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (bl->type == BL_PC
&& ((struct map_session_data *) bl)->
@@ -3632,7 +3869,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case SM_PROVOKE: /* プロボック */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
/* MVPmobと不死には効かない */
if ((bl->type == BL_MOB && battle_get_mode(bl) & 0x20) || battle_check_undead(battle_get_race(bl), battle_get_elem_type(bl))) //不死には効かない
@@ -3963,8 +4200,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case CR_DEFENDER: /* ディフェンダー */
case CR_AUTOGUARD: /* オートガード */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
- int sc = SkillStatusChangeTable[skillid];
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
+ StatusChange sc = SkillStatusChangeTable[skillid];
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (tsc_data)
{
@@ -3982,8 +4219,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case TF_HIDING: /* ハイディング */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
- int sc = SkillStatusChangeTable[skillid];
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
+ StatusChange sc = SkillStatusChangeTable[skillid];
clif_skill_nodamage(src, bl, skillid, -1, 1);
if (tsc_data)
{
@@ -4001,8 +4238,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case AS_CLOAKING: /* クローキング */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
- int sc = SkillStatusChangeTable[skillid];
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
+ StatusChange sc = SkillStatusChangeTable[skillid];
clif_skill_nodamage(src, bl, skillid, -1, 1);
if (tsc_data)
{
@@ -4022,8 +4259,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case ST_CHASEWALK: /* ハイディング */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
- int sc = SkillStatusChangeTable[skillid];
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
+ StatusChange sc = SkillStatusChangeTable[skillid];
clif_skill_nodamage(src, bl, skillid, -1, 1);
if (tsc_data)
{
@@ -4072,7 +4309,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case BD_ADAPTATION: /* アドリブ */
{
- struct status_change *sc_data = battle_get_sc_data(src);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(src);
if (sc_data && sc_data[SC_DANCING].timer != -1)
{
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
@@ -4288,7 +4525,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case RG_STRIPWEAPON: /* ストリップウェポン */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
if (tsc_data && tsc_data[SC_CP_WEAPON].timer != -1)
break;
@@ -4318,7 +4555,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case RG_STRIPSHIELD: /* ストリップシールド */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
if (tsc_data && tsc_data[SC_CP_SHIELD].timer != -1)
break;
@@ -4348,7 +4585,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case RG_STRIPARMOR: /* ストリップアーマー */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
if (tsc_data && tsc_data[SC_CP_ARMOR].timer != -1)
break;
@@ -4377,7 +4614,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case RG_STRIPHELM: /* ストリップヘルム */
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
if (tsc_data && tsc_data[SC_CP_HELM].timer != -1)
break;
@@ -4515,7 +4752,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case AM_CP_WEAPON:
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (tsc_data && tsc_data[SC_STRIPWEAPON].timer != -1)
skill_status_change_end(bl, SC_STRIPWEAPON, -1);
@@ -4526,7 +4763,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case AM_CP_SHIELD:
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (tsc_data && tsc_data[SC_STRIPSHIELD].timer != -1)
skill_status_change_end(bl, SC_STRIPSHIELD, -1);
@@ -4537,7 +4774,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case AM_CP_ARMOR:
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (tsc_data && tsc_data[SC_STRIPARMOR].timer != -1)
skill_status_change_end(bl, SC_STRIPARMOR, -1);
@@ -4548,7 +4785,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case AM_CP_HELM:
{
- struct status_change *tsc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> tsc_data = battle_get_sc_data(bl);
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (tsc_data && tsc_data[SC_STRIPHELM].timer != -1)
skill_status_change_end(bl, SC_STRIPHELM, -1);
@@ -4559,13 +4796,13 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case SA_DISPELL: /* ディスペル */
{
- int i;
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
if (bl->type == BL_PC
&& ((struct map_session_data *) bl)->
special_state.no_magic_damage)
break;
- for (i = 0; i < 136; i++)
+ // up to SC_BLIND, exclusive. WTF?
+ for (StatusChange i : erange(StatusChange(0), StatusChange(136)))
{
if (i == SC_RIDING || i == SC_FALCON || i == SC_HALLUCINATION
|| i == SC_WEIGHT50 || i == SC_WEIGHT90
@@ -4605,7 +4842,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
break;
case SA_SPELLBREAKER: // スペルブレイカー
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
int sp;
if (sc_data && sc_data[SC_MAGICROD].timer != -1)
{
@@ -4638,7 +4875,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
}
else
{
- int bl_skillid = 0, bl_skilllv = 0;
+ SkillID bl_skillid = SkillID::ZERO;
+ int bl_skilllv = 0;
if (bl->type == BL_PC)
{
if (dstsd && dstsd->skilltimer != -1)
@@ -4655,7 +4893,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
bl_skilllv = dstmd->skilllv;
}
}
- if (bl_skillid > 0
+ if (bl_skillid != SkillID::ZERO
+ && bl_skillid != SkillID::NEGATIVE
&& skill_db[bl_skillid].skill_type == BF_MAGIC)
{
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
@@ -4702,9 +4941,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
clif_autospell(sd, skilllv);
else
{
- int maxlv = 1, spellid = 0;
- static const int spellarray[3] =
- { MG_COLDBOLT, MG_FIREBOLT, MG_LIGHTNINGBOLT };
+ int maxlv = 1;
+ SkillID spellid = SkillID::ZERO;
+ static const SkillID spellarray[3] =
+ {
+ MG_COLDBOLT, MG_FIREBOLT, MG_LIGHTNINGBOLT,
+ };
if (skilllv >= 10)
{
spellid = MG_FROSTDIVER;
@@ -4731,9 +4973,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
spellid = MG_NAPALMBEAT;
maxlv = 3;
}
- if (spellid > 0)
+ if (spellid != SkillID::ZERO)
skill_status_change_start(src, SC_AUTOSPELL, skilllv,
- spellid, maxlv, 0,
+ uint16_t(spellid), maxlv, 0,
skill_get_time(SA_AUTOSPELL,
skilllv), 0);
}
@@ -4808,7 +5050,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
case NPC_SELFDESTRUCTION: /* 自爆 */
case NPC_SELFDESTRUCTION2: /* 自爆2 */
skill_status_change_start(bl, SkillStatusChangeTable[skillid],
- skilllv, skillid, 0, 0,
+ skilllv, uint16_t(skillid), 0, 0,
skill_get_time(skillid, skilllv), 0);
break;
case NPC_LICK:
@@ -5035,12 +5277,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
return 1;
clif_skill_nodamage(src, bl, skillid, skilllv, 1);
skill_status_change_start(bl, SkillStatusChangeTable[skillid],
- skilllv, skillid, src->id, 0,
+ skilllv, uint16_t(skillid), src->id, 0,
skill_get_time(skillid, skilllv), 0);
break;
case PF_MINDBREAKER: /* プロボック */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
/* MVPmobと不死には効かない */
if ((bl->type == BL_MOB && battle_get_mode(bl) & 0x20) || battle_check_undead(battle_get_race(bl), battle_get_elem_type(bl))) //不死には効かない
@@ -5098,7 +5340,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
}
break;
default:
- printf("Unknown skill used:%d\n", skillid);
+ printf("Unknown skill used:%d\n", uint16_t(skillid));
map_freeblock_unlock();
return 1;
}
@@ -5138,20 +5380,22 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
{
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
if (sd->bl.m != bl->m || pc_isdead(sd))
{ //マップが違うか自分が死んでいる
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
if (sd->skillid == PR_LEXAETERNA)
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
if (sc_data
&& (sc_data[SC_FREEZE].timer != -1
|| (sc_data[SC_STONE].timer != -1
@@ -5160,7 +5404,8 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -5174,7 +5419,8 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -5185,7 +5431,8 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
{
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
if (inf2 & 0xC00 && sd->bl.id != bl->id)
@@ -5198,7 +5445,8 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -5208,23 +5456,25 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
range = battle_get_range(&sd->bl) - (range + 1);
range += battle_config.pc_skill_add_range;
if ((sd->skillid == MO_EXTREMITYFIST && sd->sc_data[SC_COMBO].timer != -1
- && sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH)
+ && SkillID(sd->sc_data[SC_COMBO].val1) == MO_COMBOFINISH)
|| (sd->skillid == CH_TIGERFIST && sd->sc_data[SC_COMBO].timer != -1
- && sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH)
+ && SkillID(sd->sc_data[SC_COMBO].val1) == MO_COMBOFINISH)
|| (sd->skillid == CH_CHAINCRUSH && sd->sc_data[SC_COMBO].timer != -1
- && sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH)
+ && SkillID(sd->sc_data[SC_COMBO].val1) == MO_COMBOFINISH)
|| (sd->skillid == CH_CHAINCRUSH && sd->sc_data[SC_COMBO].timer != -1
- && sd->sc_data[SC_COMBO].val1 == CH_TIGERFIST))
+ && SkillID(sd->sc_data[SC_COMBO].val1) == CH_TIGERFIST))
range +=
skill_get_blewcount(MO_COMBOFINISH, sd->sc_data[SC_COMBO].val2);
if (battle_config.skill_out_range_consume)
- { // changed to allow casting when target walks out of range [Valaris]
+ {
+ // changed to allow casting when target walks out of range [Valaris]
if (range < distance(sd->bl.x, sd->bl.y, bl->x, bl->y))
{
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -5232,10 +5482,12 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
{ /* 使用条件チェック */
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
if (battle_config.skill_out_range_consume)
{
if (range < distance(sd->bl.x, sd->bl.y, bl->x, bl->y))
@@ -5248,7 +5500,8 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
}
if (battle_config.pc_skill_log)
- printf("PC %d skill castend skill=%d\n", sd->bl.id, sd->skillid);
+ printf("PC %d skill castend skill=%d\n",
+ sd->bl.id, uint16_t(sd->skillid));
pc_stop_walking(sd, 0);
switch (skill_get_nk(sd->skillid))
@@ -5278,8 +5531,8 @@ void skill_castend_id(timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
* スキル使用(詠唱完了、場所指定の実際の処理)
*------------------------------------------
*/
-int skill_castend_pos2(struct block_list *src, int x, int y, int skillid,
- int skilllv, unsigned int tick, int flag)
+int skill_castend_pos2(struct block_list *src, int x, int y,
+ SkillID skillid, int skilllv, unsigned int tick, int flag)
{
struct map_session_data *sd = NULL;
int i, tmpx = 0, tmpy = 0, x1 = 0, y1 = 0;
@@ -5499,7 +5752,7 @@ int skill_castend_pos2(struct block_list *src, int x, int y, int skillid,
* スキル使用(詠唱完了、map指定)
*------------------------------------------
*/
-int skill_castend_map(struct map_session_data *sd, int skill_num,
+int skill_castend_map(struct map_session_data *sd, SkillID skill_num,
const char *mapname)
{
int x = 0, y = 0;
@@ -5510,17 +5763,14 @@ int skill_castend_map(struct map_session_data *sd, int skill_num,
if (sd->opt1 > 0 || sd->status.option & 2)
return 0;
- //スキルが使えない状態異常中
- if (sd->sc_data)
- {
- if (sd->sc_data[SC_DIVINA].timer != -1 ||
- sd->sc_data[SC_ROKISWEIL].timer != -1 ||
- sd->sc_data[SC_AUTOCOUNTER].timer != -1 ||
- sd->sc_data[SC_STEELBODY].timer != -1 ||
- sd->sc_data[SC_DANCING].timer != -1 ||
- sd->sc_data[SC_BERSERK].timer != -1)
- return 0;
- }
+
+ if (sd->sc_data[SC_DIVINA].timer != -1
+ || sd->sc_data[SC_ROKISWEIL].timer != -1
+ || sd->sc_data[SC_AUTOCOUNTER].timer != -1
+ || sd->sc_data[SC_STEELBODY].timer != -1
+ || sd->sc_data[SC_DANCING].timer != -1
+ || sd->sc_data[SC_BERSERK].timer != -1)
+ return 0;
if (skill_num != sd->skillid) /* 不正パケットらしい */
return 0;
@@ -5528,8 +5778,8 @@ int skill_castend_map(struct map_session_data *sd, int skill_num,
pc_stopattack(sd);
if (battle_config.pc_skill_log)
- printf("PC %d skill castend skill =%d map=%s\n", sd->bl.id,
- skill_num, mapname);
+ printf("PC %d skill castend skill =%d map=%s\n",
+ sd->bl.id, uint16_t(skill_num), mapname);
pc_stop_walking(sd, 0);
if (strcmp(mapname, "cancel") == 0)
@@ -5570,7 +5820,8 @@ int skill_castend_map(struct map_session_data *sd, int skill_num,
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = gettick();
sd->canmove_tick = gettick();
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return 0;
}
}
@@ -5608,8 +5859,8 @@ int skill_castend_map(struct map_session_data *sd, int skill_num,
*------------------------------------------
*/
struct skill_unit_group *skill_unitsetting(struct block_list *src,
- int skillid, int skilllv, int x,
- int y, int flag)
+ SkillID skillid, int skilllv,
+ int x, int y, int flag)
{
struct skill_unit_group *group;
int i, count = 1, limit_ = 10000, val1_ = 0, val2_ = 0;
@@ -6311,8 +6562,8 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0x85: /* ニューマ */
{
struct skill_unit *unit2;
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type = SC_PNEUMA;
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type = SC_PNEUMA;
if (sc_data && sc_data[type].timer == -1)
skill_status_change_start(bl, type, sg->skill_lv, (int) src,
0, 0, 0, 0);
@@ -6329,8 +6580,8 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0x7e: /* セイフティウォール */
{
struct skill_unit *unit2;
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type = SC_SAFETYWALL;
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type = SC_SAFETYWALL;
if (sc_data && sc_data[type].timer == -1)
skill_status_change_start(bl, type, sg->skill_lv, (int) src,
0, 0, 0, 0);
@@ -6410,7 +6661,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0x91: /* アンクルスネア */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
if (sg->val2 == 0 && sc_data && sc_data[SC_ANKLE].timer == -1)
{
int moveblock = (bl->x / BLOCK_SIZE != src->bl.x / BLOCK_SIZE
@@ -6479,7 +6730,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0x8e: /* クァグマイア */
{
- int type = SkillStatusChangeTable[sg->skill_id];
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (bl->type == BL_PC
&& ((struct map_session_data *) bl)->
special_state.no_magic_damage)
@@ -6493,8 +6744,8 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
break;
case 0x92: /* ベノムダスト */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type = SkillStatusChangeTable[sg->skill_id];
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (sc_data && sc_data[type].timer == -1)
skill_status_change_start(bl, type, sg->skill_lv, (int) src,
0, 0,
@@ -6507,8 +6758,8 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0x9c: /* バイオレントゲイル */
{
struct skill_unit *unit2;
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type = SkillStatusChangeTable[sg->skill_id];
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (sc_data && sc_data[type].timer == -1)
skill_status_change_start(bl, type, sg->skill_lv, (int) src,
0, 0,
@@ -6547,8 +6798,8 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0xb4:
{
struct skill_unit *unit2;
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type = SkillStatusChangeTable[sg->skill_id];
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (sg->src_id == bl->id)
break;
if (sc_data && sc_data[type].timer == -1)
@@ -6573,8 +6824,8 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
case 0xaa: /* イドゥンの林檎 */
{
struct skill_unit *unit2;
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type = SkillStatusChangeTable[sg->skill_id];
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (sg->src_id == bl->id)
break;
if (sc_data && sc_data[type].timer == -1)
@@ -6662,12 +6913,12 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
if (ss->type == BL_PC)
((struct mob_data *) bl)->target_id = ss->id;
mobskill_use((struct mob_data *) bl, tick,
- MSC_SKILLUSED | (sg->skill_id << 16));
+ MSC_SKILLUSED, sg->skill_id);
((struct mob_data *) bl)->target_id = target;
}
else
mobskill_use((struct mob_data *) bl, tick,
- MSC_SKILLUSED | (sg->skill_id << 16));
+ MSC_SKILLUSED, sg->skill_id);
}
return 0;
@@ -6699,8 +6950,8 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl,
case 0x85: /* ニューマ */
case 0x8e: /* クァグマイア */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
- int type =
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
+ StatusChange type =
(sg->unit_id == 0x85) ? SC_PNEUMA :
((sg->unit_id == 0x7e) ? SC_SAFETYWALL : SC_QUAGMIRE);
if ((type != SC_QUAGMIRE || bl->type != BL_MOB) &&
@@ -6742,9 +6993,9 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl,
case 0x9b: /* デリュージ */
case 0x9c: /* バイオレントゲイル */
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
struct skill_unit *su;
- int type = SkillStatusChangeTable[sg->skill_id];
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (sc_data && sc_data[type].timer != -1
&& (su = ((struct skill_unit *) sc_data[type].val2))
&& su == src)
@@ -6774,9 +7025,9 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl,
case 0xaf: /* サービスフォーユー */
case 0xb4:
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
struct skill_unit *su;
- int type = SkillStatusChangeTable[sg->skill_id];
+ StatusChange type = SkillStatusChangeTable[sg->skill_id];
if (sc_data && sc_data[type].timer != -1
&& (su = ((struct skill_unit *) sc_data[type].val4))
&& su == src)
@@ -6968,7 +7219,8 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
{
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
@@ -7005,7 +7257,8 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -7041,7 +7294,8 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -7064,7 +7318,8 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -7081,7 +7336,8 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
clif_skill_fail(sd, sd->skillid, 0, 0);
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
}
@@ -7089,10 +7345,12 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
{ /* 使用条件チェック */
sd->canact_tick = tick;
sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return;
}
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
if (battle_config.skill_out_range_consume)
{
if (range < distance(sd->bl.x, sd->bl.y, sd->skillx, sd->skilly))
@@ -7105,7 +7363,8 @@ void skill_castend_pos(timer_id tid, tick_t tick, custom_id_t id, custom_data_t
}
if (battle_config.pc_skill_log)
- printf("PC %d skill castend skill=%d\n", sd->bl.id, sd->skillid);
+ printf("PC %d skill castend skill=%d\n",
+ sd->bl.id, uint16_t(sd->skillid));
pc_stop_walking(sd, 0);
skill_castend_pos2(&sd->bl, sd->skillx, sd->skilly, sd->skillid,
@@ -7197,7 +7456,7 @@ void skill_check_condition_use_sub(struct block_list *bl, va_list ap)
struct map_session_data *ssd;
struct pc_base_job s_class;
struct pc_base_job ss_class;
- int skillid, skilllv;
+ int skilllv;
nullpo_retv(bl);
nullpo_retv(ap);
@@ -7216,7 +7475,7 @@ void skill_check_condition_use_sub(struct block_list *bl, va_list ap)
}
ss_class = pc_calc_base_job(ssd->status.pc_class);
- skillid = ssd->skillid;
+ SkillID skillid = ssd->skillid;
skilllv = ssd->skilllv;
switch (skillid)
{
@@ -7259,7 +7518,7 @@ void skill_check_condition_use_sub(struct block_list *bl, va_list ap)
{
ssd->sc_data[SC_DANCING].val4 = bl->id;
clif_skill_nodamage(bl, src, skillid, skilllv, 1);
- skill_status_change_start(bl, SC_DANCING, skillid,
+ skill_status_change_start(bl, SC_DANCING, uint16_t(skillid),
ssd->sc_data[SC_DANCING].val2, 0,
src->id, skill_get_time(skillid,
skilllv) +
@@ -7303,7 +7562,7 @@ void skill_check_condition_mob_master_sub(struct block_list *bl, va_list ap)
*/
int skill_check_condition(struct map_session_data *sd, int type)
{
- int hp, sp, hp_rate, sp_rate, zeny, weapon, state, spiritball, skill,
+ int hp, sp, hp_rate, sp_rate, zeny, weapon, spiritball,
lv, mhp;
int index[10], itemid[10], amount[10];
@@ -7312,26 +7571,30 @@ int skill_check_condition(struct map_session_data *sd, int type)
if (battle_config.gm_skilluncond > 0
&& pc_isGM(sd) >= battle_config.gm_skilluncond)
{
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return 1;
}
if (sd->opt1 > 0)
{
clif_skill_fail(sd, sd->skillid, 0, 0);
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return 0;
}
if (pc_is90overweight(sd))
{
clif_skill_fail(sd, sd->skillid, 9, 0);
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return 0;
}
if (sd->skillid == AC_MAKINGARROW && sd->state.make_arrow_flag == 1)
{
- sd->skillitem = sd->skillitemlv = -1;
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
return 0;
}
/*if (sd->skillid == AM_PHARMACY && sd->state.produce_flag == 1) {
@@ -7342,7 +7605,10 @@ int skill_check_condition(struct map_session_data *sd, int type)
if (sd->skillitem == sd->skillid)
{ /* アイテムの場合無条件成功 */
if (type & 1)
- sd->skillitem = sd->skillitemlv = -1;
+ {
+ sd->skillitem = SkillID::NEGATIVE;
+ sd->skillitemlv = -1;
+ }
return 1;
}
if (sd->opt1 > 0)
@@ -7350,20 +7616,17 @@ int skill_check_condition(struct map_session_data *sd, int type)
clif_skill_fail(sd, sd->skillid, 0, 0);
return 0;
}
- if (sd->sc_data)
+ if (sd->sc_data[SC_DIVINA].timer != -1 ||
+ sd->sc_data[SC_ROKISWEIL].timer != -1 ||
+ (sd->sc_data[SC_AUTOCOUNTER].timer != -1
+ && sd->skillid != KN_AUTOCOUNTER)
+ || sd->sc_data[SC_STEELBODY].timer != -1
+ || sd->sc_data[SC_BERSERK].timer != -1)
{
- if (sd->sc_data[SC_DIVINA].timer != -1 ||
- sd->sc_data[SC_ROKISWEIL].timer != -1 ||
- (sd->sc_data[SC_AUTOCOUNTER].timer != -1
- && sd->skillid != KN_AUTOCOUNTER)
- || sd->sc_data[SC_STEELBODY].timer != -1
- || sd->sc_data[SC_BERSERK].timer != -1)
- {
- clif_skill_fail(sd, sd->skillid, 0, 0);
- return 0; /* 状態異常や沈黙など */
- }
+ clif_skill_fail(sd, sd->skillid, 0, 0);
+ return 0; /* 状態異常や沈黙など */
}
- skill = sd->skillid;
+ SkillID skill = sd->skillid;
lv = sd->skilllv;
hp = skill_get_hp(skill, lv); /* 消費HP */
sp = skill_get_sp(skill, lv); /* 消費SP */
@@ -7373,7 +7636,7 @@ int skill_check_condition(struct map_session_data *sd, int type)
sp_rate = (lv <= 0) ? 0 : skill_db[skill].sp_rate[lv - 1];
zeny = skill_get_zeny(skill, lv);
weapon = skill_db[skill].weapon;
- state = skill_db[skill].state;
+ SkillState state = skill_db[skill].state;
spiritball = (lv <= 0) ? 0 : skill_db[skill].spiritball[lv - 1];
mhp = skill_get_mhp(skill, lv); /* 消費HP */
for (int i = 0; i < 10; i++)
@@ -7448,31 +7711,31 @@ int skill_check_condition(struct map_session_data *sd, int type)
if (sd->sc_data[SC_BLADESTOP].timer == -1)
{
if (sd->sc_data[SC_COMBO].timer == -1
- || sd->sc_data[SC_COMBO].val1 != MO_TRIPLEATTACK)
+ || SkillID(sd->sc_data[SC_COMBO].val1) != MO_TRIPLEATTACK)
return 0;
}
break;
case MO_COMBOFINISH: //猛龍拳
if (sd->sc_data[SC_COMBO].timer == -1
- || sd->sc_data[SC_COMBO].val1 != MO_CHAINCOMBO)
+ || SkillID(sd->sc_data[SC_COMBO].val1) != MO_CHAINCOMBO)
return 0;
break;
case CH_TIGERFIST: //伏虎拳
if (sd->sc_data[SC_COMBO].timer == -1
- || sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH)
+ || SkillID(sd->sc_data[SC_COMBO].val1) != MO_COMBOFINISH)
return 0;
break;
case CH_CHAINCRUSH: //連柱崩撃
if (sd->sc_data[SC_COMBO].timer == -1)
return 0;
- if (sd->sc_data[SC_COMBO].val1 != MO_COMBOFINISH
- && sd->sc_data[SC_COMBO].val1 != CH_TIGERFIST)
+ if (SkillID(sd->sc_data[SC_COMBO].val1) != MO_COMBOFINISH
+ && SkillID(sd->sc_data[SC_COMBO].val1) != CH_TIGERFIST)
return 0;
break;
case MO_EXTREMITYFIST: // 阿修羅覇鳳拳
if ((sd->sc_data[SC_COMBO].timer != -1
- && (sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH
- || sd->sc_data[SC_COMBO].val1 == CH_CHAINCRUSH))
+ && (SkillID(sd->sc_data[SC_COMBO].val1) == MO_COMBOFINISH
+ || SkillID(sd->sc_data[SC_COMBO].val1) == CH_CHAINCRUSH))
|| sd->sc_data[SC_BLADESTOP].timer != -1)
spiritball--;
break;
@@ -7484,7 +7747,7 @@ int skill_check_condition(struct map_session_data *sd, int type)
((group =
(struct skill_unit_group *) sd->sc_data[SC_DANCING].val2)
&&
- (skill_get_time(sd->sc_data[SC_DANCING].val1,
+ (skill_get_time(SkillID(sd->sc_data[SC_DANCING].val1),
group->skill_lv) - sd->sc_data[SC_DANCING].val3 * 1000) <=
skill_get_time2(skill, lv)))
{ //ダンス中で使用後5秒以上のみ?
@@ -7763,10 +8026,11 @@ int skill_castfix(struct block_list *bl, int time)
{
struct map_session_data *sd;
struct mob_data *md; // [Valaris]
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int dex;
int castrate = 100;
- int skill, lv, castnodex;
+ SkillID skill;
+ int lv, castnodex;
nullpo_retr(0, bl);
@@ -7787,7 +8051,7 @@ int skill_castfix(struct block_list *bl, int time)
sc_data = battle_get_sc_data(bl);
dex = battle_get_dex(bl);
- if (skill > MAX_SKILL_DB || skill < 0)
+ if (skill > MAX_SKILL_DB || skill < SkillID::ZERO)
return 0;
castnodex = skill_get_castnodex(skill, lv);
@@ -7829,7 +8093,7 @@ int skill_castfix(struct block_list *bl, int time)
*/
int skill_delayfix(struct block_list *bl, int time)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
@@ -7863,14 +8127,14 @@ int skill_delayfix(struct block_list *bl, int time)
*------------------------------------------
*/
int skill_use_id(struct map_session_data *sd, int target_id,
- int skill_num, int skill_lv)
+ SkillID skill_num, int skill_lv)
{
unsigned int tick;
int casttime = 0, delay = 0, skill, range_;
struct map_session_data *target_sd = NULL;
int forcecast = 0;
struct block_list *bl;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
tick = gettick();
nullpo_retr(0, sd);
@@ -7898,50 +8162,48 @@ int skill_use_id(struct map_session_data *sd, int target_id,
/* 沈黙や異常(ただし、グリムなどの判定をする) */
if (sd->opt1 > 0)
return 0;
- if (sd->sc_data)
+
+ if (sc_data[SC_CHASEWALK].timer != -1)
+ return 0;
+ if (sc_data[SC_VOLCANO].timer != -1)
{
- if (sc_data[SC_CHASEWALK].timer != -1)
+ if (skill_num == WZ_ICEWALL)
return 0;
- if (sc_data[SC_VOLCANO].timer != -1)
- {
- if (skill_num == WZ_ICEWALL)
- return 0;
- }
- if (sc_data[SC_ROKISWEIL].timer != -1)
- {
- if (skill_num == BD_ADAPTATION)
- return 0;
- }
- if (sd->sc_data[SC_DIVINA].timer != -1 ||
- sd->sc_data[SC_ROKISWEIL].timer != -1 ||
- (sd->sc_data[SC_AUTOCOUNTER].timer != -1
- && sd->skillid != KN_AUTOCOUNTER)
- || sd->sc_data[SC_STEELBODY].timer != -1
- || sd->sc_data[SC_BERSERK].timer != -1)
- {
- return 0; /* 状態異常や沈黙など */
- }
+ }
+ if (sc_data[SC_ROKISWEIL].timer != -1)
+ {
+ if (skill_num == BD_ADAPTATION)
+ return 0;
+ }
+ if (sd->sc_data[SC_DIVINA].timer != -1 ||
+ sd->sc_data[SC_ROKISWEIL].timer != -1 ||
+ (sd->sc_data[SC_AUTOCOUNTER].timer != -1
+ && sd->skillid != KN_AUTOCOUNTER)
+ || sd->sc_data[SC_STEELBODY].timer != -1
+ || sd->sc_data[SC_BERSERK].timer != -1)
+ {
+ return 0; /* 状態異常や沈黙など */
+ }
- if (sc_data[SC_BLADESTOP].timer != -1)
- {
- int lv = sc_data[SC_BLADESTOP].val1;
- if (sc_data[SC_BLADESTOP].val2 == 1)
- return 0; //白羽された側なのでダメ
- if (lv == 1)
- return 0;
- if (lv == 2 && skill_num != MO_FINGEROFFENSIVE)
- return 0;
- if (lv == 3 && skill_num != MO_FINGEROFFENSIVE
- && skill_num != MO_INVESTIGATE)
- return 0;
- if (lv == 4 && skill_num != MO_FINGEROFFENSIVE
- && skill_num != MO_INVESTIGATE && skill_num != MO_CHAINCOMBO)
- return 0;
- if (lv == 5 && skill_num != MO_FINGEROFFENSIVE
- && skill_num != MO_INVESTIGATE && skill_num != MO_CHAINCOMBO
- && skill_num != MO_EXTREMITYFIST)
- return 0;
- }
+ if (sc_data[SC_BLADESTOP].timer != -1)
+ {
+ int lv = sc_data[SC_BLADESTOP].val1;
+ if (sc_data[SC_BLADESTOP].val2 == 1)
+ return 0; //白羽された側なのでダメ
+ if (lv == 1)
+ return 0;
+ if (lv == 2 && skill_num != MO_FINGEROFFENSIVE)
+ return 0;
+ if (lv == 3 && skill_num != MO_FINGEROFFENSIVE
+ && skill_num != MO_INVESTIGATE)
+ return 0;
+ if (lv == 4 && skill_num != MO_FINGEROFFENSIVE
+ && skill_num != MO_INVESTIGATE && skill_num != MO_CHAINCOMBO)
+ return 0;
+ if (lv == 5 && skill_num != MO_FINGEROFFENSIVE
+ && skill_num != MO_INVESTIGATE && skill_num != MO_CHAINCOMBO
+ && skill_num != MO_EXTREMITYFIST)
+ return 0;
}
if (sd->status.option & 4 && skill_num == TF_HIDING)
@@ -7978,7 +8240,7 @@ int skill_use_id(struct map_session_data *sd, int target_id,
break;
}
case BD_ENCORE: /* アンコール */
- if (!sd->skillid_dance)
+ if (sd->skillid_dance == SkillID::ZERO)
{ //前回使用した踊りがないとだめ
clif_skill_fail(sd, skill_num, 0, 0);
return 0;
@@ -8102,8 +8364,8 @@ int skill_use_id(struct map_session_data *sd, int target_id,
//
case MO_EXTREMITYFIST: /*阿修羅覇鳳拳 */
if (sc_data && sc_data[SC_COMBO].timer != -1
- && (sc_data[SC_COMBO].val1 == MO_COMBOFINISH
- || sc_data[SC_COMBO].val1 == CH_CHAINCRUSH))
+ && (SkillID(sc_data[SC_COMBO].val1) == MO_COMBOFINISH
+ || SkillID(sc_data[SC_COMBO].val1) == CH_CHAINCRUSH))
{
casttime = 0;
target_id = sd->attacktarget;
@@ -8133,7 +8395,7 @@ int skill_use_id(struct map_session_data *sd, int target_id,
break;
case AS_SPLASHER: /* ベナムスプラッシャー */
{
- struct status_change *t_sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> t_sc_data = battle_get_sc_data(bl);
if (t_sc_data && t_sc_data[SC_POISON].timer == -1)
{
clif_skill_fail(sd, skill_num, 0, 10);
@@ -8157,7 +8419,7 @@ int skill_use_id(struct map_session_data *sd, int target_id,
if (battle_config.pc_skill_log)
printf("PC %d skill use target_id=%d skill=%d lv=%d cast=%d\n",
- sd->bl.id, target_id, skill_num, skill_lv, casttime);
+ sd->bl.id, target_id, uint16_t(skill_num), skill_lv, casttime);
// if(sd->skillitem == skill_num)
// casttime = delay = 0;
@@ -8224,10 +8486,11 @@ int skill_use_id(struct map_session_data *sd, int target_id,
*------------------------------------------
*/
int skill_use_pos(struct map_session_data *sd,
- int skill_x, int skill_y, int skill_num, int skill_lv)
+ int skill_x, int skill_y,
+ SkillID skill_num, int skill_lv)
{
struct block_list bl;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
unsigned int tick;
int casttime = 0, delay = 0, skill, range;
@@ -8283,7 +8546,8 @@ int skill_use_pos(struct map_session_data *sd,
if (battle_config.pc_skill_log)
printf("PC %d skill use target_pos= (%d,%d) skill=%d lv=%d cast=%d\n",
- sd->bl.id, skill_x, skill_y, skill_num, skill_lv, casttime);
+ sd->bl.id, skill_x, skill_y,
+ uint16_t(skill_num), skill_lv, casttime);
// if(sd->skillitem == skill_num)
// casttime = delay = 0;
@@ -8573,8 +8837,7 @@ void skill_devotion(struct map_session_data *md, int target)
struct map_session_data *sd = map_id2sd(md->dev.val1[n]);
// 相手が見つからない // 相手をディボしてるのが自分じゃない // 距離が離れてる
if (sd == NULL
- || (sd->sc_data
- && (md->bl.id != sd->sc_data[SC_DEVOTION].val1))
+ || (md->bl.id != sd->sc_data[SC_DEVOTION].val1)
|| skill_devotion3(&md->bl, md->dev.val1[n]))
{
skill_devotion_end(md, sd, n);
@@ -8628,7 +8891,7 @@ void skill_devotion_end(struct map_session_data *md,
nullpo_retv(sd);
md->dev.val1[target] = md->dev.val2[target] = 0;
- if (sd && sd->sc_data)
+ if (sd)
{
// skill_status_change_end(sd->bl,SC_DEVOTION,-1);
sd->sc_data[SC_DEVOTION].val1 = 0;
@@ -8642,7 +8905,7 @@ void skill_devotion_end(struct map_session_data *md,
* オートスペル
*------------------------------------------
*/
-int skill_autospell(struct map_session_data *sd, int skillid)
+int skill_autospell(struct map_session_data *sd, SkillID skillid)
{
int skilllv;
int maxlv = 1, lv;
@@ -8687,8 +8950,9 @@ int skill_autospell(struct map_session_data *sd, int skillid)
if (maxlv > (lv = pc_checkskill(sd, skillid)))
maxlv = lv;
- skill_status_change_start(&sd->bl, SC_AUTOSPELL, skilllv, skillid, maxlv, 0, // val1:スキルID val2:使用最大Lv
- skill_get_time(SA_AUTOSPELL, skilllv), 0); // にしてみたけどbscriptが書き易い・・・?
+ skill_status_change_start(&sd->bl, SC_AUTOSPELL,
+ skilllv, uint16_t(skillid), maxlv, 0,
+ skill_get_time(SA_AUTOSPELL, skilllv), 0);
return 0;
}
@@ -8785,14 +9049,14 @@ int skill_gangsterparadise(struct map_session_data *sd, int type)
void skill_frostjoke_scream(struct block_list *bl, va_list ap)
{
struct block_list *src;
- int skillnum, skilllv;
+ int skilllv;
unsigned int tick;
nullpo_retv(bl);
nullpo_retv(ap);
nullpo_retv(src = va_arg(ap, struct block_list *));
- skillnum = va_arg(ap, int);
+ SkillID skillnum = va_arg(ap, SkillID);
skilllv = va_arg(ap, int);
tick = va_arg(ap, unsigned int);
@@ -8816,7 +9080,7 @@ void skill_frostjoke_scream(struct block_list *bl, va_list ap)
void skill_attack_area(struct block_list *bl, va_list ap)
{
struct block_list *src, *dsrc;
- int atk_type, skillid, skilllv, flag, type;
+ int atk_type, skilllv, flag, type;
unsigned int tick;
nullpo_retv(bl);
@@ -8827,7 +9091,7 @@ void skill_attack_area(struct block_list *bl, va_list ap)
return;
if ((dsrc = va_arg(ap, struct block_list *)) == NULL)
return;
- skillid = va_arg(ap, int);
+ SkillID skillid = va_arg(ap, SkillID);
skilllv = va_arg(ap, int);
tick = va_arg(ap, unsigned int);
flag = va_arg(ap, int);
@@ -8845,7 +9109,7 @@ void skill_clear_element_field(struct block_list *bl)
{
struct mob_data *md = NULL;
struct map_session_data *sd = NULL;
- int i, skillid;
+ int i;
nullpo_retv(bl);
@@ -8858,14 +9122,14 @@ void skill_clear_element_field(struct block_list *bl)
{
if (sd)
{
- skillid = sd->skillunit[i].skill_id;
+ SkillID skillid = sd->skillunit[i].skill_id;
if (skillid == SA_DELUGE || skillid == SA_VOLCANO
|| skillid == SA_VIOLENTGALE || skillid == SA_LANDPROTECTOR)
skill_delunitgroup(&sd->skillunit[i]);
}
else if (md)
{
- skillid = md->skillunit[i].skill_id;
+ SkillID skillid = md->skillunit[i].skill_id;
if (skillid == SA_DELUGE || skillid == SA_VOLCANO
|| skillid == SA_VIOLENTGALE || skillid == SA_LANDPROTECTOR)
skill_delunitgroup(&md->skillunit[i]);
@@ -8879,14 +9143,13 @@ void skill_clear_element_field(struct block_list *bl)
*/
void skill_landprotector(struct block_list *bl, va_list ap)
{
- int skillid;
int *alive;
struct skill_unit *unit;
nullpo_retv(bl);
nullpo_retv(ap);
- skillid = va_arg(ap, int);
+ SkillID skillid = va_arg(ap, SkillID);
alive = va_arg(ap, int *);
if ((unit = (struct skill_unit *) bl) == NULL)
return;
@@ -9016,13 +9279,12 @@ void skill_trap_splash(struct block_list *bl, va_list ap)
void skill_status_change_timer_sub(struct block_list *bl, va_list ap)
{
struct block_list *src;
- int type;
unsigned int tick;
nullpo_retv(bl);
nullpo_retv(ap);
nullpo_retv(src = va_arg(ap, struct block_list *));
- type = va_arg(ap, int);
+ StatusChange type = va_arg(ap, StatusChange);
tick = va_arg(ap, unsigned int);
if (bl->type != BL_PC && bl->type != BL_MOB)
@@ -9045,7 +9307,7 @@ void skill_status_change_timer_sub(struct block_list *bl, va_list ap)
skill_status_change_end(bl, SC_CLOAKING, -1);
if (battle_check_target(src, bl, BCT_ENEMY) > 0)
{
- struct status_change *sc_data = battle_get_sc_data(bl);
+ eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
skill_attack(BF_MAGIC, src, src, bl, AL_RUWACH,
sc_data[type].val1, tick, 0);
}
@@ -9058,9 +9320,9 @@ void skill_status_change_timer_sub(struct block_list *bl, va_list ap)
* ステータス異常終了
*------------------------------------------
*/
-int skill_status_change_active(struct block_list *bl, int type)
+int skill_status_change_active(struct block_list *bl, StatusChange type)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
if (bl->type != BL_PC && bl->type != BL_MOB)
@@ -9070,14 +9332,16 @@ int skill_status_change_active(struct block_list *bl, int type)
return 0;
}
- nullpo_retr(0, sc_data = battle_get_sc_data(bl));
+ sc_data = battle_get_sc_data(bl);
+ if (not sc_data)
+ return 0;
return sc_data[type].timer != -1;
}
-int skill_status_change_end(struct block_list *bl, int type, int tid)
+int skill_status_change_end(struct block_list *bl, StatusChange type, int tid)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
int opt_flag = 0, calc_flag = 0;
short *sc_count, *option, *opt1, *opt2, *opt3;
@@ -9088,7 +9352,9 @@ int skill_status_change_end(struct block_list *bl, int type, int tid)
printf("skill_status_change_end: neither MOB nor PC !\n");
return 0;
}
- nullpo_retr(0, sc_data = battle_get_sc_data(bl));
+ sc_data = battle_get_sc_data(bl);
+ if (not sc_data)
+ return 0;
nullpo_retr(0, sc_count = battle_get_sc_count(bl));
nullpo_retr(0, option = battle_get_option(bl));
nullpo_retr(0, opt1 = battle_get_opt1(bl));
@@ -9179,7 +9445,7 @@ int skill_status_change_end(struct block_list *bl, int type, int tid)
break;
case SC_BLADESTOP:
{
- struct status_change *t_sc_data =
+ eptr<struct status_change, StatusChange> t_sc_data =
battle_get_sc_data((struct block_list *)
sc_data[type].val4);
//片方が切れたので相手の白刃状態が切れてないのなら解除
@@ -9197,7 +9463,7 @@ int skill_status_change_end(struct block_list *bl, int type, int tid)
case SC_DANCING:
{
struct map_session_data *dsd;
- struct status_change *d_sc_data;
+ eptr<struct status_change, StatusChange> d_sc_data;
if (sc_data[type].val4
&& (dsd = map_id2sd(sc_data[type].val4)))
{
@@ -9233,9 +9499,9 @@ int skill_status_change_end(struct block_list *bl, int type, int tid)
if (src && tid != -1)
{
//自分にダメージ&周囲3*3にダメージ
- skill_castend_damage_id(src, bl, sc_data[type].val2,
- sc_data[type].val1, gettick(),
- 0);
+ skill_castend_damage_id(src, bl,
+ SkillID(sc_data[type].val2), sc_data[type].val1,
+ gettick(), 0);
}
}
break;
@@ -9244,9 +9510,9 @@ int skill_status_change_end(struct block_list *bl, int type, int tid)
//自分のダメージは0にして
struct mob_data *md = NULL;
if (bl->type == BL_MOB && (md = (struct mob_data *) bl))
- skill_castend_damage_id(bl, bl, sc_data[type].val2,
- sc_data[type].val1, gettick(),
- 0);
+ skill_castend_damage_id(bl, bl,
+ SkillID( sc_data[type].val2), sc_data[type].val1,
+ gettick(), 0);
}
break;
/* option1 */
@@ -9276,10 +9542,22 @@ int skill_status_change_end(struct block_list *bl, int type, int tid)
break;
case SC_POISON:
+ *opt2 &= ~0x0001;
+ opt_flag = 1;
+ break;
+
case SC_CURSE:
+ *opt2 &= ~0x0002;
+ opt_flag = 1;
+ break;
+
case SC_SILENCE:
+ *opt2 &= ~0x0004;
+ opt_flag = 1;
+ break;
+
case SC_BLIND:
- *opt2 &= ~(1 << (type - SC_POISON));
+ *opt2 &= ~0x0010;
opt_flag = 1;
break;
@@ -9405,15 +9683,18 @@ int skill_update_heal_animation(struct map_session_data *sd)
*/
void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t data)
{
- int type = data;
+ StatusChange type = StatusChange(data);
struct block_list *bl;
struct map_session_data *sd = NULL;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
//short *sc_count; //使ってない?
if ((bl = map_id2bl(id)) == NULL)
- return; //該当IDがすでに消滅しているというのはいかにもありそうなのでスルーしてみる
- nullpo_retv(sc_data = battle_get_sc_data(bl));
+ return;
+ //該当IDがすでに消滅しているというのはいかにもありそうなのでスルーしてみる
+ sc_data = battle_get_sc_data(bl);
+ if (not sc_data)
+ return;
if (bl->type == BL_PC)
sd = (struct map_session_data *) bl;
@@ -9733,7 +10014,7 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom
{
if (sd->status.sp > 0 && (--sc_data[type].val3) > 0)
{
- switch (sc_data[type].val1)
+ switch (SkillID(sc_data[type].val1))
{
case BD_RICHMANKIM: /* ニヨルドの宴 3秒にSP1 */
case BD_DRUMBATTLEFIELD: /* 戦太鼓の響き 3秒にSP1 */
@@ -9856,12 +10137,14 @@ void skill_status_change_timer(timer_id tid, tick_t tick, custom_id_t id, custom
* ステータス異常終了
*------------------------------------------
*/
-int skill_encchant_eremental_end(struct block_list *bl, int type)
+int skill_encchant_eremental_end(struct block_list *bl, StatusChange type)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
nullpo_retr(0, bl);
- nullpo_retr(0, sc_data = battle_get_sc_data(bl));
+ sc_data = battle_get_sc_data(bl);
+ if (not sc_data)
+ return 0;
if (type != SC_ENCPOISON && sc_data[SC_ENCPOISON].timer != -1) /* エンチャントポイズン解除 */
skill_status_change_end(bl, SC_ENCPOISON, -1);
@@ -9883,20 +10166,20 @@ int skill_encchant_eremental_end(struct block_list *bl, int type)
* ステータス異常開始
*------------------------------------------
*/
-int skill_status_change_start(struct block_list *bl, int type, int val1,
- int val2, int val3, int val4, int tick,
- int flag)
+int skill_status_change_start(struct block_list *bl, StatusChange type,
+ int val1, int val2, int val3, int val4,
+ int tick, int flag)
{
return skill_status_effect(bl, type, val1, val2, val3, val4, tick, flag,
0);
}
-int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
- int val3, int val4, int tick, int flag,
- int spell_invocation)
+int skill_status_effect(struct block_list *bl, StatusChange type,
+ int val1, int val2, int val3, int val4,
+ int tick, int flag, int spell_invocation)
{
struct map_session_data *sd = NULL;
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
short *sc_count, *option, *opt1, *opt2, *opt3;
int opt_flag = 0, calc_flag = 0, updateflag =
0, race, mode, elem, undead_flag;
@@ -9905,7 +10188,9 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
nullpo_retr(0, bl);
if (bl->type == BL_SKILL)
return 0;
- nullpo_retr(0, sc_data = battle_get_sc_data(bl));
+ sc_data = battle_get_sc_data(bl);
+ if (not sc_data)
+ return 0;
nullpo_retr(0, sc_count = battle_get_sc_count(bl));
nullpo_retr(0, option = battle_get_option(bl));
nullpo_retr(0, opt1 = battle_get_opt1(bl));
@@ -9955,9 +10240,11 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
return 0;
if (SC_STONE <= type && type <= SC_BLIND)
- { /* カードによる耐性 */
- if (sd && sd->reseff[type - SC_STONE] > 0
- && MRAND(10000) < sd->reseff[type - SC_STONE])
+ {
+ BadSC bsc = BadSC_from_SC(type);
+ /* カードによる耐性 */
+ if (sd && sd->reseff[bsc] > 0
+ && MRAND(10000) < sd->reseff[bsc])
{
if (battle_config.battle_log)
printf("PC %d skill_sc_start: cardによる異常耐性発動\n",
@@ -10369,8 +10656,8 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
}
break;
case SC_SELFDESTRUCTION: //自爆
- clif_skillcasting(bl, bl->id, bl->id, 0, 0, 331,
- skill_get_time(val2, val1));
+ clif_skillcasting(bl, bl->id, bl->id, 0, 0, DC_FORTUNEKISS,
+ skill_get_time(SkillID(val2), val1));
val3 = tick / 1000;
tick = 1000;
break;
@@ -10627,7 +10914,7 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
break;
default:
if (battle_config.error_log)
- printf("UnknownStatusChange [%d]\n", type);
+ printf("UnknownStatusChange [%d]\n", uint16_t(type));
return 0;
}
@@ -10643,23 +10930,24 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
case SC_SLEEP:
battle_stopattack(bl); /* 攻撃停止 */
skill_stop_dancing(bl, 0); /* 演奏/ダンスの中断 */
- { /* 同時に掛からないステータス異常を解除 */
- int i;
- for (i = SC_STONE; i <= SC_SLEEP; i++)
+ /* 同時に掛からないステータス異常を解除 */
+ for (StatusChange i : MAJOR_STATUS_EFFECTS_1)
+ {
+ if (sc_data[i].timer != -1)
{
- if (sc_data[i].timer != -1)
- {
- (*sc_count)--;
- delete_timer(sc_data[i].timer,
- skill_status_change_timer);
- sc_data[i].timer = -1;
- }
+ (*sc_count)--;
+ delete_timer(sc_data[i].timer,
+ skill_status_change_timer);
+ sc_data[i].timer = -1;
}
}
- if (type == SC_STONE)
- *opt1 = 6;
- else
- *opt1 = type - SC_STONE + 1;
+ switch (type)
+ {
+ case SC_STONE: *opt1 = 6; break;
+ case SC_FREEZE: *opt1 = 2; break;
+ case SC_STAN: *opt1 = 3; break;
+ case SC_SLEEP: *opt1 = 4; break;
+ }
opt_flag = 1;
break;
case SC_POISON:
@@ -10671,11 +10959,18 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
break;
case SC_CURSE:
+ *opt2 |= 0x0002;
+ opt_flag = 1;
+ break;
case SC_SILENCE:
+ *opt2 |= 0x0004;
+ opt_flag = 1;
+ break;
case SC_BLIND:
- *opt2 |= 1 << (type - SC_POISON);
+ *opt2 |= 0x0010;
opt_flag = 1;
break;
+
case SC_SLOWPOISON:
*opt2 &= ~0x1;
*opt2 |= 0x200;
@@ -10727,7 +11022,7 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
/* タイマー設定 */
sc_data[type].timer =
add_timer(gettick() + tick, skill_status_change_timer, bl->id,
- type);
+ custom_data_t(type));
if (bl->type == BL_PC && calc_flag)
pc_calcstatus(sd, 0); /* ステータス再計算 */
@@ -10744,12 +11039,13 @@ int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
*/
int skill_status_change_clear(struct block_list *bl, int type)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
short *sc_count, *option, *opt1, *opt2, *opt3;
- int i;
nullpo_retr(0, bl);
- nullpo_retr(0, sc_data = battle_get_sc_data(bl));
+ sc_data = battle_get_sc_data(bl);
+ if (not sc_data)
+ return 0;
nullpo_retr(0, sc_count = battle_get_sc_count(bl));
nullpo_retr(0, option = battle_get_option(bl));
nullpo_retr(0, opt1 = battle_get_opt1(bl));
@@ -10758,7 +11054,7 @@ int skill_status_change_clear(struct block_list *bl, int type)
if (*sc_count == 0)
return 0;
- for (i = 0; i < MAX_STATUSCHANGE; i++)
+ for (StatusChange i : erange(StatusChange(), MAX_STATUSCHANGE))
{
if (sc_data[i].timer != -1)
{ /* 異常があるならタイマーを削除する */
@@ -10830,9 +11126,8 @@ int skill_check_cloaking(struct block_list *bl)
* 戻り ダンスじゃない=0 合奏=2 それ以外のダンス=1
*------------------------------------------
*/
-int skill_is_danceskill(int id)
+int skill_is_danceskill(SkillID id)
{
- int i;
switch (id)
{
case BD_LULLABY: /* 子守歌 */
@@ -10845,8 +11140,7 @@ int skill_is_danceskill(int id)
case BD_SIEGFRIED: /* 不死身のジークフリード */
case BD_RAGNAROK: /* 神々の黄昏 */
case CG_MOONLIT: /* 月明りの泉に落ちる花びら */
- i = 2;
- break;
+ return 2;
case BA_DISSONANCE: /* 不協和音 */
case BA_FROSTJOKE: /* 寒いジョーク */
case BA_WHISTLE: /* 口笛 */
@@ -10859,12 +11153,10 @@ int skill_is_danceskill(int id)
case DC_DONTFORGETME: /* 私を忘れないで… */
case DC_FORTUNEKISS: /* 幸運のキス */
case DC_SERVICEFORYOU: /* サービスフォーユー */
- i = 1;
- break;
+ return 1;
default:
- i = 0;
+ return 0;
}
- return i;
}
/*==========================================
@@ -10875,7 +11167,7 @@ int skill_is_danceskill(int id)
*/
void skill_stop_dancing(struct block_list *src, int flag)
{
- struct status_change *sc_data;
+ eptr<struct status_change, StatusChange> sc_data;
struct skill_unit_group *group;
nullpo_retv(src);
@@ -11003,8 +11295,7 @@ int skill_delunit(struct skill_unit *unit)
*/
static int skill_unit_group_newid = 10;
struct skill_unit_group *skill_initunitgroup(struct block_list *src,
- int count, int skillid,
- int skilllv, int unit_id)
+ int count, SkillID skillid, int skilllv, int unit_id)
{
int i;
struct skill_unit_group *group = NULL, *list = NULL;
@@ -11078,9 +11369,9 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src,
sd->skillid_dance = skillid;
sd->skilllv_dance = skilllv;
}
- skill_status_change_start(src, SC_DANCING, skillid, (int) group, 0,
- 0, skill_get_time(skillid,
- skilllv) + 1000, 0);
+ skill_status_change_start(src, SC_DANCING,
+ uint16_t(skillid), (int) group, 0, 0,
+ skill_get_time(skillid, skilllv) + 1000, 0);
switch (skillid)
{ //合奏スキルは相方をダンス状態にする
case BD_LULLABY: /* 子守歌 */
@@ -11740,12 +12031,12 @@ static int scan_stat(char *statname)
static
int skill_readdb(void)
{
- int i, j, k, l;
+ int j, k, l;
FILE *fp;
char line[1024], *p;
/* The main skill database */
- memset(skill_db, 0, sizeof(skill_db));
+ memset(&skill_db, 0, sizeof(skill_db));
fp = fopen_("db/skill_db.txt", "r");
if (fp == NULL)
{
@@ -11773,8 +12064,8 @@ int skill_readdb(void)
continue;
}
- i = atoi(split[0]);
- if (i < 0 || i > MAX_SKILL_DB)
+ SkillID i = SkillID(atoi(split[0]));
+ if (i < SkillID() || i > MAX_SKILL_DB)
continue;
memset(split2, 0, sizeof(split2));
@@ -11850,8 +12141,8 @@ int skill_readdb(void)
skill_db[i].stat = scan_stat(split[16]);
char *tmp = strdup(split[17]);
- skill_names[i].desc = tmp;
- { // replace "_" by " "
+ {
+ // replace "_" by " "
char *s = tmp;
while ((s = strchr(s, '_')))
*s = ' ';
@@ -11860,6 +12151,7 @@ int skill_readdb(void)
|| (s = strchr(tmp, '\n')))
*s = '\000';
}
+ skill_lookup_by_id(i).desc = tmp;
}
fclose_(fp);
printf("read db/skill_db.txt done\n");
@@ -11887,8 +12179,8 @@ int skill_readdb(void)
if (split[29] == NULL || j < 30)
continue;
- i = atoi(split[0]);
- if (i < 0 || i > MAX_SKILL_DB)
+ SkillID i = SkillID(atoi(split[0]));
+ if (i < SkillID() || i > MAX_SKILL_DB)
continue;
memset(split2, 0, sizeof(split2));
@@ -12070,8 +12362,8 @@ int skill_readdb(void)
if (split[4] == NULL || j < 5)
continue;
- i = atoi(split[0]);
- if (i < 0 || i > MAX_SKILL_DB)
+ SkillID i = SkillID(atoi(split[0]));
+ if (i < SkillID() || i > MAX_SKILL_DB)
continue;
memset(split2, 0, sizeof(split2));
@@ -12147,8 +12439,8 @@ int skill_readdb(void)
*p++ = 0;
}
- i = atoi(split[0]);
- if (i < 0 || i > MAX_SKILL_DB)
+ SkillID i = SkillID(atoi(split[0]));
+ if (i < SkillID() || i > MAX_SKILL_DB)
continue;
memset(split2, 0, sizeof(split2));
@@ -12194,3 +12486,21 @@ int do_init_skill(void)
return 0;
}
+
+constexpr size_t num_names = sizeof(skill_names) / sizeof(skill_names[0]);
+
+skill_name_db& skill_lookup_by_id(SkillID id)
+{
+ for (skill_name_db& ner : skill_names)
+ if (ner.id == id)
+ return ner;
+ return skill_names[num_names - 1];
+}
+
+skill_name_db& skill_lookup_by_name(const char *name)
+{
+ for (skill_name_db& ner : skill_names)
+ if (!strcasecmp(name, ner.name) || !strcasecmp(name, ner.desc))
+ return ner;
+ return skill_names[num_names - 1];
+}
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index 38a0ed5..5452bd2 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -2,12 +2,13 @@
#ifndef SKILL_HPP
#define SKILL_HPP
+#include "skill.t.hpp"
+
#include "../common/timer.hpp"
#include "map.hpp"
#include "magic.hpp"
-#define MAX_SKILL_DB 450
#define MAX_SKILL_PRODUCE_DB 150
#define MAX_SKILL_ARROW_DB 150
#define MAX_SKILL_ABRA_DB 350
@@ -29,20 +30,27 @@ struct skill_db
int hp[MAX_SKILL_LEVEL], sp[MAX_SKILL_LEVEL], mhp[MAX_SKILL_LEVEL],
hp_rate[MAX_SKILL_LEVEL], sp_rate[MAX_SKILL_LEVEL],
zeny[MAX_SKILL_LEVEL];
- int weapon, state, spiritball[MAX_SKILL_LEVEL];
+ int weapon;
+ SkillState state;
+ int spiritball[MAX_SKILL_LEVEL];
int itemid[10], amount[10];
int castnodex[MAX_SKILL_LEVEL];
};
-extern struct skill_db skill_db[MAX_SKILL_DB];
+extern earray<struct skill_db, SkillID, MAX_SKILL_DB> skill_db;
struct skill_name_db
{
- int id; // skill id
+ SkillID id; // skill id
const char *name; // search strings
const char *desc; // description that shows up for search's
};
+
+// used only by @skillid for iteration - should be depublicized
extern struct skill_name_db skill_names[];
+skill_name_db& skill_lookup_by_id(SkillID id);
+skill_name_db& skill_lookup_by_name(const char *name);
+
struct block_list;
struct map_session_data;
struct skill_unit;
@@ -51,46 +59,46 @@ struct skill_unit_group;
int do_init_skill(void);
// スキルデータベースへのアクセサ
-int skill_get_hit(int id);
-int skill_get_inf(int id);
-int skill_get_pl(int id);
-int skill_get_nk(int id);
-int skill_get_max(int id);
-int skill_get_max_raise(int id);
-int skill_get_range(int id, int lv);
-int skill_get_hp(int id, int lv);
-int skill_get_mhp(int id, int lv);
-int skill_get_sp(int id, int lv);
-int skill_get_zeny(int id, int lv);
-int skill_get_num(int id, int lv);
-int skill_get_cast(int id, int lv);
-int skill_get_delay(int id, int lv);
-int skill_get_time(int id, int lv);
-int skill_get_time2(int id, int lv);
-int skill_get_castdef(int id);
-int skill_get_weapontype(int id);
-int skill_get_unit_id(int id, int flag);
-int skill_get_inf2(int id);
-int skill_get_maxcount(int id);
-int skill_get_blewcount(int id, int lv);
+int skill_get_hit(SkillID id);
+int skill_get_inf(SkillID id);
+int skill_get_pl(SkillID id);
+int skill_get_nk(SkillID id);
+int skill_get_max(SkillID id);
+int skill_get_max_raise(SkillID id);
+int skill_get_range(SkillID id, int lv);
+int skill_get_hp(SkillID id, int lv);
+int skill_get_mhp(SkillID id, int lv);
+int skill_get_sp(SkillID id, int lv);
+int skill_get_zeny(SkillID id, int lv);
+int skill_get_num(SkillID id, int lv);
+int skill_get_cast(SkillID id, int lv);
+int skill_get_delay(SkillID id, int lv);
+int skill_get_time(SkillID id, int lv);
+int skill_get_time2(SkillID id, int lv);
+int skill_get_castdef(SkillID id);
+int skill_get_weapontype(SkillID id);
+int skill_get_unit_id(SkillID id, int flag);
+int skill_get_inf2(SkillID id);
+int skill_get_maxcount(SkillID id);
+int skill_get_blewcount(SkillID id, int lv);
// スキルの使用
int skill_use_id(struct map_session_data *sd, int target_id,
- int skill_num, int skill_lv);
+ SkillID skill_num, int skill_lv);
int skill_use_pos(struct map_session_data *sd,
- int skill_x, int skill_y, int skill_num, int skill_lv);
+ int skill_x, int skill_y, SkillID skill_num, int skill_lv);
-int skill_castend_map(struct map_session_data *sd, int skill_num,
+int skill_castend_map(struct map_session_data *sd, SkillID skill_num,
const char *map);
int skill_cleartimerskill(struct block_list *src);
int skill_addtimerskill(struct block_list *src, unsigned int tick,
- int target, int x, int y, int skill_id,
+ int target, int x, int y, SkillID skill_id,
int skill_lv, int type, int flag);
// 追加効果
int skill_additional_effect(struct block_list *src, struct block_list *bl,
- int skillid, int skilllv, int attack_type,
+ SkillID skillid, int skilllv, int attack_type,
unsigned int tick);
// ユニットスキル
@@ -98,7 +106,7 @@ struct skill_unit *skill_initunit(struct skill_unit_group *group, int idx,
int x, int y);
int skill_delunit(struct skill_unit *unit);
struct skill_unit_group *skill_initunitgroup(struct block_list *src,
- int count, int skillid,
+ int count, SkillID skillid,
int skilllv, int unit_id);
int skill_delunitgroup(struct skill_unit_group *group);
struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct
@@ -113,10 +121,10 @@ int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl,
int skill_castfix(struct block_list *bl, int time);
int skill_delayfix(struct block_list *bl, int time);
-int skill_check_unit_range(int m, int x, int y, int range, int skillid);
+int skill_check_unit_range(int m, int x, int y, int range, SkillID skillid);
int skill_check_unit_range2(int m, int x, int y, int range);
// -- moonsoul (added skill_check_unit_cell)
-int skill_check_unit_cell(int skillid, int m, int x, int y, int unit_id);
+int skill_check_unit_cell(SkillID skillid, int m, int x, int y, int unit_id);
int skill_unit_out_all(struct block_list *bl, unsigned int tick, int range);
int skill_unit_move(struct block_list *bl, unsigned int tick, int range);
int skill_unit_move_unit_group(struct skill_unit_group *group, int m,
@@ -131,7 +139,7 @@ int skill_castcancel(struct block_list *bl, int type);
int skill_gangsterparadise(struct map_session_data *sd, int type);
void skill_brandishspear_first(struct square *tc, int dir, int x, int y);
void skill_brandishspear_dir(struct square *tc, int dir, int are);
-int skill_autospell(struct map_session_data *md, int skillid);
+int skill_autospell(struct map_session_data *md, SkillID skillid);
void skill_devotion(struct map_session_data *md, int target);
void skill_devotion2(struct block_list *bl, int crusader);
int skill_devotion3(struct block_list *bl, int target);
@@ -142,727 +150,40 @@ void skill_devotion_end(struct map_session_data *md,
// その他
int skill_check_cloaking(struct block_list *bl);
-int skill_is_danceskill(int id);
+int skill_is_danceskill(SkillID id);
// ステータス異常
-int skill_status_effect(struct block_list *bl, int type, int val1, int val2,
- int val3, int val4, int tick, int flag,
- int spell_invocation);
-int skill_status_change_start(struct block_list *bl, int type, int val1,
- int val2, int val3, int val4, int tick,
- int flag);
+int skill_status_effect(struct block_list *bl, StatusChange type,
+ int val1, int val2, int val3, int val4,
+ int tick, int flag, int spell_invocation);
+int skill_status_change_start(struct block_list *bl, StatusChange type,
+ int val1, int val2, int val3, int val4, int tick, int flag);
void skill_status_change_timer(timer_id, tick_t, custom_id_t, custom_data_t);
-int skill_status_change_active(struct block_list *bl, int type); // [fate]
-int skill_encchant_eremental_end(struct block_list *bl, int type);
-int skill_status_change_end(struct block_list *bl, int type, int tid);
+int skill_status_change_active(struct block_list *bl, StatusChange type); // [fate]
+int skill_encchant_eremental_end(struct block_list *bl, StatusChange type);
+int skill_status_change_end(struct block_list *bl, StatusChange type, int tid);
int skill_status_change_clear(struct block_list *bl, int type);
// mobスキルのため
int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl,
- int skillid, int skilllv, unsigned int tick,
+ SkillID skillid, int skilllv, unsigned int tick,
int flag);
int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
- int skillid, int skilllv, unsigned int tick,
+ SkillID skillid, int skilllv, unsigned int tick,
int flag);
-int skill_castend_pos2(struct block_list *src, int x, int y, int skillid,
+int skill_castend_pos2(struct block_list *src, int x, int y, SkillID skillid,
int skilllv, unsigned int tick, int flag);
// スキル攻撃一括処理
int skill_attack(int attack_type, struct block_list *src,
struct block_list *dsrc, struct block_list *bl,
- int skillid, int skilllv, unsigned int tick, int flag);
+ SkillID skillid, int skilllv, unsigned int tick, int flag);
int skill_update_heal_animation(struct map_session_data *sd); // [Fate] Check whether the healing flag must be updated, do so if needed
void skill_reload(void);
-enum
-{
- ST_NONE, ST_HIDING, ST_CLOAKING, ST_HIDDEN, ST_RIDING, ST_FALCON, ST_CART,
- ST_SHIELD, ST_SIGHT, ST_EXPLOSIONSPIRITS,
- ST_RECOV_WEIGHT_RATE, ST_MOVE_ENABLE, ST_WATER,
-};
-
-enum
-{ // struct map_session_data の status_changeの番号テーブル
- SC_SENDMAX = 256,
- SC_PROVOKE = 0,
- SC_ENDURE = 1,
- SC_TWOHANDQUICKEN = 2,
- SC_CONCENTRATE = 3,
- SC_HIDING = 4,
- SC_CLOAKING = 5,
- SC_ENCPOISON = 6,
- SC_POISONREACT = 7,
- SC_QUAGMIRE = 8,
- SC_ANGELUS = 9,
- SC_BLESSING = 10,
- SC_SIGNUMCRUCIS = 11,
- SC_INCREASEAGI = 12,
- SC_DECREASEAGI = 13,
- SC_SLOWPOISON = 14,
- SC_IMPOSITIO = 15,
- SC_SUFFRAGIUM = 16,
- SC_ASPERSIO = 17,
- SC_BENEDICTIO = 18,
- SC_KYRIE = 19,
- SC_MAGNIFICAT = 20,
- SC_GLORIA = 21,
- SC_AETERNA = 22,
- SC_ADRENALINE = 23,
- SC_WEAPONPERFECTION = 24,
- SC_OVERTHRUST = 25,
- SC_MAXIMIZEPOWER = 26,
- SC_RIDING = 27,
- SC_FALCON = 28,
- SC_TRICKDEAD = 29,
- SC_LOUD = 30,
- SC_ENERGYCOAT = 31,
- SC_BROKNARMOR = 32,
- SC_BROKNWEAPON = 33,
- SC_HALLUCINATION = 34,
- SC_WEIGHT50 = 35,
- SC_WEIGHT90 = 36,
- SC_SPEEDPOTION0 = 37,
- SC_SPEEDPOTION1 = 38,
- SC_SPEEDPOTION2 = 39,
-
- SC_STRIPWEAPON = 50,
- SC_STRIPSHIELD = 51,
- SC_STRIPARMOR = 52,
- SC_STRIPHELM = 53,
- SC_CP_WEAPON = 54,
- SC_CP_SHIELD = 55,
- SC_CP_ARMOR = 56,
- SC_CP_HELM = 57,
- SC_AUTOGUARD = 58,
- SC_REFLECTSHIELD = 59,
- SC_DEVOTION = 60,
- SC_PROVIDENCE = 61,
- SC_DEFENDER = 62,
- SC_AUTOSPELL = 65,
- SC_EXPLOSIONSPIRITS = 86,
- SC_STEELBODY = 87,
- SC_SPEARSQUICKEN = 68,
-
- SC_HEALING = 70,
-
- SC_SIGHTTRASHER = 73,
-
- SC_COMBO = 89,
- SC_FLAMELAUNCHER = 90,
- SC_FROSTWEAPON = 91,
- SC_LIGHTNINGLOADER = 92,
- SC_SEISMICWEAPON = 93,
-
- SC_AURABLADE = 103,
- SC_PARRYING = 104,
- SC_CONCENTRATION = 105,
- SC_TENSIONRELAX = 106,
- SC_BERSERK = 107,
-
- SC_ASSUMPTIO = 110,
-
- SC_MAGICPOWER = 113,
-
- SC_TRUESIGHT = 115,
- SC_WINDWALK = 116,
- SC_MELTDOWN = 117,
- SC_CARTBOOST = 118,
-
- SC_REJECTSWORD = 120,
- SC_MARIONETTE = 121,
-
- SC_HEADCRUSH = 124,
- SC_JOINTBEAT = 125,
- SC_BASILICA = 125,
-
- SC_STONE = 128,
- SC_FREEZE = 129,
- SC_STAN = 130,
- SC_SLEEP = 131,
- SC_POISON = 132,
- SC_CURSE = 133,
- SC_SILENCE = 134,
- SC_CONFUSION = 135,
- SC_BLIND = 136,
-
- SC_SAFETYWALL = 140,
- SC_PNEUMA = 141,
- SC_WATERBALL = 142,
- SC_ANKLE = 143,
- SC_DANCING = 144,
- SC_KEEPING = 145,
- SC_BARRIER = 146,
-
- SC_MAGICROD = 149,
- SC_SIGHT = 150,
- SC_RUWACH = 151,
- SC_AUTOCOUNTER = 152,
- SC_VOLCANO = 153,
- SC_DELUGE = 154,
- SC_VIOLENTGALE = 155,
- SC_BLADESTOP_WAIT = 156,
- SC_BLADESTOP = 157,
- SC_EXTREMITYFIST = 158,
- SC_GRAFFITI = 159,
- SC_ENSEMBLE = 159,
-
- SC_LULLABY = 160,
- SC_RICHMANKIM = 161,
- SC_ETERNALCHAOS = 162,
- SC_DRUMBATTLE = 163,
- SC_NIBELUNGEN = 164,
- SC_ROKISWEIL = 165,
- SC_INTOABYSS = 166,
- SC_SIEGFRIED = 167,
- SC_DISSONANCE = 168,
- SC_WHISTLE = 169,
- SC_ASSNCROS = 170,
- SC_POEMBRAGI = 171,
- SC_APPLEIDUN = 172,
- SC_UGLYDANCE = 173,
- SC_HUMMING = 174,
- SC_DONTFORGETME = 175,
- SC_FORTUNE = 176,
- SC_SERVICE4U = 177,
- SC_FOGWALL = 178,
- SC_GOSPEL = 179,
- SC_SPIDERWEB = 180,
- SC_MEMORIZE = 181,
- SC_LANDPROTECTOR = 182,
- SC_ADAPTATION = 183,
- SC_CHASEWALK = 184,
- SC_ATKPOT = 185,
- SC_MATKPOT = 186,
- SC_WEDDING = 187,
- SC_NOCHAT = 188,
- SC_SPLASHER = 189,
- SC_SELFDESTRUCTION = 190,
- SC_MINDBREAKER = 191,
- SC_SPELLBREAKER = 192,
-
-// Added for Fate's spells
- SC_HIDE = 194, // Hide from `detect' magic
- SC_HALT_REGENERATE = 195, // Suspend regeneration
- SC_FLYING_BACKPACK = 196, // Flying backpack
- SC_MBARRIER = 197, // Magical barrier, magic resistance (val1 : power (%))
- SC_HASTE = 198, // `Haste' spell (val1 : power)
- SC_PHYS_SHIELD = 199, // `Protect' spell, reduce damage (val1: power)
-
- SC_DIVINA = SC_SILENCE,
-};
-extern int SkillStatusChangeTable[];
-
-enum
-{
- NV_EMOTE = 1,
- NV_TRADE,
- NV_PARTY,
-
- SM_SWORD,
- SM_TWOHAND,
- SM_RECOVERY,
- SM_BASH,
- SM_PROVOKE,
- SM_MAGNUM,
- SM_ENDURE,
-
- MG_SRECOVERY,
- MG_SIGHT,
- MG_NAPALMBEAT,
- MG_SAFETYWALL,
- MG_SOULSTRIKE,
- MG_COLDBOLT,
- MG_FROSTDIVER,
- MG_STONECURSE,
- MG_FIREBALL,
- MG_FIREWALL,
- MG_FIREBOLT,
- MG_LIGHTNINGBOLT,
- MG_THUNDERSTORM,
-
- AL_DP,
- AL_DEMONBANE,
- AL_RUWACH,
- AL_PNEUMA,
- AL_TELEPORT,
- AL_WARP,
- AL_HEAL,
- AL_INCAGI,
- AL_DECAGI,
- AL_HOLYWATER,
- AL_CRUCIS,
- AL_ANGELUS,
- AL_BLESSING,
- AL_CURE,
-
- MC_INCCARRY,
- MC_DISCOUNT,
- MC_OVERCHARGE,
- MC_PUSHCART,
- MC_IDENTIFY,
- MC_VENDING,
- MC_MAMMONITE,
-
- AC_OWL = 45,
- AC_VULTURE,
- AC_CONCENTRATION,
- AC_DOUBLE,
- AC_SHOWER,
-
- TF_DOUBLE,
- TF_MISS,
- TF_STEAL,
- TF_HIDING,
- TF_POISON,
- TF_DETOXIFY,
-
- ALL_RESURRECTION,
-
- KN_SPEARMASTERY,
- KN_PIERCE,
- KN_BRANDISHSPEAR,
- KN_SPEARSTAB,
- KN_SPEARBOOMERANG,
- KN_TWOHANDQUICKEN,
- KN_AUTOCOUNTER,
- KN_BOWLINGBASH,
- KN_RIDING,
- KN_CAVALIERMASTERY,
-
- PR_MACEMASTERY,
- PR_IMPOSITIO,
- PR_SUFFRAGIUM,
- PR_ASPERSIO,
- PR_BENEDICTIO,
- PR_SANCTUARY,
- PR_SLOWPOISON,
- PR_STRECOVERY,
- PR_KYRIE,
- PR_MAGNIFICAT,
- PR_GLORIA,
- PR_LEXDIVINA,
- PR_TURNUNDEAD,
- PR_LEXAETERNA,
- PR_MAGNUS,
-
- WZ_FIREPILLAR,
- WZ_SIGHTRASHER,
- WZ_FIREIVY,
- WZ_METEOR,
- WZ_JUPITEL,
- WZ_VERMILION,
- WZ_WATERBALL,
- WZ_ICEWALL,
- WZ_FROSTNOVA,
- WZ_STORMGUST,
- WZ_EARTHSPIKE,
- WZ_HEAVENDRIVE,
- WZ_QUAGMIRE,
- WZ_ESTIMATION,
-
- BS_IRON,
- BS_STEEL,
- BS_ENCHANTEDSTONE,
- BS_ORIDEOCON,
- BS_DAGGER,
- BS_SWORD,
- BS_TWOHANDSWORD,
- BS_AXE,
- BS_MACE,
- BS_KNUCKLE,
- BS_SPEAR,
- BS_HILTBINDING,
- BS_FINDINGORE,
- BS_WEAPONRESEARCH,
- BS_REPAIRWEAPON,
- BS_SKINTEMPER,
- BS_HAMMERFALL,
- BS_ADRENALINE,
- BS_WEAPONPERFECT,
- BS_OVERTHRUST,
- BS_MAXIMIZE,
-
- HT_SKIDTRAP,
- HT_LANDMINE,
- HT_ANKLESNARE,
- HT_SHOCKWAVE,
- HT_SANDMAN,
- HT_FLASHER,
- HT_FREEZINGTRAP,
- HT_BLASTMINE,
- HT_CLAYMORETRAP,
- HT_REMOVETRAP,
- HT_TALKIEBOX,
- HT_BEASTBANE,
- HT_FALCON,
- HT_STEELCROW,
- HT_BLITZBEAT,
- HT_DETECTING,
- HT_SPRINGTRAP,
-
- AS_RIGHT,
- AS_LEFT,
- AS_KATAR,
- AS_CLOAKING,
- AS_SONICBLOW,
- AS_GRIMTOOTH,
- AS_ENCHANTPOISON,
- AS_POISONREACT,
- AS_VENOMDUST,
- AS_SPLASHER,
-
- NV_FIRSTAID,
- NV_TRICKDEAD,
- SM_MOVINGRECOVERY,
- SM_FATALBLOW,
- SM_AUTOBERSERK,
- AC_MAKINGARROW,
- AC_CHARGEARROW,
- TF_SPRINKLESAND,
- TF_BACKSLIDING,
- TF_PICKSTONE,
- TF_THROWSTONE,
- MC_CARTREVOLUTION,
- MC_CHANGECART,
- MC_LOUD,
- AL_HOLYLIGHT,
- MG_ENERGYCOAT,
-
- NPC_PIERCINGATT,
- NPC_MENTALBREAKER,
- NPC_RANGEATTACK,
- NPC_ATTRICHANGE,
- NPC_CHANGEWATER,
- NPC_CHANGEGROUND,
- NPC_CHANGEFIRE,
- NPC_CHANGEWIND,
- NPC_CHANGEPOISON,
- NPC_CHANGEHOLY,
- NPC_CHANGEDARKNESS,
- NPC_CHANGETELEKINESIS,
- NPC_CRITICALSLASH,
- NPC_COMBOATTACK,
- NPC_GUIDEDATTACK,
- NPC_SELFDESTRUCTION,
- NPC_SPLASHATTACK,
- NPC_SUICIDE,
- NPC_POISON,
- NPC_BLINDATTACK,
- NPC_SILENCEATTACK,
- NPC_STUNATTACK,
- NPC_PETRIFYATTACK,
- NPC_CURSEATTACK,
- NPC_SLEEPATTACK,
- NPC_RANDOMATTACK,
- NPC_WATERATTACK,
- NPC_GROUNDATTACK,
- NPC_FIREATTACK,
- NPC_WINDATTACK,
- NPC_POISONATTACK,
- NPC_HOLYATTACK,
- NPC_DARKNESSATTACK,
- NPC_TELEKINESISATTACK,
- NPC_MAGICALATTACK,
- NPC_METAMORPHOSIS,
- NPC_PROVOCATION,
- NPC_SMOKING,
- NPC_SUMMONSLAVE,
- NPC_EMOTION,
- NPC_TRANSFORMATION,
- NPC_BLOODDRAIN,
- NPC_ENERGYDRAIN,
- NPC_KEEPING,
- NPC_DARKBREATH,
- NPC_DARKBLESSING,
- NPC_BARRIER,
- NPC_DEFENDER,
- NPC_LICK,
- NPC_HALLUCINATION,
- NPC_REBIRTH,
- NPC_SUMMONMONSTER,
-
- RG_SNATCHER,
- RG_STEALCOIN,
- RG_BACKSTAP,
- RG_TUNNELDRIVE,
- RG_RAID,
- RG_STRIPWEAPON,
- RG_STRIPSHIELD,
- RG_STRIPARMOR,
- RG_STRIPHELM,
- RG_INTIMIDATE,
- RG_GRAFFITI,
- RG_FLAGGRAFFITI,
- RG_CLEANER,
- RG_GANGSTER,
- RG_COMPULSION,
- RG_PLAGIARISM,
-
- AM_AXEMASTERY,
- AM_LEARNINGPOTION,
- AM_PHARMACY,
- AM_DEMONSTRATION,
- AM_ACIDTERROR,
- AM_POTIONPITCHER,
- AM_CANNIBALIZE,
- AM_SPHEREMINE,
- AM_CP_WEAPON,
- AM_CP_SHIELD,
- AM_CP_ARMOR,
- AM_CP_HELM,
- AM_BIOETHICS,
- AM_BIOTECHNOLOGY,
- AM_CREATECREATURE,
- AM_CULTIVATION,
- AM_FLAMECONTROL,
- AM_CALLHOMUN,
- AM_REST,
- AM_DRILLMASTER,
- AM_HEALHOMUN,
- AM_RESURRECTHOMUN,
-
- CR_TRUST,
- CR_AUTOGUARD,
- CR_SHIELDCHARGE,
- CR_SHIELDBOOMERANG,
- CR_REFLECTSHIELD,
- CR_HOLYCROSS,
- CR_GRANDCROSS,
- CR_DEVOTION,
- CR_PROVIDENCE,
- CR_DEFENDER,
- CR_SPEARQUICKEN,
-
- MO_IRONHAND,
- MO_SPIRITSRECOVERY,
- MO_CALLSPIRITS,
- MO_ABSORBSPIRITS,
- MO_TRIPLEATTACK,
- MO_BODYRELOCATION,
- MO_DODGE,
- MO_INVESTIGATE,
- MO_FINGEROFFENSIVE,
- MO_STEELBODY,
- MO_BLADESTOP,
- MO_EXPLOSIONSPIRITS,
- MO_EXTREMITYFIST,
- MO_CHAINCOMBO,
- MO_COMBOFINISH,
-
- SA_ADVANCEDBOOK,
- SA_CASTCANCEL,
- SA_MAGICROD,
- SA_SPELLBREAKER,
- SA_FREECAST,
- SA_AUTOSPELL,
- SA_FLAMELAUNCHER,
- SA_FROSTWEAPON,
- SA_LIGHTNINGLOADER,
- SA_SEISMICWEAPON,
- SA_DRAGONOLOGY,
- SA_VOLCANO,
- SA_DELUGE,
- SA_VIOLENTGALE,
- SA_LANDPROTECTOR,
- SA_DISPELL,
- SA_ABRACADABRA,
- SA_MONOCELL,
- SA_CLASSCHANGE,
- SA_SUMMONMONSTER,
- SA_REVERSEORCISH,
- SA_DEATH,
- SA_FORTUNE,
- SA_TAMINGMONSTER,
- SA_QUESTION,
- SA_GRAVITY,
- SA_LEVELUP,
- SA_INSTANTDEATH,
- SA_FULLRECOVERY,
- SA_COMA,
-
- BD_ADAPTATION,
- BD_ENCORE,
- BD_LULLABY,
- BD_RICHMANKIM,
- BD_ETERNALCHAOS,
- BD_DRUMBATTLEFIELD,
- BD_RINGNIBELUNGEN,
- BD_ROKISWEIL,
- BD_INTOABYSS,
- BD_SIEGFRIED,
- BD_RAGNAROK,
-
- BA_MUSICALLESSON,
- BA_MUSICALSTRIKE,
- BA_DISSONANCE,
- BA_FROSTJOKE,
- BA_WHISTLE,
- BA_ASSASSINCROSS,
- BA_POEMBRAGI,
- BA_APPLEIDUN,
-
- DC_DANCINGLESSON,
- DC_THROWARROW,
- DC_UGLYDANCE,
- DC_SCREAM,
- DC_HUMMING,
- DC_DONTFORGETME,
- DC_FORTUNEKISS,
- DC_SERVICEFORYOU,
-
- NPC_SELFDESTRUCTION2 = 333,
-
- WE_MALE = 334,
- WE_FEMALE,
- WE_CALLPARTNER,
-
- NPC_DARKCROSS = 338,
-
- TMW_SKILLPOOL = 339, // skill pool size
-
- TMW_MAGIC = 340,
- TMW_MAGIC_LIFE = 341,
- TMW_MAGIC_WAR = 342,
- TMW_MAGIC_TRANSMUTE = 343,
- TMW_MAGIC_NATURE = 344,
- TMW_MAGIC_ETHER = 345,
- TMW_MAGIC_DARK = 346,
- TMW_MAGIC_LIGHT = 347,
-
- TMW_BRAWLING = 350,
- TMW_LUCKY_COUNTER = 351,
- TMW_SPEED = 352,
- TMW_RESIST_POISON = 353,
- TMW_ASTRAL_SOUL = 354,
- TMW_RAGING = 355,
-
- LK_AURABLADE = 356,
- LK_PARRYING,
- LK_CONCENTRATION,
- LK_TENSIONRELAX,
- LK_BERSERK,
- LK_FURY,
- HP_ASSUMPTIO,
- HP_BASILICA,
- HP_MEDITATIO,
- HW_SOULDRAIN,
- HW_MAGICCRASHER,
- HW_MAGICPOWER,
- PA_PRESSURE,
- PA_SACRIFICE,
- PA_GOSPEL,
- CH_PALMSTRIKE,
- CH_TIGERFIST,
- CH_CHAINCRUSH,
- PF_HPCONVERSION,
- PF_SOULCHANGE,
- PF_SOULBURN,
- ASC_KATAR,
- ASC_HALLUCINATION,
- ASC_EDP,
- ASC_BREAKER,
- SN_SIGHT,
- SN_FALCONASSAULT,
- SN_SHARPSHOOTING,
- SN_WINDWALK,
- WS_MELTDOWN,
- WS_CREATECOIN,
- WS_CREATENUGGET,
- WS_CARTBOOST,
- WS_SYSTEMCREATE,
- ST_CHASEWALK,
- ST_REJECTSWORD,
- ST_STEALBACKPACK,
- CR_ALCHEMY,
- CR_SYNTHESISPOTION,
- CG_ARROWVULCAN,
- CG_MOONLIT,
- CG_MARIONETTE,
- LK_SPIRALPIERCE,
- LK_HEADCRUSH,
- LK_JOINTBEAT,
- HW_NAPALMVULCAN,
- CH_SOULCOLLECT,
- PF_MINDBREAKER,
- PF_MEMORIZE,
- PF_FOGWALL,
- PF_SPIDERWEB,
- ASC_METEORASSAULT,
- ASC_CDP,
- WE_BABY,
- WE_CALLPARENT,
- WE_CALLBABY,
- TK_RUN,
- TK_READYSTORM,
- TK_STORMKICK,
- TK_READYDOWN,
- TK_DOWNKICK,
- TK_READYTURN,
- TK_TURNKICK,
- TK_READYCOUNTER,
- TK_COUNTER,
- TK_DODGE,
- TK_JUMPKICK,
- TK_HPTIME,
- TK_SPTIME,
- TK_POWER,
- TK_SEVENWIND,
- TK_HIGHJUMP,
- SG_FEEL,
- SG_SUN_WARM,
- SG_MOON_WARM,
- SG_STAR_WARM,
- SG_SUN_COMFORT,
- SG_MOON_COMFORT,
- SG_STAR_COMFORT,
- SG_HATE,
- SG_SUN_ANGER,
- SG_MOON_ANGER,
- SG_STAR_ANGER,
- SG_SUN_BLESS,
- SG_MOON_BLESS,
- SG_STAR_BLESS,
- SG_DEVIL,
- SG_FRIEND,
- SG_KNOWLEDGE,
- SG_FUSION,
- SL_ALCHEMIST,
- AM_BERSERKPITCHER,
- SL_MONK,
- SL_STAR,
- SL_SAGE,
- SL_CRUSADER,
- SL_SUPERNOVICE,
- SL_KNIGHT,
- SL_WIZARD,
- SL_PRIEST,
- SL_BARDDANCER,
- SL_ROGUE,
- SL_ASSASIN,
- SL_BLACKSMITH,
- BS_ADRENALINE2,
- SL_HUNTER,
- SL_SOULLINKER,
- SL_KAIZEL,
- SL_KAAHI,
- SL_KAUPE,
- SL_KAITE,
- SL_KAINA,
- SL_STIN,
- SL_STUN,
- SL_SMA,
- SL_SWOO,
- SL_SKE,
- SL_SKA,
-
- GD_APPROVAL = 10000,
- GD_KAFRACONTACT,
- GD_GUARDIANRESEARCH,
- GD_CHARISMA,
- GD_EXTENSION,
-};
+extern earray<StatusChange, SkillID, MAX_SKILL_DB> SkillStatusChangeTable;
// [Fate] Skill pools API
@@ -871,22 +192,36 @@ enum
// Max. # of skills that may be classified as pool skills in db/skill_db.txt
#define MAX_POOL_SKILLS 128
-extern int skill_pool_skills[MAX_POOL_SKILLS]; // All pool skills
+extern SkillID skill_pool_skills[MAX_POOL_SKILLS]; // All pool skills
extern int skill_pool_skills_size; // Number of entries in skill_pool_skills
-int skill_pool(struct map_session_data *sd, int *skills); // Yields all active skills in the skill pool; no more than MAX_SKILL_POOL. Return is number of skills.
+// Yields all active skills in the skill pool; no more than MAX_SKILL_POOL. Return is number of skills.
+int skill_pool(struct map_session_data *sd, SkillID *skills);
int skill_pool_size(struct map_session_data *sd);
int skill_pool_max(struct map_session_data *sd); // Max. number of pool skills
void skill_pool_empty(struct map_session_data *sd); // Deactivate all pool skills
-int skill_pool_activate(struct map_session_data *sd, int skill); // Skill into skill pool. Return is zero iff okay.
-int skill_pool_is_activated(struct map_session_data *sd, int skill); // Skill into skill pool. Return is zero when activated.
-int skill_pool_deactivate(struct map_session_data *sd, int skill); // Skill out of skill pool. Return is zero iff okay.
-const char *skill_name(int skill); // Yield configurable skill name
-int skill_stat(int skill); // Yields the stat associated with a skill. Returns zero if none, or SP_STR, SP_VIT, ... otherwise
-int skill_power(struct map_session_data *sd, int skill); // Yields the power of a skill. This is zero if the skill is unknown or if it's a pool skill that is outside of the skill pool,
- // otherwise a value from 0 to 255 (with 200 being the `normal maximum')
-int skill_power_bl(struct block_list *bl, int skill); // Yields the power of a skill. This is zero if the skill is unknown or if it's a pool skill that is outside of the skill pool,
- // otherwise a value from 0 to 255 (with 200 being the `normal maximum')
-
-void skill_pool_register(int id); // [Fate] Remember that a certain skill ID belongs to a pool skill
+// Skill into skill pool. Return is zero iff okay.
+int skill_pool_activate(struct map_session_data *sd, SkillID skill);
+// Skill into skill pool. Return is zero when activated.
+int skill_pool_is_activated(struct map_session_data *sd, SkillID skill);
+// Skill out of skill pool. Return is zero iff okay.
+int skill_pool_deactivate(struct map_session_data *sd, SkillID skill);
+// Yield configurable skill name
+inline
+const char *skill_name(SkillID skill)
+{
+ return skill_lookup_by_id(skill).desc;
+}
+// Yields the stat associated with a skill.
+// Returns zero if none, or SP_STR, SP_VIT, ... otherwise
+int skill_stat(SkillID skill);
+// Yields the power of a skill.
+// This is zero if the skill is unknown
+// or if it's a pool skill that is outside of the skill pool,
+// otherwise a value from 0 to 255 (with 200 being the `normal maximum')
+int skill_power(struct map_session_data *sd, SkillID skill);
+int skill_power_bl(struct block_list *bl, SkillID skill);
+
+// [Fate] Remember that a certain skill ID belongs to a pool skill
+void skill_pool_register(SkillID id);
#endif
diff --git a/src/map/skill.t.hpp b/src/map/skill.t.hpp
new file mode 100644
index 0000000..0175985
--- /dev/null
+++ b/src/map/skill.t.hpp
@@ -0,0 +1,1417 @@
+#ifndef SKILL_T_HPP
+#define SKILL_T_HPP
+
+// only ST_NONE is actually used - TODO remove
+enum class SkillState
+{
+ ST_NONE,
+#define ST_NONE SkillState::ST_NONE
+ ST_HIDING,
+#define ST_HIDING SkillState::ST_HIDING
+ ST_CLOAKING,
+#define ST_CLOAKING SkillState::ST_CLOAKING
+ ST_HIDDEN,
+#define ST_HIDDEN SkillState::ST_HIDDEN
+ ST_RIDING,
+#define ST_RIDING SkillState::ST_RIDING
+ ST_FALCON,
+#define ST_FALCON SkillState::ST_FALCON
+ ST_CART,
+#define ST_CART SkillState::ST_CART
+ ST_SHIELD,
+#define ST_SHIELD SkillState::ST_SHIELD
+ ST_SIGHT,
+#define ST_SIGHT SkillState::ST_SIGHT
+ ST_EXPLOSIONSPIRITS,
+#define ST_EXPLOSIONSPIRITS SkillState::ST_EXPLOSIONSPIRITS
+ ST_RECOV_WEIGHT_RATE,
+#define ST_RECOV_WEIGHT_RATE SkillState::ST_RECOV_WEIGHT_RATE
+ ST_MOVE_ENABLE,
+#define ST_MOVE_ENABLE SkillState::ST_MOVE_ENABLE
+ ST_WATER,
+#define ST_WATER SkillState::ST_WATER
+};
+
+// TODO remove most of these as their corresponding SkillIDs get deleted.
+enum class StatusChange : uint16_t
+{
+ // indices into (map_session_data).status_change
+ SC_SENDMAX = 256,
+#define SC_SENDMAX StatusChange::SC_SENDMAX
+
+ // sometimes means "none", sometimes not
+ NEGATIVE1 = 0xffff,
+ ANY_BAD = NEGATIVE1,
+
+ // these ones are used by clif_status_change,
+ // e.g. by the magic system
+ ZERO = 0,
+ ATTACK_ICON_GENERIC = 2000,
+ ATTACK_ICON_SHEARING = 2001,
+ CART = 0x0c,
+ CLIF_OPTION_SC_INVISIBILITY = 0x1000,
+#define CLIF_OPTION_SC_INVISIBILITY StatusChange::CLIF_OPTION_SC_INVISIBILITY
+ CLIF_OPTION_SC_SCRIBE = 0x1001,
+#define CLIF_OPTION_SC_SCRIBE StatusChange::CLIF_OPTION_SC_SCRIBE
+
+ // the rest are the normal effects
+ SC_PROVOKE = 0,
+#define SC_PROVOKE StatusChange::SC_PROVOKE
+ SC_ENDURE = 1,
+#define SC_ENDURE StatusChange::SC_ENDURE
+ SC_TWOHANDQUICKEN = 2,
+#define SC_TWOHANDQUICKEN StatusChange::SC_TWOHANDQUICKEN
+ SC_CONCENTRATE = 3,
+#define SC_CONCENTRATE StatusChange::SC_CONCENTRATE
+ SC_HIDING = 4,
+#define SC_HIDING StatusChange::SC_HIDING
+ SC_CLOAKING = 5,
+#define SC_CLOAKING StatusChange::SC_CLOAKING
+ SC_ENCPOISON = 6,
+#define SC_ENCPOISON StatusChange::SC_ENCPOISON
+ SC_POISONREACT = 7,
+#define SC_POISONREACT StatusChange::SC_POISONREACT
+ SC_QUAGMIRE = 8,
+#define SC_QUAGMIRE StatusChange::SC_QUAGMIRE
+ SC_ANGELUS = 9,
+#define SC_ANGELUS StatusChange::SC_ANGELUS
+ SC_BLESSING = 10,
+#define SC_BLESSING StatusChange::SC_BLESSING
+ SC_SIGNUMCRUCIS = 11,
+#define SC_SIGNUMCRUCIS StatusChange::SC_SIGNUMCRUCIS
+ SC_INCREASEAGI = 12,
+#define SC_INCREASEAGI StatusChange::SC_INCREASEAGI
+ SC_DECREASEAGI = 13,
+#define SC_DECREASEAGI StatusChange::SC_DECREASEAGI
+ SC_SLOWPOISON = 14, //
+#define SC_SLOWPOISON StatusChange::SC_SLOWPOISON
+ SC_IMPOSITIO = 15,
+#define SC_IMPOSITIO StatusChange::SC_IMPOSITIO
+ SC_SUFFRAGIUM = 16,
+#define SC_SUFFRAGIUM StatusChange::SC_SUFFRAGIUM
+ SC_ASPERSIO = 17,
+#define SC_ASPERSIO StatusChange::SC_ASPERSIO
+ SC_BENEDICTIO = 18,
+#define SC_BENEDICTIO StatusChange::SC_BENEDICTIO
+ SC_KYRIE = 19,
+#define SC_KYRIE StatusChange::SC_KYRIE
+ SC_MAGNIFICAT = 20,
+#define SC_MAGNIFICAT StatusChange::SC_MAGNIFICAT
+ SC_GLORIA = 21,
+#define SC_GLORIA StatusChange::SC_GLORIA
+ SC_AETERNA = 22,
+#define SC_AETERNA StatusChange::SC_AETERNA
+ SC_ADRENALINE = 23,
+#define SC_ADRENALINE StatusChange::SC_ADRENALINE
+ SC_WEAPONPERFECTION = 24,
+#define SC_WEAPONPERFECTION StatusChange::SC_WEAPONPERFECTION
+ SC_OVERTHRUST = 25,
+#define SC_OVERTHRUST StatusChange::SC_OVERTHRUST
+ SC_MAXIMIZEPOWER = 26,
+#define SC_MAXIMIZEPOWER StatusChange::SC_MAXIMIZEPOWER
+ SC_RIDING = 27,
+#define SC_RIDING StatusChange::SC_RIDING
+ SC_FALCON = 28,
+#define SC_FALCON StatusChange::SC_FALCON
+ SC_TRICKDEAD = 29,
+#define SC_TRICKDEAD StatusChange::SC_TRICKDEAD
+ SC_LOUD = 30,
+#define SC_LOUD StatusChange::SC_LOUD
+ SC_ENERGYCOAT = 31,
+#define SC_ENERGYCOAT StatusChange::SC_ENERGYCOAT
+ SC_BROKNARMOR = 32,
+#define SC_BROKNARMOR StatusChange::SC_BROKNARMOR
+ SC_BROKNWEAPON = 33,
+#define SC_BROKNWEAPON StatusChange::SC_BROKNWEAPON
+ SC_HALLUCINATION = 34,
+#define SC_HALLUCINATION StatusChange::SC_HALLUCINATION
+ SC_WEIGHT50 = 35,
+#define SC_WEIGHT50 StatusChange::SC_WEIGHT50
+ SC_WEIGHT90 = 36,
+#define SC_WEIGHT90 StatusChange::SC_WEIGHT90
+ SC_SPEEDPOTION0 = 37, //
+#define SC_SPEEDPOTION0 StatusChange::SC_SPEEDPOTION0
+ SC_SPEEDPOTION1 = 38,
+#define SC_SPEEDPOTION1 StatusChange::SC_SPEEDPOTION1
+ SC_SPEEDPOTION2 = 39,
+#define SC_SPEEDPOTION2 StatusChange::SC_SPEEDPOTION2
+
+ SC_STRIPWEAPON = 50,
+#define SC_STRIPWEAPON StatusChange::SC_STRIPWEAPON
+ SC_STRIPSHIELD = 51,
+#define SC_STRIPSHIELD StatusChange::SC_STRIPSHIELD
+ SC_STRIPARMOR = 52,
+#define SC_STRIPARMOR StatusChange::SC_STRIPARMOR
+ SC_STRIPHELM = 53,
+#define SC_STRIPHELM StatusChange::SC_STRIPHELM
+ SC_CP_WEAPON = 54,
+#define SC_CP_WEAPON StatusChange::SC_CP_WEAPON
+ SC_CP_SHIELD = 55,
+#define SC_CP_SHIELD StatusChange::SC_CP_SHIELD
+ SC_CP_ARMOR = 56,
+#define SC_CP_ARMOR StatusChange::SC_CP_ARMOR
+ SC_CP_HELM = 57,
+#define SC_CP_HELM StatusChange::SC_CP_HELM
+ SC_AUTOGUARD = 58,
+#define SC_AUTOGUARD StatusChange::SC_AUTOGUARD
+ SC_REFLECTSHIELD = 59,
+#define SC_REFLECTSHIELD StatusChange::SC_REFLECTSHIELD
+ SC_DEVOTION = 60,
+#define SC_DEVOTION StatusChange::SC_DEVOTION
+ SC_PROVIDENCE = 61,
+#define SC_PROVIDENCE StatusChange::SC_PROVIDENCE
+ SC_DEFENDER = 62,
+#define SC_DEFENDER StatusChange::SC_DEFENDER
+ SC_AUTOSPELL = 65,
+#define SC_AUTOSPELL StatusChange::SC_AUTOSPELL
+ SC_SPEARSQUICKEN = 68,
+#define SC_SPEARSQUICKEN StatusChange::SC_SPEARSQUICKEN
+
+ SC_HEALING = 70, //
+#define SC_HEALING StatusChange::SC_HEALING
+
+ SC_SIGHTTRASHER = 73,
+#define SC_SIGHTTRASHER StatusChange::SC_SIGHTTRASHER
+
+ SC_EXPLOSIONSPIRITS = 86,
+#define SC_EXPLOSIONSPIRITS StatusChange::SC_EXPLOSIONSPIRITS
+ SC_STEELBODY = 87,
+#define SC_STEELBODY StatusChange::SC_STEELBODY
+
+ SC_COMBO = 89,
+#define SC_COMBO StatusChange::SC_COMBO
+ SC_FLAMELAUNCHER = 90,
+#define SC_FLAMELAUNCHER StatusChange::SC_FLAMELAUNCHER
+ SC_FROSTWEAPON = 91,
+#define SC_FROSTWEAPON StatusChange::SC_FROSTWEAPON
+ SC_LIGHTNINGLOADER = 92,
+#define SC_LIGHTNINGLOADER StatusChange::SC_LIGHTNINGLOADER
+ SC_SEISMICWEAPON = 93,
+#define SC_SEISMICWEAPON StatusChange::SC_SEISMICWEAPON
+
+ SC_AURABLADE = 103,
+#define SC_AURABLADE StatusChange::SC_AURABLADE
+ SC_PARRYING = 104,
+#define SC_PARRYING StatusChange::SC_PARRYING
+ SC_CONCENTRATION = 105,
+#define SC_CONCENTRATION StatusChange::SC_CONCENTRATION
+ SC_TENSIONRELAX = 106,
+#define SC_TENSIONRELAX StatusChange::SC_TENSIONRELAX
+ SC_BERSERK = 107,
+#define SC_BERSERK StatusChange::SC_BERSERK
+
+ SC_ASSUMPTIO = 110,
+#define SC_ASSUMPTIO StatusChange::SC_ASSUMPTIO
+
+ SC_MAGICPOWER = 113,
+#define SC_MAGICPOWER StatusChange::SC_MAGICPOWER
+
+ SC_TRUESIGHT = 115,
+#define SC_TRUESIGHT StatusChange::SC_TRUESIGHT
+ SC_WINDWALK = 116,
+#define SC_WINDWALK StatusChange::SC_WINDWALK
+ SC_MELTDOWN = 117,
+#define SC_MELTDOWN StatusChange::SC_MELTDOWN
+ SC_CARTBOOST = 118,
+#define SC_CARTBOOST StatusChange::SC_CARTBOOST
+
+ SC_REJECTSWORD = 120,
+#define SC_REJECTSWORD StatusChange::SC_REJECTSWORD
+ SC_MARIONETTE = 121,
+#define SC_MARIONETTE StatusChange::SC_MARIONETTE
+
+ SC_HEADCRUSH = 124,
+#define SC_HEADCRUSH StatusChange::SC_HEADCRUSH
+ SC_JOINTBEAT = 125,
+#define SC_JOINTBEAT StatusChange::SC_JOINTBEAT
+ SC_BASILICA = SC_JOINTBEAT,
+#define SC_BASILICA StatusChange::SC_BASILICA
+
+ SC_STONE = 128,
+#define SC_STONE StatusChange::SC_STONE
+ SC_FREEZE = 129,
+#define SC_FREEZE StatusChange::SC_FREEZE
+ SC_STAN = 130,
+#define SC_STAN StatusChange::SC_STAN
+ SC_SLEEP = 131,
+#define SC_SLEEP StatusChange::SC_SLEEP
+ SC_POISON = 132, //
+#define SC_POISON StatusChange::SC_POISON
+ SC_CURSE = 133,
+#define SC_CURSE StatusChange::SC_CURSE
+ SC_SILENCE = 134,
+#define SC_SILENCE StatusChange::SC_SILENCE
+ SC_DIVINA = SC_SILENCE,
+#define SC_DIVINA StatusChange::SC_DIVINA
+ SC_CONFUSION = 135,
+#define SC_CONFUSION StatusChange::SC_CONFUSION
+ SC_BLIND = 136,
+#define SC_BLIND StatusChange::SC_BLIND
+
+ SC_SAFETYWALL = 140,
+#define SC_SAFETYWALL StatusChange::SC_SAFETYWALL
+ SC_PNEUMA = 141,
+#define SC_PNEUMA StatusChange::SC_PNEUMA
+ SC_WATERBALL = 142,
+#define SC_WATERBALL StatusChange::SC_WATERBALL
+ SC_ANKLE = 143,
+#define SC_ANKLE StatusChange::SC_ANKLE
+ SC_DANCING = 144,
+#define SC_DANCING StatusChange::SC_DANCING
+ SC_KEEPING = 145,
+#define SC_KEEPING StatusChange::SC_KEEPING
+ SC_BARRIER = 146,
+#define SC_BARRIER StatusChange::SC_BARRIER
+
+ SC_MAGICROD = 149,
+#define SC_MAGICROD StatusChange::SC_MAGICROD
+ SC_SIGHT = 150,
+#define SC_SIGHT StatusChange::SC_SIGHT
+ SC_RUWACH = 151,
+#define SC_RUWACH StatusChange::SC_RUWACH
+ SC_AUTOCOUNTER = 152,
+#define SC_AUTOCOUNTER StatusChange::SC_AUTOCOUNTER
+ SC_VOLCANO = 153,
+#define SC_VOLCANO StatusChange::SC_VOLCANO
+ SC_DELUGE = 154,
+#define SC_DELUGE StatusChange::SC_DELUGE
+ SC_VIOLENTGALE = 155,
+#define SC_VIOLENTGALE StatusChange::SC_VIOLENTGALE
+ SC_BLADESTOP_WAIT = 156,
+#define SC_BLADESTOP_WAIT StatusChange::SC_BLADESTOP_WAIT
+ SC_BLADESTOP = 157,
+#define SC_BLADESTOP StatusChange::SC_BLADESTOP
+ SC_EXTREMITYFIST = 158,
+#define SC_EXTREMITYFIST StatusChange::SC_EXTREMITYFIST
+ SC_GRAFFITI = 159,
+#define SC_GRAFFITI StatusChange::SC_GRAFFITI
+ SC_ENSEMBLE = 159,
+#define SC_ENSEMBLE StatusChange::SC_ENSEMBLE
+
+ SC_LULLABY = 160,
+#define SC_LULLABY StatusChange::SC_LULLABY
+ SC_RICHMANKIM = 161,
+#define SC_RICHMANKIM StatusChange::SC_RICHMANKIM
+ SC_ETERNALCHAOS = 162,
+#define SC_ETERNALCHAOS StatusChange::SC_ETERNALCHAOS
+ SC_DRUMBATTLE = 163,
+#define SC_DRUMBATTLE StatusChange::SC_DRUMBATTLE
+ SC_NIBELUNGEN = 164,
+#define SC_NIBELUNGEN StatusChange::SC_NIBELUNGEN
+ SC_ROKISWEIL = 165,
+#define SC_ROKISWEIL StatusChange::SC_ROKISWEIL
+ SC_INTOABYSS = 166,
+#define SC_INTOABYSS StatusChange::SC_INTOABYSS
+ SC_SIEGFRIED = 167,
+#define SC_SIEGFRIED StatusChange::SC_SIEGFRIED
+ SC_DISSONANCE = 168,
+#define SC_DISSONANCE StatusChange::SC_DISSONANCE
+ SC_WHISTLE = 169,
+#define SC_WHISTLE StatusChange::SC_WHISTLE
+ SC_ASSNCROS = 170,
+#define SC_ASSNCROS StatusChange::SC_ASSNCROS
+ SC_POEMBRAGI = 171,
+#define SC_POEMBRAGI StatusChange::SC_POEMBRAGI
+ SC_APPLEIDUN = 172,
+#define SC_APPLEIDUN StatusChange::SC_APPLEIDUN
+ SC_UGLYDANCE = 173,
+#define SC_UGLYDANCE StatusChange::SC_UGLYDANCE
+ SC_HUMMING = 174,
+#define SC_HUMMING StatusChange::SC_HUMMING
+ SC_DONTFORGETME = 175,
+#define SC_DONTFORGETME StatusChange::SC_DONTFORGETME
+ SC_FORTUNE = 176,
+#define SC_FORTUNE StatusChange::SC_FORTUNE
+ SC_SERVICE4U = 177,
+#define SC_SERVICE4U StatusChange::SC_SERVICE4U
+ SC_FOGWALL = 178,
+#define SC_FOGWALL StatusChange::SC_FOGWALL
+ SC_GOSPEL = 179,
+#define SC_GOSPEL StatusChange::SC_GOSPEL
+ SC_SPIDERWEB = 180,
+#define SC_SPIDERWEB StatusChange::SC_SPIDERWEB
+ SC_MEMORIZE = 181,
+#define SC_MEMORIZE StatusChange::SC_MEMORIZE
+ SC_LANDPROTECTOR = 182,
+#define SC_LANDPROTECTOR StatusChange::SC_LANDPROTECTOR
+ SC_ADAPTATION = 183,
+#define SC_ADAPTATION StatusChange::SC_ADAPTATION
+ SC_CHASEWALK = 184,
+#define SC_CHASEWALK StatusChange::SC_CHASEWALK
+ SC_ATKPOT = 185, //
+#define SC_ATKPOT StatusChange::SC_ATKPOT
+ SC_MATKPOT = 186,
+#define SC_MATKPOT StatusChange::SC_MATKPOT
+ SC_WEDDING = 187,
+#define SC_WEDDING StatusChange::SC_WEDDING
+ SC_NOCHAT = 188,
+#define SC_NOCHAT StatusChange::SC_NOCHAT
+ SC_SPLASHER = 189,
+#define SC_SPLASHER StatusChange::SC_SPLASHER
+ SC_SELFDESTRUCTION = 190,
+#define SC_SELFDESTRUCTION StatusChange::SC_SELFDESTRUCTION
+ SC_MINDBREAKER = 191,
+#define SC_MINDBREAKER StatusChange::SC_MINDBREAKER
+ SC_SPELLBREAKER = 192,
+#define SC_SPELLBREAKER StatusChange::SC_SPELLBREAKER
+
+// Added for Fate's spells
+ SC_HIDE = 194, // Hide from `detect' magic (PCs only)
+#define SC_HIDE StatusChange::SC_HIDE
+ SC_SHEARED = 194, // Has been sheared (mobs only)
+#define SC_SHEARED StatusChange::SC_SHEARED
+ SC_HALT_REGENERATE = 195, // Suspend regeneration
+#define SC_HALT_REGENERATE StatusChange::SC_HALT_REGENERATE
+ SC_FLYING_BACKPACK = 196, // Flying backpack
+#define SC_FLYING_BACKPACK StatusChange::SC_FLYING_BACKPACK
+ SC_MBARRIER = 197, // Magical barrier, magic resistance (val1 : power (%))
+#define SC_MBARRIER StatusChange::SC_MBARRIER
+ SC_HASTE = 198, // `Haste' spell (val1 : power)
+#define SC_HASTE StatusChange::SC_HASTE
+ SC_PHYS_SHIELD = 199, // `Protect' spell, reduce damage (val1: power)
+#define SC_PHYS_SHIELD StatusChange::SC_PHYS_SHIELD
+ MAX_STATUSCHANGE = 200,
+#define MAX_STATUSCHANGE StatusChange::MAX_STATUSCHANGE
+};
+
+constexpr
+StatusChange MAJOR_STATUS_EFFECTS[] =
+{
+ SC_STONE,
+ SC_FREEZE,
+ SC_STAN,
+ SC_SLEEP,
+ SC_POISON,
+ SC_CURSE,
+ SC_SILENCE,
+ SC_CONFUSION,
+ SC_BLIND,
+};
+
+constexpr
+StatusChange MAJOR_STATUS_EFFECTS_1[] =
+{
+ SC_STONE,
+ SC_FREEZE,
+ SC_STAN,
+ SC_SLEEP,
+};
+
+// needed to work around some subtractative indexing
+// I think it *might* be able to be totally removed.
+enum class BadSC
+{
+ STONE = 0,
+ FREEZE = 1,
+ STAN = 2,
+ SLEEP = 3,
+ POISON = 4,
+ CURSE = 5,
+ SILENCE = 6,
+ CONFUSION = 7,
+ BLIND = 8,
+
+ COUNT = 9, // formerly 10,
+};
+
+constexpr
+StatusChange BadSC_to_SC(BadSC bsc)
+{
+ return StatusChange(uint16_t(SC_STONE) + int(bsc));
+}
+
+constexpr
+BadSC BadSC_from_SC(StatusChange sc)
+{
+ return BadSC(uint16_t(sc) - uint16_t(SC_STONE));
+}
+
+// TODO remove most of these
+enum class SkillID : uint16_t
+{
+ // TODO: Remove these!
+ NEGATIVE = 0xffff,
+ ZERO = 0x0000,
+ ONE = 0x0001,
+
+ // Basic skills.
+ // These should probably be made unconditional.
+ NV_EMOTE = 1, //
+#define NV_EMOTE SkillID::NV_EMOTE
+ NV_TRADE = 2, //
+#define NV_TRADE SkillID::NV_TRADE
+ NV_PARTY = 3, //
+#define NV_PARTY SkillID::NV_PARTY
+
+ SM_SWORD = 4, //
+#define SM_SWORD SkillID::SM_SWORD
+ SM_TWOHAND = 5,
+#define SM_TWOHAND SkillID::SM_TWOHAND
+ SM_RECOVERY = 6, //
+#define SM_RECOVERY SkillID::SM_RECOVERY
+ SM_BASH = 7,
+#define SM_BASH SkillID::SM_BASH
+ SM_PROVOKE = 8,
+#define SM_PROVOKE SkillID::SM_PROVOKE
+ SM_MAGNUM = 9,
+#define SM_MAGNUM SkillID::SM_MAGNUM
+ SM_ENDURE = 10,
+#define SM_ENDURE SkillID::SM_ENDURE
+
+ MG_SRECOVERY = 11, //
+#define MG_SRECOVERY SkillID::MG_SRECOVERY
+ MG_SIGHT = 12,
+#define MG_SIGHT SkillID::MG_SIGHT
+ MG_NAPALMBEAT = 13,
+#define MG_NAPALMBEAT SkillID::MG_NAPALMBEAT
+ MG_SAFETYWALL = 14,
+#define MG_SAFETYWALL SkillID::MG_SAFETYWALL
+ MG_SOULSTRIKE = 15,
+#define MG_SOULSTRIKE SkillID::MG_SOULSTRIKE
+ MG_COLDBOLT = 16,
+#define MG_COLDBOLT SkillID::MG_COLDBOLT
+ MG_FROSTDIVER = 17,
+#define MG_FROSTDIVER SkillID::MG_FROSTDIVER
+ MG_STONECURSE = 18,
+#define MG_STONECURSE SkillID::MG_STONECURSE
+ MG_FIREBALL = 19,
+#define MG_FIREBALL SkillID::MG_FIREBALL
+ MG_FIREWALL = 20,
+#define MG_FIREWALL SkillID::MG_FIREWALL
+ MG_FIREBOLT = 21,
+#define MG_FIREBOLT SkillID::MG_FIREBOLT
+ MG_LIGHTNINGBOLT = 22,
+#define MG_LIGHTNINGBOLT SkillID::MG_LIGHTNINGBOLT
+ MG_THUNDERSTORM = 23,
+#define MG_THUNDERSTORM SkillID::MG_THUNDERSTORM
+
+ AL_DP = 24,
+#define AL_DP SkillID::AL_DP
+ AL_DEMONBANE = 25,
+#define AL_DEMONBANE SkillID::AL_DEMONBANE
+ AL_RUWACH = 26,
+#define AL_RUWACH SkillID::AL_RUWACH
+ AL_PNEUMA = 27,
+#define AL_PNEUMA SkillID::AL_PNEUMA
+ AL_TELEPORT = 28, //
+#define AL_TELEPORT SkillID::AL_TELEPORT
+ AL_WARP = 29,
+#define AL_WARP SkillID::AL_WARP
+ AL_HEAL = 30, //
+#define AL_HEAL SkillID::AL_HEAL
+ AL_INCAGI = 31,
+#define AL_INCAGI SkillID::AL_INCAGI
+ AL_DECAGI = 32,
+#define AL_DECAGI SkillID::AL_DECAGI
+ AL_HOLYWATER = 33,
+#define AL_HOLYWATER SkillID::AL_HOLYWATER
+ AL_CRUCIS = 34,
+#define AL_CRUCIS SkillID::AL_CRUCIS
+ AL_ANGELUS = 35,
+#define AL_ANGELUS SkillID::AL_ANGELUS
+ AL_BLESSING = 36,
+#define AL_BLESSING SkillID::AL_BLESSING
+ AL_CURE = 37,
+#define AL_CURE SkillID::AL_CURE
+
+ MC_INCCARRY = 38, //
+#define MC_INCCARRY SkillID::MC_INCCARRY
+ MC_DISCOUNT = 39, //
+#define MC_DISCOUNT SkillID::MC_DISCOUNT
+ MC_OVERCHARGE = 40, //
+#define MC_OVERCHARGE SkillID::MC_OVERCHARGE
+ MC_PUSHCART = 41,
+#define MC_PUSHCART SkillID::MC_PUSHCART
+ MC_IDENTIFY = 42,
+#define MC_IDENTIFY SkillID::MC_IDENTIFY
+ MC_VENDING = 43,
+#define MC_VENDING SkillID::MC_VENDING
+ MC_MAMMONITE = 44,
+#define MC_MAMMONITE SkillID::MC_MAMMONITE
+
+ AC_OWL = 45, //
+#define AC_OWL SkillID::AC_OWL
+ AC_VULTURE = 46,
+#define AC_VULTURE SkillID::AC_VULTURE
+ AC_CONCENTRATION = 47,
+#define AC_CONCENTRATION SkillID::AC_CONCENTRATION
+ AC_DOUBLE = 48,
+#define AC_DOUBLE SkillID::AC_DOUBLE
+ AC_SHOWER = 49,
+#define AC_SHOWER SkillID::AC_SHOWER
+
+ TF_DOUBLE = 50, //
+#define TF_DOUBLE SkillID::TF_DOUBLE
+ TF_MISS = 51, //
+#define TF_MISS SkillID::TF_MISS
+ TF_STEAL = 52,
+#define TF_STEAL SkillID::TF_STEAL
+ TF_HIDING = 53,
+#define TF_HIDING SkillID::TF_HIDING
+ TF_POISON = 54, //
+#define TF_POISON SkillID::TF_POISON
+ TF_DETOXIFY = 55,
+#define TF_DETOXIFY SkillID::TF_DETOXIFY
+
+ ALL_RESURRECTION = 56,
+#define ALL_RESURRECTION SkillID::ALL_RESURRECTION
+
+ KN_SPEARMASTERY = 57,
+#define KN_SPEARMASTERY SkillID::KN_SPEARMASTERY
+ KN_PIERCE = 58,
+#define KN_PIERCE SkillID::KN_PIERCE
+ KN_BRANDISHSPEAR = 59,
+#define KN_BRANDISHSPEAR SkillID::KN_BRANDISHSPEAR
+ KN_SPEARSTAB = 60,
+#define KN_SPEARSTAB SkillID::KN_SPEARSTAB
+ KN_SPEARBOOMERANG = 61,
+#define KN_SPEARBOOMERANG SkillID::KN_SPEARBOOMERANG
+ KN_TWOHANDQUICKEN = 62,
+#define KN_TWOHANDQUICKEN SkillID::KN_TWOHANDQUICKEN
+ KN_AUTOCOUNTER = 63,
+#define KN_AUTOCOUNTER SkillID::KN_AUTOCOUNTER
+ KN_BOWLINGBASH = 64,
+#define KN_BOWLINGBASH SkillID::KN_BOWLINGBASH
+ KN_RIDING = 65,
+#define KN_RIDING SkillID::KN_RIDING
+ KN_CAVALIERMASTERY = 66,
+#define KN_CAVALIERMASTERY SkillID::KN_CAVALIERMASTERY
+
+ PR_MACEMASTERY = 67,
+#define PR_MACEMASTERY SkillID::PR_MACEMASTERY
+ PR_IMPOSITIO = 68,
+#define PR_IMPOSITIO SkillID::PR_IMPOSITIO
+ PR_SUFFRAGIUM = 69,
+#define PR_SUFFRAGIUM SkillID::PR_SUFFRAGIUM
+ PR_ASPERSIO = 70,
+#define PR_ASPERSIO SkillID::PR_ASPERSIO
+ PR_BENEDICTIO = 71,
+#define PR_BENEDICTIO SkillID::PR_BENEDICTIO
+ PR_SANCTUARY = 72,
+#define PR_SANCTUARY SkillID::PR_SANCTUARY
+ PR_SLOWPOISON = 73,
+#define PR_SLOWPOISON SkillID::PR_SLOWPOISON
+ PR_STRECOVERY = 74,
+#define PR_STRECOVERY SkillID::PR_STRECOVERY
+ PR_KYRIE = 75,
+#define PR_KYRIE SkillID::PR_KYRIE
+ PR_MAGNIFICAT = 76,
+#define PR_MAGNIFICAT SkillID::PR_MAGNIFICAT
+ PR_GLORIA = 77,
+#define PR_GLORIA SkillID::PR_GLORIA
+ PR_LEXDIVINA = 78,
+#define PR_LEXDIVINA SkillID::PR_LEXDIVINA
+ PR_TURNUNDEAD = 79,
+#define PR_TURNUNDEAD SkillID::PR_TURNUNDEAD
+ PR_LEXAETERNA = 80,
+#define PR_LEXAETERNA SkillID::PR_LEXAETERNA
+ PR_MAGNUS = 81,
+#define PR_MAGNUS SkillID::PR_MAGNUS
+
+ WZ_FIREPILLAR = 82,
+#define WZ_FIREPILLAR SkillID::WZ_FIREPILLAR
+ WZ_SIGHTRASHER = 83,
+#define WZ_SIGHTRASHER SkillID::WZ_SIGHTRASHER
+ WZ_FIREIVY = 84,
+#define WZ_FIREIVY SkillID::WZ_FIREIVY
+ WZ_METEOR = 85,
+#define WZ_METEOR SkillID::WZ_METEOR
+ WZ_JUPITEL = 86,
+#define WZ_JUPITEL SkillID::WZ_JUPITEL
+ WZ_VERMILION = 87,
+#define WZ_VERMILION SkillID::WZ_VERMILION
+ WZ_WATERBALL = 88,
+#define WZ_WATERBALL SkillID::WZ_WATERBALL
+ WZ_ICEWALL = 89,
+#define WZ_ICEWALL SkillID::WZ_ICEWALL
+ WZ_FROSTNOVA = 90,
+#define WZ_FROSTNOVA SkillID::WZ_FROSTNOVA
+ WZ_STORMGUST = 91,
+#define WZ_STORMGUST SkillID::WZ_STORMGUST
+ WZ_EARTHSPIKE = 92,
+#define WZ_EARTHSPIKE SkillID::WZ_EARTHSPIKE
+ WZ_HEAVENDRIVE = 93,
+#define WZ_HEAVENDRIVE SkillID::WZ_HEAVENDRIVE
+ WZ_QUAGMIRE = 94,
+#define WZ_QUAGMIRE SkillID::WZ_QUAGMIRE
+ WZ_ESTIMATION = 95,
+#define WZ_ESTIMATION SkillID::WZ_ESTIMATION
+
+ BS_IRON = 96,
+#define BS_IRON SkillID::BS_IRON
+ BS_STEEL = 97,
+#define BS_STEEL SkillID::BS_STEEL
+ BS_ENCHANTEDSTONE = 98,
+#define BS_ENCHANTEDSTONE SkillID::BS_ENCHANTEDSTONE
+ BS_ORIDEOCON = 99,
+#define BS_ORIDEOCON SkillID::BS_ORIDEOCON
+ BS_DAGGER = 100,
+#define BS_DAGGER SkillID::BS_DAGGER
+ BS_SWORD = 101,
+#define BS_SWORD SkillID::BS_SWORD
+ BS_TWOHANDSWORD = 102,
+#define BS_TWOHANDSWORD SkillID::BS_TWOHANDSWORD
+ BS_AXE = 103,
+#define BS_AXE SkillID::BS_AXE
+ BS_MACE = 104,
+#define BS_MACE SkillID::BS_MACE
+ BS_KNUCKLE = 105,
+#define BS_KNUCKLE SkillID::BS_KNUCKLE
+ BS_SPEAR = 106,
+#define BS_SPEAR SkillID::BS_SPEAR
+ BS_HILTBINDING = 107,
+#define BS_HILTBINDING SkillID::BS_HILTBINDING
+ BS_FINDINGORE = 108,
+#define BS_FINDINGORE SkillID::BS_FINDINGORE
+ BS_WEAPONRESEARCH = 109,
+#define BS_WEAPONRESEARCH SkillID::BS_WEAPONRESEARCH
+ BS_REPAIRWEAPON = 110,
+#define BS_REPAIRWEAPON SkillID::BS_REPAIRWEAPON
+ BS_SKINTEMPER = 111,
+#define BS_SKINTEMPER SkillID::BS_SKINTEMPER
+ BS_HAMMERFALL = 112,
+#define BS_HAMMERFALL SkillID::BS_HAMMERFALL
+ BS_ADRENALINE = 113,
+#define BS_ADRENALINE SkillID::BS_ADRENALINE
+ BS_WEAPONPERFECT = 114,
+#define BS_WEAPONPERFECT SkillID::BS_WEAPONPERFECT
+ BS_OVERTHRUST = 115,
+#define BS_OVERTHRUST SkillID::BS_OVERTHRUST
+ BS_MAXIMIZE = 116,
+#define BS_MAXIMIZE SkillID::BS_MAXIMIZE
+
+ HT_SKIDTRAP = 117,
+#define HT_SKIDTRAP SkillID::HT_SKIDTRAP
+ HT_LANDMINE = 118,
+#define HT_LANDMINE SkillID::HT_LANDMINE
+ HT_ANKLESNARE = 119,
+#define HT_ANKLESNARE SkillID::HT_ANKLESNARE
+ HT_SHOCKWAVE = 120,
+#define HT_SHOCKWAVE SkillID::HT_SHOCKWAVE
+ HT_SANDMAN = 121,
+#define HT_SANDMAN SkillID::HT_SANDMAN
+ HT_FLASHER = 122,
+#define HT_FLASHER SkillID::HT_FLASHER
+ HT_FREEZINGTRAP = 123,
+#define HT_FREEZINGTRAP SkillID::HT_FREEZINGTRAP
+ HT_BLASTMINE = 124,
+#define HT_BLASTMINE SkillID::HT_BLASTMINE
+ HT_CLAYMORETRAP = 125,
+#define HT_CLAYMORETRAP SkillID::HT_CLAYMORETRAP
+ HT_REMOVETRAP = 126,
+#define HT_REMOVETRAP SkillID::HT_REMOVETRAP
+ HT_TALKIEBOX = 127,
+#define HT_TALKIEBOX SkillID::HT_TALKIEBOX
+ HT_BEASTBANE = 128,
+#define HT_BEASTBANE SkillID::HT_BEASTBANE
+ HT_FALCON = 129,
+#define HT_FALCON SkillID::HT_FALCON
+ HT_STEELCROW = 130,
+#define HT_STEELCROW SkillID::HT_STEELCROW
+ HT_BLITZBEAT = 131,
+#define HT_BLITZBEAT SkillID::HT_BLITZBEAT
+ HT_DETECTING = 132,
+#define HT_DETECTING SkillID::HT_DETECTING
+ HT_SPRINGTRAP = 133,
+#define HT_SPRINGTRAP SkillID::HT_SPRINGTRAP
+
+ AS_RIGHT = 134,
+#define AS_RIGHT SkillID::AS_RIGHT
+ AS_LEFT = 135,
+#define AS_LEFT SkillID::AS_LEFT
+ AS_KATAR = 136,
+#define AS_KATAR SkillID::AS_KATAR
+ AS_CLOAKING = 137,
+#define AS_CLOAKING SkillID::AS_CLOAKING
+ AS_SONICBLOW = 138,
+#define AS_SONICBLOW SkillID::AS_SONICBLOW
+ AS_GRIMTOOTH = 139,
+#define AS_GRIMTOOTH SkillID::AS_GRIMTOOTH
+ AS_ENCHANTPOISON = 140,
+#define AS_ENCHANTPOISON SkillID::AS_ENCHANTPOISON
+ AS_POISONREACT = 141,
+#define AS_POISONREACT SkillID::AS_POISONREACT
+ AS_VENOMDUST = 142,
+#define AS_VENOMDUST SkillID::AS_VENOMDUST
+ AS_SPLASHER = 143,
+#define AS_SPLASHER SkillID::AS_SPLASHER
+
+ NV_FIRSTAID = 144, //
+#define NV_FIRSTAID SkillID::NV_FIRSTAID
+ NV_TRICKDEAD = 145,
+#define NV_TRICKDEAD SkillID::NV_TRICKDEAD
+ SM_MOVINGRECOVERY = 146, //
+#define SM_MOVINGRECOVERY SkillID::SM_MOVINGRECOVERY
+ SM_FATALBLOW = 147,
+#define SM_FATALBLOW SkillID::SM_FATALBLOW
+ SM_AUTOBERSERK = 148, //
+#define SM_AUTOBERSERK SkillID::SM_AUTOBERSERK
+ AC_MAKINGARROW = 149,
+#define AC_MAKINGARROW SkillID::AC_MAKINGARROW
+ AC_CHARGEARROW = 150,
+#define AC_CHARGEARROW SkillID::AC_CHARGEARROW
+ TF_SPRINKLESAND = 151,
+#define TF_SPRINKLESAND SkillID::TF_SPRINKLESAND
+ TF_BACKSLIDING = 152, //
+#define TF_BACKSLIDING SkillID::TF_BACKSLIDING
+ TF_PICKSTONE = 153,
+#define TF_PICKSTONE SkillID::TF_PICKSTONE
+ TF_THROWSTONE = 154,
+#define TF_THROWSTONE SkillID::TF_THROWSTONE
+ MC_CARTREVOLUTION = 155,
+#define MC_CARTREVOLUTION SkillID::MC_CARTREVOLUTION
+ MC_CHANGECART = 156,
+#define MC_CHANGECART SkillID::MC_CHANGECART
+ MC_LOUD = 157,
+#define MC_LOUD SkillID::MC_LOUD
+ AL_HOLYLIGHT = 158,
+#define AL_HOLYLIGHT SkillID::AL_HOLYLIGHT
+ MG_ENERGYCOAT = 159,
+#define MG_ENERGYCOAT SkillID::MG_ENERGYCOAT
+
+ NPC_PIERCINGATT = 160,
+#define NPC_PIERCINGATT SkillID::NPC_PIERCINGATT
+ NPC_MENTALBREAKER = 161,
+#define NPC_MENTALBREAKER SkillID::NPC_MENTALBREAKER
+ NPC_RANGEATTACK = 162,
+#define NPC_RANGEATTACK SkillID::NPC_RANGEATTACK
+ NPC_ATTRICHANGE = 163,
+#define NPC_ATTRICHANGE SkillID::NPC_ATTRICHANGE
+ NPC_CHANGEWATER = 164,
+#define NPC_CHANGEWATER SkillID::NPC_CHANGEWATER
+ NPC_CHANGEGROUND = 165,
+#define NPC_CHANGEGROUND SkillID::NPC_CHANGEGROUND
+ NPC_CHANGEFIRE = 166,
+#define NPC_CHANGEFIRE SkillID::NPC_CHANGEFIRE
+ NPC_CHANGEWIND = 167,
+#define NPC_CHANGEWIND SkillID::NPC_CHANGEWIND
+ NPC_CHANGEPOISON = 168,
+#define NPC_CHANGEPOISON SkillID::NPC_CHANGEPOISON
+ NPC_CHANGEHOLY = 169,
+#define NPC_CHANGEHOLY SkillID::NPC_CHANGEHOLY
+ NPC_CHANGEDARKNESS = 170,
+#define NPC_CHANGEDARKNESS SkillID::NPC_CHANGEDARKNESS
+ NPC_CHANGETELEKINESIS = 171,
+#define NPC_CHANGETELEKINESIS SkillID::NPC_CHANGETELEKINESIS
+ NPC_CRITICALSLASH = 172,
+#define NPC_CRITICALSLASH SkillID::NPC_CRITICALSLASH
+ NPC_COMBOATTACK = 173,
+#define NPC_COMBOATTACK SkillID::NPC_COMBOATTACK
+ NPC_GUIDEDATTACK = 174,
+#define NPC_GUIDEDATTACK SkillID::NPC_GUIDEDATTACK
+ NPC_SELFDESTRUCTION = 175, //
+#define NPC_SELFDESTRUCTION SkillID::NPC_SELFDESTRUCTION
+ NPC_SPLASHATTACK = 176,
+#define NPC_SPLASHATTACK SkillID::NPC_SPLASHATTACK
+ NPC_SUICIDE = 177,
+#define NPC_SUICIDE SkillID::NPC_SUICIDE
+ NPC_POISON = 178, //
+#define NPC_POISON SkillID::NPC_POISON
+ NPC_BLINDATTACK = 179,
+#define NPC_BLINDATTACK SkillID::NPC_BLINDATTACK
+ NPC_SILENCEATTACK = 180,
+#define NPC_SILENCEATTACK SkillID::NPC_SILENCEATTACK
+ NPC_STUNATTACK = 181,
+#define NPC_STUNATTACK SkillID::NPC_STUNATTACK
+ NPC_PETRIFYATTACK = 182,
+#define NPC_PETRIFYATTACK SkillID::NPC_PETRIFYATTACK
+ NPC_CURSEATTACK = 183,
+#define NPC_CURSEATTACK SkillID::NPC_CURSEATTACK
+ NPC_SLEEPATTACK = 184,
+#define NPC_SLEEPATTACK SkillID::NPC_SLEEPATTACK
+ NPC_RANDOMATTACK = 185,
+#define NPC_RANDOMATTACK SkillID::NPC_RANDOMATTACK
+ NPC_WATERATTACK = 186,
+#define NPC_WATERATTACK SkillID::NPC_WATERATTACK
+ NPC_GROUNDATTACK = 187,
+#define NPC_GROUNDATTACK SkillID::NPC_GROUNDATTACK
+ NPC_FIREATTACK = 188,
+#define NPC_FIREATTACK SkillID::NPC_FIREATTACK
+ NPC_WINDATTACK = 189,
+#define NPC_WINDATTACK SkillID::NPC_WINDATTACK
+
+ NPC_POISONATTACK = 190, //
+#define NPC_POISONATTACK SkillID::NPC_POISONATTACK
+ NPC_HOLYATTACK = 191,
+#define NPC_HOLYATTACK SkillID::NPC_HOLYATTACK
+ NPC_DARKNESSATTACK = 192,
+#define NPC_DARKNESSATTACK SkillID::NPC_DARKNESSATTACK
+ NPC_TELEKINESISATTACK = 193,
+#define NPC_TELEKINESISATTACK SkillID::NPC_TELEKINESISATTACK
+ NPC_MAGICALATTACK = 194,
+#define NPC_MAGICALATTACK SkillID::NPC_MAGICALATTACK
+ NPC_METAMORPHOSIS = 195,
+#define NPC_METAMORPHOSIS SkillID::NPC_METAMORPHOSIS
+ NPC_PROVOCATION = 196,
+#define NPC_PROVOCATION SkillID::NPC_PROVOCATION
+ NPC_SMOKING = 197,
+#define NPC_SMOKING SkillID::NPC_SMOKING
+ NPC_SUMMONSLAVE = 198, //
+#define NPC_SUMMONSLAVE SkillID::NPC_SUMMONSLAVE
+ NPC_EMOTION = 199, //
+#define NPC_EMOTION SkillID::NPC_EMOTION
+ NPC_TRANSFORMATION = 200,
+#define NPC_TRANSFORMATION SkillID::NPC_TRANSFORMATION
+ NPC_BLOODDRAIN = 201,
+#define NPC_BLOODDRAIN SkillID::NPC_BLOODDRAIN
+ NPC_ENERGYDRAIN = 202,
+#define NPC_ENERGYDRAIN SkillID::NPC_ENERGYDRAIN
+ NPC_KEEPING = 203,
+#define NPC_KEEPING SkillID::NPC_KEEPING
+ NPC_DARKBREATH = 204,
+#define NPC_DARKBREATH SkillID::NPC_DARKBREATH
+ NPC_DARKBLESSING = 205,
+#define NPC_DARKBLESSING SkillID::NPC_DARKBLESSING
+ NPC_BARRIER = 206,
+#define NPC_BARRIER SkillID::NPC_BARRIER
+ NPC_DEFENDER = 207,
+#define NPC_DEFENDER SkillID::NPC_DEFENDER
+ NPC_LICK = 208,
+#define NPC_LICK SkillID::NPC_LICK
+ NPC_HALLUCINATION = 209,
+#define NPC_HALLUCINATION SkillID::NPC_HALLUCINATION
+ NPC_REBIRTH = 210,
+#define NPC_REBIRTH SkillID::NPC_REBIRTH
+ NPC_SUMMONMONSTER = 211,
+#define NPC_SUMMONMONSTER SkillID::NPC_SUMMONMONSTER
+
+ RG_SNATCHER = 212,
+#define RG_SNATCHER SkillID::RG_SNATCHER
+ RG_STEALCOIN = 213,
+#define RG_STEALCOIN SkillID::RG_STEALCOIN
+ RG_BACKSTAP = 214,
+#define RG_BACKSTAP SkillID::RG_BACKSTAP
+ RG_TUNNELDRIVE = 215,
+#define RG_TUNNELDRIVE SkillID::RG_TUNNELDRIVE
+ RG_RAID = 216,
+#define RG_RAID SkillID::RG_RAID
+ RG_STRIPWEAPON = 217,
+#define RG_STRIPWEAPON SkillID::RG_STRIPWEAPON
+ RG_STRIPSHIELD = 218,
+#define RG_STRIPSHIELD SkillID::RG_STRIPSHIELD
+ RG_STRIPARMOR = 219,
+#define RG_STRIPARMOR SkillID::RG_STRIPARMOR
+ RG_STRIPHELM = 220,
+#define RG_STRIPHELM SkillID::RG_STRIPHELM
+ RG_INTIMIDATE = 221,
+#define RG_INTIMIDATE SkillID::RG_INTIMIDATE
+ RG_GRAFFITI = 222,
+#define RG_GRAFFITI SkillID::RG_GRAFFITI
+ RG_FLAGGRAFFITI = 223,
+#define RG_FLAGGRAFFITI SkillID::RG_FLAGGRAFFITI
+ RG_CLEANER = 224,
+#define RG_CLEANER SkillID::RG_CLEANER
+ RG_GANGSTER = 225,
+#define RG_GANGSTER SkillID::RG_GANGSTER
+ RG_COMPULSION = 226,
+#define RG_COMPULSION SkillID::RG_COMPULSION
+ RG_PLAGIARISM = 227,
+#define RG_PLAGIARISM SkillID::RG_PLAGIARISM
+
+ AM_AXEMASTERY = 228,
+#define AM_AXEMASTERY SkillID::AM_AXEMASTERY
+ AM_LEARNINGPOTION = 229,
+#define AM_LEARNINGPOTION SkillID::AM_LEARNINGPOTION
+ AM_PHARMACY = 230,
+#define AM_PHARMACY SkillID::AM_PHARMACY
+ AM_DEMONSTRATION = 231,
+#define AM_DEMONSTRATION SkillID::AM_DEMONSTRATION
+ AM_ACIDTERROR = 232,
+#define AM_ACIDTERROR SkillID::AM_ACIDTERROR
+ AM_POTIONPITCHER = 233,
+#define AM_POTIONPITCHER SkillID::AM_POTIONPITCHER
+ AM_CANNIBALIZE = 234,
+#define AM_CANNIBALIZE SkillID::AM_CANNIBALIZE
+ AM_SPHEREMINE = 235,
+#define AM_SPHEREMINE SkillID::AM_SPHEREMINE
+ AM_CP_WEAPON = 236,
+#define AM_CP_WEAPON SkillID::AM_CP_WEAPON
+ AM_CP_SHIELD = 237,
+#define AM_CP_SHIELD SkillID::AM_CP_SHIELD
+ AM_CP_ARMOR = 238,
+#define AM_CP_ARMOR SkillID::AM_CP_ARMOR
+ AM_CP_HELM = 239,
+#define AM_CP_HELM SkillID::AM_CP_HELM
+ AM_BIOETHICS = 240,
+#define AM_BIOETHICS SkillID::AM_BIOETHICS
+ AM_BIOTECHNOLOGY = 241,
+#define AM_BIOTECHNOLOGY SkillID::AM_BIOTECHNOLOGY
+ AM_CREATECREATURE = 242,
+#define AM_CREATECREATURE SkillID::AM_CREATECREATURE
+ AM_CULTIVATION = 243,
+#define AM_CULTIVATION SkillID::AM_CULTIVATION
+ AM_FLAMECONTROL = 244,
+#define AM_FLAMECONTROL SkillID::AM_FLAMECONTROL
+ AM_CALLHOMUN = 245,
+#define AM_CALLHOMUN SkillID::AM_CALLHOMUN
+ AM_REST = 246,
+#define AM_REST SkillID::AM_REST
+ AM_DRILLMASTER = 247,
+#define AM_DRILLMASTER SkillID::AM_DRILLMASTER
+ AM_HEALHOMUN = 248,
+#define AM_HEALHOMUN SkillID::AM_HEALHOMUN
+ AM_RESURRECTHOMUN = 249,
+#define AM_RESURRECTHOMUN SkillID::AM_RESURRECTHOMUN
+
+ CR_TRUST = 250,
+#define CR_TRUST SkillID::CR_TRUST
+ CR_AUTOGUARD = 251,
+#define CR_AUTOGUARD SkillID::CR_AUTOGUARD
+ CR_SHIELDCHARGE = 252,
+#define CR_SHIELDCHARGE SkillID::CR_SHIELDCHARGE
+ CR_SHIELDBOOMERANG = 253,
+#define CR_SHIELDBOOMERANG SkillID::CR_SHIELDBOOMERANG
+ CR_REFLECTSHIELD = 254,
+#define CR_REFLECTSHIELD SkillID::CR_REFLECTSHIELD
+ CR_HOLYCROSS = 255,
+#define CR_HOLYCROSS SkillID::CR_HOLYCROSS
+ CR_GRANDCROSS = 256,
+#define CR_GRANDCROSS SkillID::CR_GRANDCROSS
+ CR_DEVOTION = 257,
+#define CR_DEVOTION SkillID::CR_DEVOTION
+ CR_PROVIDENCE = 258,
+#define CR_PROVIDENCE SkillID::CR_PROVIDENCE
+ CR_DEFENDER = 259,
+#define CR_DEFENDER SkillID::CR_DEFENDER
+ CR_SPEARQUICKEN = 260,
+#define CR_SPEARQUICKEN SkillID::CR_SPEARQUICKEN
+
+ MO_IRONHAND = 261,
+#define MO_IRONHAND SkillID::MO_IRONHAND
+ MO_SPIRITSRECOVERY = 262,
+#define MO_SPIRITSRECOVERY SkillID::MO_SPIRITSRECOVERY
+ MO_CALLSPIRITS = 263,
+#define MO_CALLSPIRITS SkillID::MO_CALLSPIRITS
+ MO_ABSORBSPIRITS = 264,
+#define MO_ABSORBSPIRITS SkillID::MO_ABSORBSPIRITS
+ MO_TRIPLEATTACK = 265,
+#define MO_TRIPLEATTACK SkillID::MO_TRIPLEATTACK
+ MO_BODYRELOCATION = 266,
+#define MO_BODYRELOCATION SkillID::MO_BODYRELOCATION
+ MO_DODGE = 267,
+#define MO_DODGE SkillID::MO_DODGE
+ MO_INVESTIGATE = 268,
+#define MO_INVESTIGATE SkillID::MO_INVESTIGATE
+ MO_FINGEROFFENSIVE = 269,
+#define MO_FINGEROFFENSIVE SkillID::MO_FINGEROFFENSIVE
+ MO_STEELBODY = 270,
+#define MO_STEELBODY SkillID::MO_STEELBODY
+ MO_BLADESTOP = 271,
+#define MO_BLADESTOP SkillID::MO_BLADESTOP
+ MO_EXPLOSIONSPIRITS = 272,
+#define MO_EXPLOSIONSPIRITS SkillID::MO_EXPLOSIONSPIRITS
+ MO_EXTREMITYFIST = 273,
+#define MO_EXTREMITYFIST SkillID::MO_EXTREMITYFIST
+ MO_CHAINCOMBO = 274,
+#define MO_CHAINCOMBO SkillID::MO_CHAINCOMBO
+ MO_COMBOFINISH = 275,
+#define MO_COMBOFINISH SkillID::MO_COMBOFINISH
+
+ SA_ADVANCEDBOOK = 276,
+#define SA_ADVANCEDBOOK SkillID::SA_ADVANCEDBOOK
+ SA_CASTCANCEL = 277,
+#define SA_CASTCANCEL SkillID::SA_CASTCANCEL
+ SA_MAGICROD = 278,
+#define SA_MAGICROD SkillID::SA_MAGICROD
+ SA_SPELLBREAKER = 279,
+#define SA_SPELLBREAKER SkillID::SA_SPELLBREAKER
+ SA_FREECAST = 280,
+#define SA_FREECAST SkillID::SA_FREECAST
+ SA_AUTOSPELL = 281,
+#define SA_AUTOSPELL SkillID::SA_AUTOSPELL
+ SA_FLAMELAUNCHER = 282,
+#define SA_FLAMELAUNCHER SkillID::SA_FLAMELAUNCHER
+ SA_FROSTWEAPON = 283,
+#define SA_FROSTWEAPON SkillID::SA_FROSTWEAPON
+ SA_LIGHTNINGLOADER = 284,
+#define SA_LIGHTNINGLOADER SkillID::SA_LIGHTNINGLOADER
+ SA_SEISMICWEAPON = 285,
+#define SA_SEISMICWEAPON SkillID::SA_SEISMICWEAPON
+ SA_DRAGONOLOGY = 286,
+#define SA_DRAGONOLOGY SkillID::SA_DRAGONOLOGY
+ SA_VOLCANO = 287,
+#define SA_VOLCANO SkillID::SA_VOLCANO
+ SA_DELUGE = 288,
+#define SA_DELUGE SkillID::SA_DELUGE
+ SA_VIOLENTGALE = 289,
+#define SA_VIOLENTGALE SkillID::SA_VIOLENTGALE
+ SA_LANDPROTECTOR = 290,
+#define SA_LANDPROTECTOR SkillID::SA_LANDPROTECTOR
+ SA_DISPELL = 291,
+#define SA_DISPELL SkillID::SA_DISPELL
+ SA_ABRACADABRA = 292,
+#define SA_ABRACADABRA SkillID::SA_ABRACADABRA
+ SA_MONOCELL = 293,
+#define SA_MONOCELL SkillID::SA_MONOCELL
+ SA_CLASSCHANGE = 294,
+#define SA_CLASSCHANGE SkillID::SA_CLASSCHANGE
+ SA_SUMMONMONSTER = 295,
+#define SA_SUMMONMONSTER SkillID::SA_SUMMONMONSTER
+ SA_REVERSEORCISH = 296,
+#define SA_REVERSEORCISH SkillID::SA_REVERSEORCISH
+ SA_DEATH = 297,
+#define SA_DEATH SkillID::SA_DEATH
+ SA_FORTUNE = 298,
+#define SA_FORTUNE SkillID::SA_FORTUNE
+ SA_TAMINGMONSTER = 299,
+#define SA_TAMINGMONSTER SkillID::SA_TAMINGMONSTER
+ SA_QUESTION = 300,
+#define SA_QUESTION SkillID::SA_QUESTION
+ SA_GRAVITY = 301,
+#define SA_GRAVITY SkillID::SA_GRAVITY
+ SA_LEVELUP = 302,
+#define SA_LEVELUP SkillID::SA_LEVELUP
+ SA_INSTANTDEATH = 303,
+#define SA_INSTANTDEATH SkillID::SA_INSTANTDEATH
+ SA_FULLRECOVERY = 304,
+#define SA_FULLRECOVERY SkillID::SA_FULLRECOVERY
+ SA_COMA = 305,
+#define SA_COMA SkillID::SA_COMA
+
+ BD_ADAPTATION = 306,
+#define BD_ADAPTATION SkillID::BD_ADAPTATION
+ BD_ENCORE = 307,
+#define BD_ENCORE SkillID::BD_ENCORE
+ BD_LULLABY = 308,
+#define BD_LULLABY SkillID::BD_LULLABY
+ BD_RICHMANKIM = 309,
+#define BD_RICHMANKIM SkillID::BD_RICHMANKIM
+ BD_ETERNALCHAOS = 310,
+#define BD_ETERNALCHAOS SkillID::BD_ETERNALCHAOS
+ BD_DRUMBATTLEFIELD = 311,
+#define BD_DRUMBATTLEFIELD SkillID::BD_DRUMBATTLEFIELD
+ BD_RINGNIBELUNGEN = 312,
+#define BD_RINGNIBELUNGEN SkillID::BD_RINGNIBELUNGEN
+ BD_ROKISWEIL = 313,
+#define BD_ROKISWEIL SkillID::BD_ROKISWEIL
+ BD_INTOABYSS = 314,
+#define BD_INTOABYSS SkillID::BD_INTOABYSS
+ BD_SIEGFRIED = 315,
+#define BD_SIEGFRIED SkillID::BD_SIEGFRIED
+ BD_RAGNAROK = 316,
+#define BD_RAGNAROK SkillID::BD_RAGNAROK
+
+ BA_MUSICALLESSON = 317,
+#define BA_MUSICALLESSON SkillID::BA_MUSICALLESSON
+ BA_MUSICALSTRIKE = 318,
+#define BA_MUSICALSTRIKE SkillID::BA_MUSICALSTRIKE
+ BA_DISSONANCE = 319,
+#define BA_DISSONANCE SkillID::BA_DISSONANCE
+ BA_FROSTJOKE = 320,
+#define BA_FROSTJOKE SkillID::BA_FROSTJOKE
+ BA_WHISTLE = 321,
+#define BA_WHISTLE SkillID::BA_WHISTLE
+ BA_ASSASSINCROSS = 322,
+#define BA_ASSASSINCROSS SkillID::BA_ASSASSINCROSS
+ BA_POEMBRAGI = 323,
+#define BA_POEMBRAGI SkillID::BA_POEMBRAGI
+ BA_APPLEIDUN = 324,
+#define BA_APPLEIDUN SkillID::BA_APPLEIDUN
+
+ DC_DANCINGLESSON = 325,
+#define DC_DANCINGLESSON SkillID::DC_DANCINGLESSON
+ DC_THROWARROW = 326,
+#define DC_THROWARROW SkillID::DC_THROWARROW
+ DC_UGLYDANCE = 327,
+#define DC_UGLYDANCE SkillID::DC_UGLYDANCE
+ DC_SCREAM = 328,
+#define DC_SCREAM SkillID::DC_SCREAM
+ DC_HUMMING = 329,
+#define DC_HUMMING SkillID::DC_HUMMING
+ DC_DONTFORGETME = 330,
+#define DC_DONTFORGETME SkillID::DC_DONTFORGETME
+ DC_FORTUNEKISS = 331,
+#define DC_FORTUNEKISS SkillID::DC_FORTUNEKISS
+ DC_SERVICEFORYOU = 332,
+#define DC_SERVICEFORYOU SkillID::DC_SERVICEFORYOU
+
+ NPC_SELFDESTRUCTION2 = 333,
+#define NPC_SELFDESTRUCTION2 SkillID::NPC_SELFDESTRUCTION2
+
+ WE_MALE = 334,
+#define WE_MALE SkillID::WE_MALE
+ WE_FEMALE = 335,
+#define WE_FEMALE SkillID::WE_FEMALE
+ WE_CALLPARTNER = 336,
+#define WE_CALLPARTNER SkillID::WE_CALLPARTNER
+
+ NPC_DARKCROSS = 338,
+#define NPC_DARKCROSS SkillID::NPC_DARKCROSS
+
+ TMW_SKILLPOOL = 339, // skill pool size
+#define TMW_SKILLPOOL SkillID::TMW_SKILLPOOL
+
+ // magic skills
+ TMW_MAGIC = 340, //
+#define TMW_MAGIC SkillID::TMW_MAGIC
+ TMW_MAGIC_LIFE = 341, //
+#define TMW_MAGIC_LIFE SkillID::TMW_MAGIC_LIFE
+ TMW_MAGIC_WAR = 342, //
+#define TMW_MAGIC_WAR SkillID::TMW_MAGIC_WAR
+ TMW_MAGIC_TRANSMUTE = 343, //
+#define TMW_MAGIC_TRANSMUTE SkillID::TMW_MAGIC_TRANSMUTE
+ TMW_MAGIC_NATURE = 344, //
+#define TMW_MAGIC_NATURE SkillID::TMW_MAGIC_NATURE
+ TMW_MAGIC_ETHER = 345, //
+#define TMW_MAGIC_ETHER SkillID::TMW_MAGIC_ETHER
+ TMW_MAGIC_DARK = 346, //
+#define TMW_MAGIC_DARK SkillID::TMW_MAGIC_DARK
+ TMW_MAGIC_LIGHT = 347, //
+#define TMW_MAGIC_LIGHT SkillID::TMW_MAGIC_LIGHT
+
+ // focusable skills
+ TMW_BRAWLING = 350, //
+#define TMW_BRAWLING SkillID::TMW_BRAWLING
+ TMW_LUCKY_COUNTER = 351, //
+#define TMW_LUCKY_COUNTER SkillID::TMW_LUCKY_COUNTER
+ TMW_SPEED = 352, //
+#define TMW_SPEED SkillID::TMW_SPEED
+ TMW_RESIST_POISON = 353, //
+#define TMW_RESIST_POISON SkillID::TMW_RESIST_POISON
+ TMW_ASTRAL_SOUL = 354, //
+#define TMW_ASTRAL_SOUL SkillID::TMW_ASTRAL_SOUL
+ TMW_RAGING = 355, //
+#define TMW_RAGING SkillID::TMW_RAGING
+
+ LK_AURABLADE = 356,
+#define LK_AURABLADE SkillID::LK_AURABLADE
+ LK_PARRYING = 357,
+#define LK_PARRYING SkillID::LK_PARRYING
+ LK_CONCENTRATION = 358,
+#define LK_CONCENTRATION SkillID::LK_CONCENTRATION
+ LK_TENSIONRELAX = 359,
+#define LK_TENSIONRELAX SkillID::LK_TENSIONRELAX
+ LK_BERSERK = 360,
+#define LK_BERSERK SkillID::LK_BERSERK
+ LK_FURY = 361,
+#define LK_FURY SkillID::LK_FURY
+ HP_ASSUMPTIO = 362,
+#define HP_ASSUMPTIO SkillID::HP_ASSUMPTIO
+ HP_BASILICA = 363,
+#define HP_BASILICA SkillID::HP_BASILICA
+ HP_MEDITATIO = 364,
+#define HP_MEDITATIO SkillID::HP_MEDITATIO
+ HW_SOULDRAIN = 365,
+#define HW_SOULDRAIN SkillID::HW_SOULDRAIN
+ HW_MAGICCRASHER = 366,
+#define HW_MAGICCRASHER SkillID::HW_MAGICCRASHER
+ HW_MAGICPOWER = 367,
+#define HW_MAGICPOWER SkillID::HW_MAGICPOWER
+ PA_PRESSURE = 368,
+#define PA_PRESSURE SkillID::PA_PRESSURE
+ PA_SACRIFICE = 369,
+#define PA_SACRIFICE SkillID::PA_SACRIFICE
+ PA_GOSPEL = 370,
+#define PA_GOSPEL SkillID::PA_GOSPEL
+ CH_PALMSTRIKE = 371,
+#define CH_PALMSTRIKE SkillID::CH_PALMSTRIKE
+ CH_TIGERFIST = 372,
+#define CH_TIGERFIST SkillID::CH_TIGERFIST
+ CH_CHAINCRUSH = 373,
+#define CH_CHAINCRUSH SkillID::CH_CHAINCRUSH
+ PF_HPCONVERSION = 374,
+#define PF_HPCONVERSION SkillID::PF_HPCONVERSION
+ PF_SOULCHANGE = 375,
+#define PF_SOULCHANGE SkillID::PF_SOULCHANGE
+ PF_SOULBURN = 376,
+#define PF_SOULBURN SkillID::PF_SOULBURN
+ ASC_KATAR = 377,
+#define ASC_KATAR SkillID::ASC_KATAR
+ ASC_HALLUCINATION = 378,
+#define ASC_HALLUCINATION SkillID::ASC_HALLUCINATION
+ ASC_EDP = 379,
+#define ASC_EDP SkillID::ASC_EDP
+ ASC_BREAKER = 380,
+#define ASC_BREAKER SkillID::ASC_BREAKER
+ SN_SIGHT = 381,
+#define SN_SIGHT SkillID::SN_SIGHT
+ SN_FALCONASSAULT = 382,
+#define SN_FALCONASSAULT SkillID::SN_FALCONASSAULT
+ SN_SHARPSHOOTING = 383,
+#define SN_SHARPSHOOTING SkillID::SN_SHARPSHOOTING
+ SN_WINDWALK = 384,
+#define SN_WINDWALK SkillID::SN_WINDWALK
+ WS_MELTDOWN = 385,
+#define WS_MELTDOWN SkillID::WS_MELTDOWN
+ WS_CREATECOIN = 386,
+#define WS_CREATECOIN SkillID::WS_CREATECOIN
+ WS_CREATENUGGET = 387,
+#define WS_CREATENUGGET SkillID::WS_CREATENUGGET
+ WS_CARTBOOST = 388,
+#define WS_CARTBOOST SkillID::WS_CARTBOOST
+ WS_SYSTEMCREATE = 389,
+#define WS_SYSTEMCREATE SkillID::WS_SYSTEMCREATE
+ ST_CHASEWALK = 390,
+#define ST_CHASEWALK SkillID::ST_CHASEWALK
+ ST_REJECTSWORD = 391,
+#define ST_REJECTSWORD SkillID::ST_REJECTSWORD
+ ST_STEALBACKPACK = 392,
+#define ST_STEALBACKPACK SkillID::ST_STEALBACKPACK
+ CR_ALCHEMY = 393,
+#define CR_ALCHEMY SkillID::CR_ALCHEMY
+ CR_SYNTHESISPOTION = 394,
+#define CR_SYNTHESISPOTION SkillID::CR_SYNTHESISPOTION
+ CG_ARROWVULCAN = 395,
+#define CG_ARROWVULCAN SkillID::CG_ARROWVULCAN
+ CG_MOONLIT = 396,
+#define CG_MOONLIT SkillID::CG_MOONLIT
+ CG_MARIONETTE = 397,
+#define CG_MARIONETTE SkillID::CG_MARIONETTE
+ LK_SPIRALPIERCE = 398,
+#define LK_SPIRALPIERCE SkillID::LK_SPIRALPIERCE
+ LK_HEADCRUSH = 399,
+#define LK_HEADCRUSH SkillID::LK_HEADCRUSH
+ LK_JOINTBEAT = 400,
+#define LK_JOINTBEAT SkillID::LK_JOINTBEAT
+ HW_NAPALMVULCAN = 401,
+#define HW_NAPALMVULCAN SkillID::HW_NAPALMVULCAN
+ CH_SOULCOLLECT = 402,
+#define CH_SOULCOLLECT SkillID::CH_SOULCOLLECT
+ PF_MINDBREAKER = 403,
+#define PF_MINDBREAKER SkillID::PF_MINDBREAKER
+ PF_MEMORIZE = 404,
+#define PF_MEMORIZE SkillID::PF_MEMORIZE
+ PF_FOGWALL = 405,
+#define PF_FOGWALL SkillID::PF_FOGWALL
+ PF_SPIDERWEB = 406,
+#define PF_SPIDERWEB SkillID::PF_SPIDERWEB
+ ASC_METEORASSAULT = 407,
+#define ASC_METEORASSAULT SkillID::ASC_METEORASSAULT
+ ASC_CDP = 408,
+#define ASC_CDP SkillID::ASC_CDP
+ WE_BABY = 409,
+#define WE_BABY SkillID::WE_BABY
+ WE_CALLPARENT = 410,
+#define WE_CALLPARENT SkillID::WE_CALLPARENT
+ WE_CALLBABY = 411,
+#define WE_CALLBABY SkillID::WE_CALLBABY
+ TK_RUN = 412,
+#define TK_RUN SkillID::TK_RUN
+ TK_READYSTORM = 413,
+#define TK_READYSTORM SkillID::TK_READYSTORM
+ TK_STORMKICK = 414,
+#define TK_STORMKICK SkillID::TK_STORMKICK
+ TK_READYDOWN = 415,
+#define TK_READYDOWN SkillID::TK_READYDOWN
+ TK_DOWNKICK = 416,
+#define TK_DOWNKICK SkillID::TK_DOWNKICK
+ TK_READYTURN = 417,
+#define TK_READYTURN SkillID::TK_READYTURN
+ TK_TURNKICK = 418,
+#define TK_TURNKICK SkillID::TK_TURNKICK
+ TK_READYCOUNTER = 419,
+#define TK_READYCOUNTER SkillID::TK_READYCOUNTER
+ TK_COUNTER = 420,
+#define TK_COUNTER SkillID::TK_COUNTER
+ TK_DODGE = 421,
+#define TK_DODGE SkillID::TK_DODGE
+ TK_JUMPKICK = 422,
+#define TK_JUMPKICK SkillID::TK_JUMPKICK
+ TK_HPTIME = 423,
+#define TK_HPTIME SkillID::TK_HPTIME
+ TK_SPTIME = 424,
+#define TK_SPTIME SkillID::TK_SPTIME
+ TK_POWER = 425,
+#define TK_POWER SkillID::TK_POWER
+ TK_SEVENWIND = 426,
+#define TK_SEVENWIND SkillID::TK_SEVENWIND
+ TK_HIGHJUMP = 427,
+#define TK_HIGHJUMP SkillID::TK_HIGHJUMP
+ SG_FEEL = 428,
+#define SG_FEEL SkillID::SG_FEEL
+ SG_SUN_WARM = 429,
+#define SG_SUN_WARM SkillID::SG_SUN_WARM
+ SG_MOON_WARM = 430,
+#define SG_MOON_WARM SkillID::SG_MOON_WARM
+ SG_STAR_WARM = 431,
+#define SG_STAR_WARM SkillID::SG_STAR_WARM
+ SG_SUN_COMFORT = 432,
+#define SG_SUN_COMFORT SkillID::SG_SUN_COMFORT
+ SG_MOON_COMFORT = 433,
+#define SG_MOON_COMFORT SkillID::SG_MOON_COMFORT
+ SG_STAR_COMFORT = 434,
+#define SG_STAR_COMFORT SkillID::SG_STAR_COMFORT
+ SG_HATE = 435,
+#define SG_HATE SkillID::SG_HATE
+ SG_SUN_ANGER = 436,
+#define SG_SUN_ANGER SkillID::SG_SUN_ANGER
+ SG_MOON_ANGER = 437,
+#define SG_MOON_ANGER SkillID::SG_MOON_ANGER
+ SG_STAR_ANGER = 438,
+#define SG_STAR_ANGER SkillID::SG_STAR_ANGER
+ SG_SUN_BLESS = 439,
+#define SG_SUN_BLESS SkillID::SG_SUN_BLESS
+ SG_MOON_BLESS = 440,
+#define SG_MOON_BLESS SkillID::SG_MOON_BLESS
+ SG_STAR_BLESS = 441,
+#define SG_STAR_BLESS SkillID::SG_STAR_BLESS
+ SG_DEVIL = 442,
+#define SG_DEVIL SkillID::SG_DEVIL
+ SG_FRIEND = 443,
+#define SG_FRIEND SkillID::SG_FRIEND
+ SG_KNOWLEDGE = 444,
+#define SG_KNOWLEDGE SkillID::SG_KNOWLEDGE
+ SG_FUSION = 445,
+#define SG_FUSION SkillID::SG_FUSION
+ SL_ALCHEMIST = 446,
+#define SL_ALCHEMIST SkillID::SL_ALCHEMIST
+ AM_BERSERKPITCHER = 447,
+#define AM_BERSERKPITCHER SkillID::AM_BERSERKPITCHER
+ SL_MONK = 448,
+#define SL_MONK SkillID::SL_MONK
+ SL_STAR = 449,
+#define SL_STAR SkillID::SL_STAR
+ SL_SAGE = 450,
+#define SL_SAGE SkillID::SL_SAGE
+ SL_CRUSADER = 451,
+#define SL_CRUSADER SkillID::SL_CRUSADER
+ SL_SUPERNOVICE = 452,
+#define SL_SUPERNOVICE SkillID::SL_SUPERNOVICE
+ SL_KNIGHT = 453,
+#define SL_KNIGHT SkillID::SL_KNIGHT
+ SL_WIZARD = 454,
+#define SL_WIZARD SkillID::SL_WIZARD
+ SL_PRIEST = 455,
+#define SL_PRIEST SkillID::SL_PRIEST
+ SL_BARDDANCER = 456,
+#define SL_BARDDANCER SkillID::SL_BARDDANCER
+ SL_ROGUE = 457,
+#define SL_ROGUE SkillID::SL_ROGUE
+ SL_ASSASIN = 458,
+#define SL_ASSASIN SkillID::SL_ASSASIN
+ SL_BLACKSMITH = 459,
+#define SL_BLACKSMITH SkillID::SL_BLACKSMITH
+ BS_ADRENALINE2 = 460,
+#define BS_ADRENALINE2 SkillID::BS_ADRENALINE2
+ SL_HUNTER = 461,
+#define SL_HUNTER SkillID::SL_HUNTER
+ SL_SOULLINKER = 462,
+#define SL_SOULLINKER SkillID::SL_SOULLINKER
+ SL_KAIZEL = 463,
+#define SL_KAIZEL SkillID::SL_KAIZEL
+ SL_KAAHI = 464,
+#define SL_KAAHI SkillID::SL_KAAHI
+ SL_KAUPE = 465,
+#define SL_KAUPE SkillID::SL_KAUPE
+ SL_KAITE = 466,
+#define SL_KAITE SkillID::SL_KAITE
+ SL_KAINA = 467,
+#define SL_KAINA SkillID::SL_KAINA
+ SL_STIN = 468,
+#define SL_STIN SkillID::SL_STIN
+ SL_STUN = 469,
+#define SL_STUN SkillID::SL_STUN
+ SL_SMA = 470,
+#define SL_SMA SkillID::SL_SMA
+ SL_SWOO = 471,
+#define SL_SWOO SkillID::SL_SWOO
+ SL_SKE = 472,
+#define SL_SKE SkillID::SL_SKE
+ SL_SKA = 473,
+#define SL_SKA SkillID::SL_SKA
+
+ MAX_SKILL_DB = 474, // not 450
+#define MAX_SKILL_DB SkillID::MAX_SKILL_DB
+};
+
+#endif // SKILL_T_HPP