summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-13 15:06:16 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-13 15:06:16 +0000
commit0786661cdbd14a2bf37c34832cb9d3fd92765744 (patch)
tree43ec6e8332f7e3b1a48c362a7d770f4e9becb85f
parent952043f3fc80c16ef45f68defb3a9f6a764ba0d7 (diff)
downloadhercules-0786661cdbd14a2bf37c34832cb9d3fd92765744.tar.gz
hercules-0786661cdbd14a2bf37c34832cb9d3fd92765744.tar.bz2
hercules-0786661cdbd14a2bf37c34832cb9d3fd92765744.tar.xz
hercules-0786661cdbd14a2bf37c34832cb9d3fd92765744.zip
- Added HM_SKILLBASE, MAX_HOMUNSKILL to specify the skill level range of Homunculus.
- Added support for reading correctly status change data from Guild and Homun skills. - Added support for reading Homun skill data (which means the HM skills are now safe to add to skill_db, skill_require_db, etc) - Moved StatusSkillChangeTable to StatusSkillChangeTableArray and made a function called StatusSkillChangeTable to do the conversions taking into account HM/GD skills. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7128 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/common/mmo.h4
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/mercenary.c6
-rw-r--r--src/map/pc.c20
-rw-r--r--src/map/skill.c32
-rw-r--r--src/map/status.c107
-rw-r--r--src/map/status.h2
8 files changed, 109 insertions, 72 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 6a020c598..c6bb70cfa 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/13
+ * Added support for reading correctly status change data from Guild and
+ Homun skills. [Skotlex]
+ * Added support for reading Homun skill data (which means the HM skills are
+ now safe to add to skill_db, skill_require_db, etc) [Skotlex]
* Oppositions can't be made during WoE now. [Skotlex]
* Fixed a few compiler warnings from VC [Skotlex]
* Commented out the Homunculus Skills<->Status Change link which was
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 9cd6c4f90..3509692a3 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -383,6 +383,10 @@ enum {
GD_DEVELOPMENT=10014,
};
+//Base Homun skill.
+#define HM_SKILLBASE 8001
+#define MAX_HOMUNSKILL 16
+
//These mark the ID of the jobs, as expected by the client. [Skotlex]
enum {
JOB_NOVICE,
diff --git a/src/map/clif.c b/src/map/clif.c
index d08c9c0c5..cbbf7398e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8483,7 +8483,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
if (skillnotok(MO_EXPLOSIONSPIRITS,sd))
break; //Do not override the noskill mapflag. [Skotlex]
clif_skill_nodamage(&sd->bl,&sd->bl,MO_EXPLOSIONSPIRITS,-1,
- sc_start(&sd->bl,SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],100,
+ sc_start(&sd->bl,SkillStatusChangeTable(MO_EXPLOSIONSPIRITS),100,
17,skill_get_time(MO_EXPLOSIONSPIRITS,1))); //Lv17-> +50 critical (noted by Poki) [Skotlex]
sd->state.snovice_flag = 0;
break;
@@ -10781,7 +10781,7 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) {
if ((sd->class_&MAPID_BASEMASK) == MAPID_TAEKWON
&& sd->state.rest && (level = pc_checkskill(sd,TK_SPTIME)))
- sc_start(&sd->bl,SkillStatusChangeTable[TK_SPTIME],100,level,skill_get_time(TK_SPTIME, level));
+ sc_start(&sd->bl,SkillStatusChangeTable(TK_SPTIME),100,level,skill_get_time(TK_SPTIME, level));
return;
}
/*==========================================
@@ -10800,7 +10800,7 @@ void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd)
}
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_exp > 0 && nextbaseexp > 0 && (int)((double)1000*sd->status.base_exp/nextbaseexp)%100==0){
clif_skill_nodamage(&sd->bl,&sd->bl,MO_EXPLOSIONSPIRITS,5,
- sc_start(&sd->bl,SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],100,
+ sc_start(&sd->bl,SkillStatusChangeTable(MO_EXPLOSIONSPIRITS),100,
5,skill_get_time(MO_EXPLOSIONSPIRITS,5)));
}
}
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index c62877411..58e0e69a4 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -91,7 +91,7 @@ void merc_load_exptables(void)
char *merc_skill_get_name(int id)
{
- return merc_skillname[id-8000];
+ return merc_skillname[id-HM_SKILLBASE];
}
void merc_damage(struct homun_data *hd,struct block_list *src,int hp,int sp)
@@ -112,8 +112,8 @@ void merc_skillup(struct map_session_data *sd,short skillnum)
nullpo_retv(sd->hd);
if(!sd->hd->skillpts) return; //no skill points left
- sd->hd->hskill[(skillnum-8001)%4].id=skillnum;
- sd->hd->hskill[(skillnum-8001)%4].level+=1;
+ sd->hd->hskill[(skillnum-HM_SKILLBASE)%4].id=skillnum;
+ sd->hd->hskill[(skillnum-HM_SKILLBASE)%4].level+=1;
sd->hd->skillpts-=1;
clif_homuninfo(sd);
diff --git a/src/map/pc.c b/src/map/pc.c
index a0b5956e8..877c97366 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -286,7 +286,7 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
if(sd->state.snovice_flag == 4) { // [Celest]
status_heal(&sd->bl, status->max_hp, status->max_sp, 1);
sd->state.snovice_flag = 0;
- sc_start(&sd->bl,SkillStatusChangeTable[MO_STEELBODY],100,1,skill_get_time(MO_STEELBODY,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(MO_STEELBODY),100,1,skill_get_time(MO_STEELBODY,1));
} else
status_heal(&sd->bl, b_status->hp, b_status->sp>status->sp?b_status->sp-status->sp:0, 1);
} else { //Just for saving on the char-server
@@ -3874,16 +3874,16 @@ int pc_checkbaselevelup(struct map_session_data *sd)
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE)
{
- sc_start(&sd->bl,SkillStatusChangeTable[PR_KYRIE],100,1,skill_get_time(PR_KYRIE,1));
- sc_start(&sd->bl,SkillStatusChangeTable[PR_IMPOSITIO],100,1,skill_get_time(PR_IMPOSITIO,1));
- sc_start(&sd->bl,SkillStatusChangeTable[PR_MAGNIFICAT],100,1,skill_get_time(PR_MAGNIFICAT,1));
- sc_start(&sd->bl,SkillStatusChangeTable[PR_GLORIA],100,1,skill_get_time(PR_GLORIA,1));
- sc_start(&sd->bl,SkillStatusChangeTable[PR_SUFFRAGIUM],100,1,skill_get_time(PR_SUFFRAGIUM,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(PR_KYRIE),100,1,skill_get_time(PR_KYRIE,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(PR_IMPOSITIO),100,1,skill_get_time(PR_IMPOSITIO,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(PR_MAGNIFICAT),100,1,skill_get_time(PR_MAGNIFICAT,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(PR_GLORIA),100,1,skill_get_time(PR_GLORIA,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(PR_SUFFRAGIUM),100,1,skill_get_time(PR_SUFFRAGIUM,1));
} else
if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON)
{
- sc_start(&sd->bl,SkillStatusChangeTable[AL_INCAGI],100,10,skill_get_time(AL_INCAGI,10));
- sc_start(&sd->bl,SkillStatusChangeTable[AL_BLESSING],100,10,skill_get_time(AL_BLESSING,10));
+ sc_start(&sd->bl,SkillStatusChangeTable(AL_INCAGI),100,10,skill_get_time(AL_INCAGI,10));
+ sc_start(&sd->bl,SkillStatusChangeTable(AL_BLESSING),100,10,skill_get_time(AL_BLESSING,10));
}
clif_misceffect(&sd->bl,0);
//LORDALFA - LVLUPEVENT
@@ -4893,7 +4893,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
status_percent_heal(&sd->bl, 10*sd->sc.data[SC_KAIZEL].val1, 0);
if(battle_config.pc_invincible_time)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
- sc_start(&sd->bl,SkillStatusChangeTable[PR_KYRIE],100,10,skill_get_time2(SL_KAIZEL,sd->sc.data[SC_KAIZEL].val1));
+ sc_start(&sd->bl,SkillStatusChangeTable(PR_KYRIE),100,10,skill_get_time2(SL_KAIZEL,sd->sc.data[SC_KAIZEL].val1));
status_change_end(&sd->bl,SC_KAIZEL,-1);
return 0;
}
@@ -4906,7 +4906,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
sd->state.snovice_flag = 0;
if(battle_config.pc_invincible_time)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
- sc_start(&sd->bl,SkillStatusChangeTable[MO_STEELBODY],100,1,skill_get_time(MO_STEELBODY,1));
+ sc_start(&sd->bl,SkillStatusChangeTable(MO_STEELBODY),100,1,skill_get_time(MO_STEELBODY,1));
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index f1298ae50..5338768ec 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -36,6 +36,8 @@
//Guild Skills are shifted to these to make them stick into the skill array.
#define GD_SKILLRANGEMIN 900
#define GD_SKILLRANGEMAX GD_SKILLRANGEMIN+MAX_GUILDSKILL
+#define HM_SKILLRANGEMIN 800
+#define HM_SKILLRANGEMAX HM_SKILLRANGEMIN+MAX_HOMUNSKILL
int skill_names_id[MAX_SKILL_DB];
const struct skill_name_db skill_names[] = {
@@ -648,7 +650,9 @@ struct skill_abra_db skill_abra_db[MAX_SKILL_ABRA_DB];
// for values that might need to use a different function just skill_chk would suffice.
#define skill_chk(i, l) \
if (i >= GD_SKILLRANGEMIN && i <= GD_SKILLRANGEMAX) { return 0; } \
+ if (i >= HM_SKILLRANGEMIN && i <= HM_SKILLRANGEMAX) { return 0; } \
if (i >= GD_SKILLBASE) {i = GD_SKILLRANGEMIN + i - GD_SKILLBASE;} \
+ if (i >= HM_SKILLBASE) {i = HM_SKILLRANGEMIN + i - HM_SKILLBASE;} \
if (i < 1 || i >= MAX_SKILL_DB) {return 0;} \
if (l <= 0 || l > MAX_SKILL_LEVEL) {return 0;}
#define skill_get(var, i, l) \
@@ -1192,7 +1196,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case NPC_POISON:
case NPC_SILENCEATTACK:
case NPC_STUNATTACK:
- sc_start(bl,SkillStatusChangeTable[skillid],50+10*skilllv,skilllv,src->type==BL_PET?skilllv*1000:skill_get_time2(skillid,skilllv));
+ sc_start(bl,SkillStatusChangeTable(skillid),50+10*skilllv,skilllv,src->type==BL_PET?skilllv*1000:skill_get_time2(skillid,skilllv));
break;
case NPC_MENTALBREAKER:
@@ -1236,7 +1240,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case LK_JOINTBEAT: /* ジョイントビート */
//条件が良く分からないので適当に
- sc_start(bl,SkillStatusChangeTable[skillid],(5*skilllv+5),skilllv,skill_get_time2(skillid,skilllv));
+ sc_start(bl,SkillStatusChangeTable(skillid),(5*skilllv+5),skilllv,skill_get_time2(skillid,skilllv));
break;
case ASC_METEORASSAULT: /* メテオアサルト */
@@ -1429,7 +1433,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
break;
case MO_EXTREMITYFIST: /* 阿修羅覇凰拳 */
//阿修羅を使うと5分間自然回復しないようになる
- sc_start(src,SkillStatusChangeTable[skillid],100,skilllv,skill_get_time2(skillid,skilllv));
+ sc_start(src,SkillStatusChangeTable(skillid),100,skilllv,skill_get_time2(skillid,skilllv));
break;
}
@@ -3138,8 +3142,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
return skill_castend_pos2(src,src->x,src->y,skillid,skilllv,tick,0);
}
- if (skillid > 0 && skillid < MAX_SKILL)
- type = SkillStatusChangeTable[skillid];
+ if (skillid > 0)
+ type = SkillStatusChangeTable(skillid);
tsc = status_get_sc(bl);
@@ -5286,7 +5290,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case GD_BATTLEORDER:
if(flag&1) {
if (status_get_guild_id(src) == status_get_guild_id(bl))
- sc_start(bl,SC_BATTLEORDERS,100,skilllv,skill_get_time(skillid, skilllv));
+ sc_start(bl,type,100,skilllv,skill_get_time(skillid, skilllv));
} else if (status_get_guild_id(src)) {
clif_skill_nodamage(src,bl,skillid,skilllv,1);
map_foreachinrange(skill_area_sub, src,
@@ -5963,7 +5967,7 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s
struct skill_unit_group *sg;
clif_skill_poseffect(src,skillid,skilllv,x,y,tick);
sg = skill_unitsetting(src,skillid,skilllv,x,y,0);
- sc_start4(src,SkillStatusChangeTable[skillid],100,
+ sc_start4(src,SkillStatusChangeTable(skillid),100,
skilllv,0,BCT_SELF,(int)sg,skill_get_time(skillid,skilllv));
flag|=1;
}
@@ -6477,7 +6481,7 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
if (sc && sc->option&OPTION_HIDE && sg->skill_id != WZ_HEAVENDRIVE)
return 0; //Hidden characters are inmune to AoE skills except Heaven's Drive. [Skotlex]
- type = SkillStatusChangeTable[sg->skill_id];
+ type = SkillStatusChangeTable(sg->skill_id);
skillid = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still.
switch (sg->unit_id) {
case UNT_SAFETYWALL:
@@ -6608,7 +6612,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
sc = NULL;
sstatus = NULL;
}
- type = SkillStatusChangeTable[sg->skill_id];
+ type = SkillStatusChangeTable(sg->skill_id);
skillid = sg->skill_id;
if (sg->interval == -1) {
@@ -6951,7 +6955,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
if (sc && !sc->count)
sc = NULL;
- type = SkillStatusChangeTable[sg->skill_id];
+ type = SkillStatusChangeTable(sg->skill_id);
if (bl->prev==NULL || !src->alive || //Need to delete the trap if the source died.
(status_isdead(bl) && sg->unit_id != UNT_ANKLESNARE && sg->unit_id != UNT_SPIDERWEB))
@@ -7007,7 +7011,7 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
if (sc && !sc->count)
sc = NULL;
- type = SkillStatusChangeTable[skill_id];
+ type = SkillStatusChangeTable(skill_id);
switch (skill_id)
{
@@ -7223,11 +7227,11 @@ static void skill_moonlit (struct block_list* src, struct block_list* partner, i
BL_CHAR,src,partner,blowcount);
sc_start4(src,SC_DANCING,100,CG_MOONLIT,0,0,partner?partner->id:BCT_SELF,time+1000);
- sc_start4(src,SkillStatusChangeTable[CG_MOONLIT],100,skilllv,0,0,0,time);
+ sc_start4(src,SkillStatusChangeTable(CG_MOONLIT),100,skilllv,0,0,0,time);
if (partner) {
sc_start4(partner,SC_DANCING,100,CG_MOONLIT,0,0,src->id,time+1000);
- sc_start4(partner,SkillStatusChangeTable[CG_MOONLIT],100,skilllv,0,0,0,time);
+ sc_start4(partner,SkillStatusChangeTable(CG_MOONLIT),100,skilllv,0,0,0,time);
}
}
@@ -7579,7 +7583,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
case PA_GOSPEL:
case CR_SHRINK:
case TK_RUN:
- if(sc && sc->data[SkillStatusChangeTable[skill]].timer!=-1)
+ if(sc && sc->data[SkillStatusChangeTable(skill)].timer!=-1)
return 1; //Allow turning off.
break;
diff --git a/src/map/status.c b/src/map/status.c
index bd58b91b0..9b9a8c081 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -30,7 +30,10 @@
#include "../common/showmsg.h"
#include "../common/malloc.h"
-int SkillStatusChangeTable[MAX_SKILL]; //Stores the status that should be associated to this skill.
+//For specifying where in the SkillStatusChangeTableArray the "out of bounds" skills get stored. [Skotlex]
+#define SC_HM_BASE 800
+#define SC_GD_BASE 900
+int SkillStatusChangeTableArray[MAX_SKILL]; //Stores the status that should be associated to this skill.
int StatusIconChangeTable[SC_MAX]; //Stores the icon that should be associated to this status change.
int StatusSkillChangeTable[SC_MAX]; //Stores the skill that should be considered associated to this status change.
unsigned long StatusChangeFlagTable[SC_MAX]; //Stores the flag specifying what this SC changes.
@@ -52,6 +55,31 @@ int current_equip_card_id; //To prevent card-stacking (from jA) [Skotlex]
//we need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only
//to avoid cards exploits
+static void add_sc(int skill, int sc)
+{
+ int sk = skill;
+ if (sk > GD_SKILLBASE) sk = skill - GD_SKILLBASE + SC_GD_BASE;
+ else
+ if (sk > HM_SKILLBASE) sk = skill - HM_SKILLBASE + SC_HM_BASE;
+ if (sk < 0 || sk >= MAX_SKILL) {
+ if (battle_config.error_log)
+ ShowError("add_sc: Unsupported skill id %d\n", skill);
+ return;
+ }
+ if (SkillStatusChangeTableArray[skill]==-1)
+ SkillStatusChangeTableArray[skill] = sc;
+ if (StatusSkillChangeTable[sc]==0)
+ StatusSkillChangeTable[sc] = skill;
+}
+
+static void set_sc(int skill, int sc, int icon, unsigned int flag)
+{
+ if (StatusIconChangeTable[sc]==SI_BLANK)
+ StatusIconChangeTable[sc] = icon;
+ StatusChangeFlagTable[sc] |= flag;
+ add_sc(skill, sc);
+}
+
//Initializes the StatusIconChangeTable variable. May seem somewhat slower than directly defining the array,
//but it is much less prone to errors. [Skotlex]
void initChangeTables(void) {
@@ -59,7 +87,7 @@ void initChangeTables(void) {
for (i = 0; i < SC_MAX; i++)
StatusIconChangeTable[i] = SI_BLANK;
for (i = 0; i < MAX_SKILL; i++)
- SkillStatusChangeTable[i] = -1;
+ SkillStatusChangeTableArray[i] = -1;
memset(StatusSkillChangeTable, 0, sizeof(StatusSkillChangeTable));
memset(StatusChangeFlagTable, 0, sizeof(StatusChangeFlagTable));
@@ -104,18 +132,6 @@ void initChangeTables(void) {
// StatusIconChangeTable[SC_DPOISON] = SI_BLANK;
-#define set_sc(skill, sc, icon, flag) \
- if (SkillStatusChangeTable[skill]==-1) SkillStatusChangeTable[skill] = sc; \
- if (StatusSkillChangeTable[sc]==0) StatusSkillChangeTable[sc] = skill; \
- if (StatusIconChangeTable[sc]==SI_BLANK) StatusIconChangeTable[sc] = icon; \
- StatusChangeFlagTable[sc] |= flag;
-
-//This one is for sc's that already were defined.
-#define add_sc(skill, sc) \
- if (SkillStatusChangeTable[skill]==-1) SkillStatusChangeTable[skill] = sc; \
- if (StatusSkillChangeTable[sc]==0) StatusSkillChangeTable[sc] = skill;
-
-
add_sc(SM_BASH, SC_STUN);
set_sc(SM_PROVOKE, SC_PROVOKE, SI_PROVOKE, SCB_DEF|SCB_DEF2|SCB_BATK|SCB_WATK);
add_sc(SM_MAGNUM, SC_WATK_ELEMENT);
@@ -354,28 +370,30 @@ void initChangeTables(void) {
// set_sc(NJ_KAENSIN, SC_KAENSIN, SI_BLANK);
set_sc(NJ_SUITON, SC_SUITON, SI_BLANK, SCB_AGI);
set_sc(NJ_NEN, SC_NEN, SI_NEN, SCB_STR|SCB_INT);
-// FIXME: These skills have IDs of 8k and above, how do I fix these issues??
-// set_sc(HLIF_AVOID, SC_AVOID, SI_BLANK, SCB_SPEED);
-// set_sc(HLIF_CHANGE, SC_CHANGE, SI_BLANK, SCB_INT);
-// set_sc(HAMI_BLOODLUST, SC_BLOODLUST, SI_BLANK, SCB_BATK|SCB_WATK);
-// set_sc(HFLI_FLEET, SC_FLEET, SI_BLANK, SCB_ASPD|SCB_BATK|SCB_WATK);
+ set_sc(HLIF_AVOID, SC_AVOID, SI_BLANK, SCB_SPEED);
+ set_sc(HLIF_CHANGE, SC_CHANGE, SI_BLANK, SCB_INT);
+ set_sc(HAMI_BLOODLUST, SC_BLOODLUST, SI_BLANK, SCB_BATK|SCB_WATK);
+ set_sc(HFLI_FLEET, SC_FLEET, SI_BLANK, SCB_ASPD|SCB_BATK|SCB_WATK);
+
+ set_sc(GD_LEADERSHIP, SC_GUILDAURA, SI_GUILDAURA, SCB_STR|SCB_AGI|SCB_VIT|SCB_DEX);
+ set_sc(GD_BATTLEORDER, SC_BATTLEORDERS, SI_BATTLEORDERS, SCB_STR|SCB_INT|SCB_DEX);
// Storing the target job rather than simply SC_SPIRIT simplifies code later on.
- SkillStatusChangeTable[SL_ALCHEMIST] = MAPID_ALCHEMIST,
- SkillStatusChangeTable[SL_MONK] = MAPID_MONK,
- SkillStatusChangeTable[SL_STAR] = MAPID_STAR_GLADIATOR,
- SkillStatusChangeTable[SL_SAGE] = MAPID_SAGE,
- SkillStatusChangeTable[SL_CRUSADER] = MAPID_CRUSADER,
- SkillStatusChangeTable[SL_SUPERNOVICE] = MAPID_SUPER_NOVICE,
- SkillStatusChangeTable[SL_KNIGHT] = MAPID_KNIGHT,
- SkillStatusChangeTable[SL_WIZARD] = MAPID_WIZARD,
- SkillStatusChangeTable[SL_PRIEST] = MAPID_PRIEST,
- SkillStatusChangeTable[SL_BARDDANCER] = MAPID_BARDDANCER,
- SkillStatusChangeTable[SL_ROGUE] = MAPID_ROGUE,
- SkillStatusChangeTable[SL_ASSASIN] = MAPID_ASSASSIN,
- SkillStatusChangeTable[SL_BLACKSMITH] = MAPID_BLACKSMITH,
- SkillStatusChangeTable[SL_HUNTER] = MAPID_HUNTER,
- SkillStatusChangeTable[SL_SOULLINKER] = MAPID_SOUL_LINKER,
+ SkillStatusChangeTableArray[SL_ALCHEMIST] = MAPID_ALCHEMIST,
+ SkillStatusChangeTableArray[SL_MONK] = MAPID_MONK,
+ SkillStatusChangeTableArray[SL_STAR] = MAPID_STAR_GLADIATOR,
+ SkillStatusChangeTableArray[SL_SAGE] = MAPID_SAGE,
+ SkillStatusChangeTableArray[SL_CRUSADER] = MAPID_CRUSADER,
+ SkillStatusChangeTableArray[SL_SUPERNOVICE] = MAPID_SUPER_NOVICE,
+ SkillStatusChangeTableArray[SL_KNIGHT] = MAPID_KNIGHT,
+ SkillStatusChangeTableArray[SL_WIZARD] = MAPID_WIZARD,
+ SkillStatusChangeTableArray[SL_PRIEST] = MAPID_PRIEST,
+ SkillStatusChangeTableArray[SL_BARDDANCER] = MAPID_BARDDANCER,
+ SkillStatusChangeTableArray[SL_ROGUE] = MAPID_ROGUE,
+ SkillStatusChangeTableArray[SL_ASSASIN] = MAPID_ASSASSIN,
+ SkillStatusChangeTableArray[SL_BLACKSMITH] = MAPID_BLACKSMITH,
+ SkillStatusChangeTableArray[SL_HUNTER] = MAPID_HUNTER,
+ SkillStatusChangeTableArray[SL_SOULLINKER] = MAPID_SOUL_LINKER,
//Status that don't have a skill associated.
StatusIconChangeTable[SC_WEIGHT50] = SI_WEIGHT50;
@@ -425,17 +443,24 @@ void initChangeTables(void) {
StatusChangeFlagTable[SC_WATKFOOD] |= SCB_WATK;
StatusChangeFlagTable[SC_MATKFOOD] |= SCB_MATK;
- //Guild skills don't fit due to their range being beyond MAX_SKILL
- StatusIconChangeTable[SC_GUILDAURA] = SI_GUILDAURA;
- StatusChangeFlagTable[SC_GUILDAURA] |= SCB_STR|SCB_AGI|SCB_VIT|SCB_DEX;
- StatusIconChangeTable[SC_BATTLEORDERS] = SI_BATTLEORDERS;
- StatusChangeFlagTable[SC_BATTLEORDERS] |= SCB_STR|SCB_INT|SCB_DEX;
-#undef set_sc
-#undef add_sc
if (!battle_config.display_hallucination) //Disable Hallucination.
StatusIconChangeTable[SC_HALLUCINATION] = SI_BLANK;
}
+int SkillStatusChangeTable(int skill)
+{
+ int sk = skill;
+ if (sk > GD_SKILLBASE) sk = skill - GD_SKILLBASE + SC_GD_BASE;
+ else
+ if (sk > HM_SKILLBASE) sk = skill - HM_SKILLBASE + SC_HM_BASE;
+ if (sk < 0 || sk >= MAX_SKILL) {
+ if (battle_config.error_log)
+ ShowError("add_sc: Unsupported skill id %d\n", skill);
+ return -1;
+ }
+ return SkillStatusChangeTableArray[skill];
+}
+int StatusIconChangeTable[SC_MAX]; //Stores the icon that should be associated to this status change.
static void initDummyData(void) {
memset(&dummy_status, 0, sizeof(dummy_status));
dummy_status.hp =
diff --git a/src/map/status.h b/src/map/status.h
index 59fe25d6b..5a454c855 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -257,7 +257,7 @@ enum {
SC_INCDEXRATE,
SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
};
-extern int SkillStatusChangeTable[MAX_SKILL];
+int SkillStatusChangeTable(int skill);
extern int StatusSkillChangeTable[SC_MAX];
//Numerates the Number for the status changes (client-dependent), imported from jA