summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/map/atcommand.c40
-rw-r--r--src/map/battle.c321
-rw-r--r--src/map/charcommand.c4
-rw-r--r--src/map/charsave.c6
-rw-r--r--src/map/chrif.c16
-rw-r--r--src/map/clif.c342
-rw-r--r--src/map/map.c16
-rw-r--r--src/map/map.h21
-rw-r--r--src/map/mob.c116
-rw-r--r--src/map/npc.c14
-rw-r--r--src/map/pc.c345
-rw-r--r--src/map/pc.h14
-rw-r--r--src/map/pet.c2
-rw-r--r--src/map/script.c6
-rw-r--r--src/map/skill.c999
-rw-r--r--src/map/status.c1751
-rw-r--r--src/map/status.h7
18 files changed, 1947 insertions, 2077 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index ca9108106..4483d2df6 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -5,6 +5,10 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
2006/02/01
+ * Integrated the status change variables into a single structure for easier
+ management. [Skotlex]
+ * Break fall should no longer trigger when inflicted by freeze/stone/etc
+ [Skotlex]
* Fixed an overflow in grfio causing read problems in Win32 builds [celest]
* Changed resnametable loading behaviour - grfio will load from data directory
first, and then from the highest priority grf only if that fails [celest]
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 36ca4cfc3..445c65a48 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -748,7 +748,7 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
nullpo_retr(AtCommand_None, sd);
if (!battle_config.allow_atcommand_when_mute &&
- sd->sc_count && sd->sc_data[SC_NOCHAT].timer != -1) {
+ sd->sc.count && sd->sc.data[SC_NOCHAT].timer != -1) {
return AtCommand_Unknown;
}
@@ -1407,7 +1407,7 @@ int atcommand_who3(
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
for (j = 0; player_name[j]; j++)
player_name[j] = tolower(player_name[j]);
@@ -1482,7 +1482,7 @@ int atcommand_who2(
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
for (j = 0; player_name[j]; j++)
player_name[j] = tolower(player_name[j]);
@@ -1555,7 +1555,7 @@ int atcommand_who(
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
for (j = 0; player_name[j]; j++)
player_name[j] = tolower(player_name[j]);
@@ -1635,7 +1635,7 @@ int atcommand_whomap3(
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
if (pl_sd->bl.m == map_id) {
if (pl_GM_level > 0)
sprintf(atcmd_output, "Name: %s (GM:%d) | Location: %s %d %d", pl_sd->status.name, pl_GM_level, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y);
@@ -1695,7 +1695,7 @@ int atcommand_whomap2(
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
if (pl_sd->bl.m == map_id) {
if (pl_GM_level > 0)
sprintf(atcmd_output, "Name: %s (GM:%d) | BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.name, pl_GM_level, pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level);
@@ -1762,7 +1762,7 @@ int atcommand_whomap(
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
if (pl_sd->bl.m == map_id) {
g = guild_search(pl_sd->status.guild_id);
if (g == NULL)
@@ -1835,7 +1835,7 @@ int atcommand_whogm(
if ((pl_sd = pl_allsd[i])) {
pl_GM_level = pc_isGM(pl_sd);
if (pl_GM_level > 0) {
- if (!((battle_config.hide_GM_session || (pl_sd->status.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
+ if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) { // you can look only lower or same level
memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
for (j = 0; player_name[j]; j++)
player_name[j] = tolower(player_name[j]);
@@ -2134,9 +2134,9 @@ int atcommand_option(
return -1;
}
- sd->opt1 = param1;
- sd->opt2 = param2;
- if (!(sd->status.option & CART_MASK) && param3 & CART_MASK) {
+ sd->sc.opt1 = param1;
+ sd->sc.opt2 = param2;
+ if (!(sd->sc.option & CART_MASK) && param3 & CART_MASK) {
if (sd->status.class_ == JOB_BABY_MERCHANT)
clif_cart_itemlist(sd);
clif_cart_equiplist(sd);
@@ -2158,11 +2158,11 @@ int atcommand_hide(
const char* command, const char* message)
{
nullpo_retr(-1, sd);
- if (sd->status.option & OPTION_INVISIBLE) {
- sd->status.option &= ~OPTION_INVISIBLE;
+ if (sd->sc.option & OPTION_INVISIBLE) {
+ sd->sc.option &= ~OPTION_INVISIBLE;
clif_displaymessage(fd, msg_table[10]); // Invisible: Off
} else {
- sd->status.option |= OPTION_INVISIBLE;
+ sd->sc.option |= OPTION_INVISIBLE;
clif_displaymessage(fd, msg_table[11]); // Invisible: On
}
clif_changeoption(&sd->bl);
@@ -5753,14 +5753,14 @@ int atcommand_mount_peco(
if (!pc_isriding(sd)) { // if actually no peco
if (pc_checkskill(sd, KN_RIDING)) {
- pc_setoption(sd, sd->status.option | 0x0020);
+ pc_setoption(sd, sd->sc.option | 0x0020);
clif_displaymessage(fd, msg_table[102]); // Mounted Peco.
} else {
clif_displaymessage(fd, msg_table[213]); // You can not mount a peco with your job.
return -1;
}
} else { //Dismount
- pc_setoption(sd, sd->status.option & ~0x0020);
+ pc_setoption(sd, sd->sc.option & ~0x0020);
clif_displaymessage(fd, msg_table[214]); // Unmounted Peco.
}
@@ -5789,14 +5789,14 @@ int atcommand_char_mount_peco(
if (!pc_isriding(pl_sd)) { // if actually no peco
if (pc_checkskill(pl_sd, KN_RIDING)) {
- pc_setoption(pl_sd, pl_sd->status.option | 0x0020);
+ pc_setoption(pl_sd, pl_sd->sc.option | 0x0020);
clif_displaymessage(fd, msg_table[216]); // Mounted Peco.
} else {
clif_displaymessage(fd, msg_table[217]); // You can not mount a peco with your job.
return -1;
}
} else { //Dismount
- pc_setoption(pl_sd, pl_sd->status.option & ~0x0020);
+ pc_setoption(pl_sd, pl_sd->sc.option & ~0x0020);
clif_displaymessage(fd, msg_table[218]); // Unmounted Peco.
}
} else {
@@ -8258,7 +8258,7 @@ int atcommand_unmute(
return -1;
if((pl_sd=map_nick2sd((char *) message)) != NULL) {
- if(pl_sd->sc_data[SC_NOCHAT].timer!=-1) {
+ if(pl_sd->sc.data[SC_NOCHAT].timer!=-1) {
pl_sd->status.manner = 0; // have to set to 0 first [celest]
status_change_end(&pl_sd->bl,SC_NOCHAT,-1);
clif_displaymessage(sd->fd,"Player unmuted");
@@ -9995,7 +9995,7 @@ int atcommand_main(
sd->state.mainchat = 1;
clif_displaymessage(fd, msg_txt(380)); // Main chat has been activated.
}
- if (sd->sc_data[SC_NOCHAT].timer != -1) {
+ if (sd->sc.data[SC_NOCHAT].timer != -1) {
clif_displaymessage(fd, msg_txt(387));
return -1;
}
diff --git a/src/map/battle.c b/src/map/battle.c
index a00c3cbbd..5f014879f 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -237,13 +237,11 @@ int battle_delay_damage (unsigned int tick, struct block_list *src, struct block
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;
- short *sc_count;
+ struct status_change *sc;
nullpo_retr(0, target); //blはNULLで呼ばれることがあるので他でチェック
- sc_data = status_get_sc_data(target);
- sc_count = status_get_sc_count(target);
+ sc = status_get_sc(target);
if (damage == 0 ||
target->prev == NULL ||
@@ -261,15 +259,15 @@ int battle_damage(struct block_list *bl,struct block_list *target,int damage, in
if (damage < 0)
return battle_heal(bl,target,-damage,0,flag);
- if (!flag && sc_count && *sc_count > 0) {
+ if (!flag && sc && sc->count) {
// 凍結?A?ホ化?A?眠を?チ去
- if (sc_data[SC_FREEZE].timer != -1)
+ if (sc->data[SC_FREEZE].timer != -1)
status_change_end(target,SC_FREEZE,-1);
- if (sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2 == 0)
+ if (sc->data[SC_STONE].timer!=-1 && sc->data[SC_STONE].val2 == 0)
status_change_end(target,SC_STONE,-1);
- if (sc_data[SC_SLEEP].timer != -1)
+ if (sc->data[SC_SLEEP].timer != -1)
status_change_end(target,SC_SLEEP,-1);
- if (sc_data[SC_WINKCHARM].timer != -1)
+ if (sc->data[SC_WINKCHARM].timer != -1)
status_change_end(target,SC_WINKCHARM,-1);
}
@@ -282,10 +280,10 @@ int battle_damage(struct block_list *bl,struct block_list *target,int damage, in
struct map_session_data *tsd = (struct map_session_data *)target;
if (!tsd)
return 0;
- if (sc_data[SC_DEVOTION].val1 && bl && battle_getcurrentskill(bl) != PA_PRESSURE)
+ if (sc->count && sc->data[SC_DEVOTION].val1 && bl && battle_getcurrentskill(bl) != PA_PRESSURE)
{ //Devotion only works on attacks from a source (prevent it from absorbing coma) [Skotlex]
- struct map_session_data *sd2 = map_id2sd(tsd->sc_data[SC_DEVOTION].val1);
- if (sd2 && sd2->devotion[sc_data[SC_DEVOTION].val2] == target->id)
+ struct map_session_data *sd2 = map_id2sd(tsd->sc.data[SC_DEVOTION].val1);
+ if (sd2 && sd2->devotion[sc->data[SC_DEVOTION].val2] == target->id)
{
clif_damage(bl, &sd2->bl, gettick(), 0, 0, damage, 0, 0, 0);
pc_damage(&sd2->bl, sd2, damage);
@@ -377,11 +375,11 @@ int battle_stopwalking(struct block_list *bl,int type)
int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_elem)
{
int def_type = def_elem % 10, def_lv = def_elem / 10 / 2;
- struct status_change *sc_data=NULL, *tsc_data=NULL;
+ struct status_change *sc=NULL, *tsc=NULL;
int ratio;
- if (src) sc_data = status_get_sc_data(src);
- if (target) tsc_data = status_get_sc_data(target);
+ if (src) sc = status_get_sc(src);
+ if (target) tsc = status_get_sc(target);
if (atk_elem < 0 || atk_elem > 9)
atk_elem = rand()%9; //?器属?ォランダムで付加
@@ -427,24 +425,24 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
}
ratio = attr_fix_table[def_lv-1][atk_elem][def_type];
- if (sc_data)
+ if (sc && sc->count)
{
- if(sc_data[SC_VOLCANO].timer!=-1 && atk_elem == 3)
- ratio += enchant_eff[sc_data[SC_VOLCANO].val1-1];
- if(sc_data[SC_VIOLENTGALE].timer!=-1 && atk_elem == 4)
- ratio += enchant_eff[sc_data[SC_VIOLENTGALE].val1-1];
- if(sc_data[SC_DELUGE].timer!=-1 && atk_elem == 1)
- ratio += enchant_eff[sc_data[SC_DELUGE].val1-1];
+ if(sc->data[SC_VOLCANO].timer!=-1 && atk_elem == 3)
+ ratio += enchant_eff[sc->data[SC_VOLCANO].val1-1];
+ if(sc->data[SC_VIOLENTGALE].timer!=-1 && atk_elem == 4)
+ ratio += enchant_eff[sc->data[SC_VIOLENTGALE].val1-1];
+ if(sc->data[SC_DELUGE].timer!=-1 && atk_elem == 1)
+ ratio += enchant_eff[sc->data[SC_DELUGE].val1-1];
}
- if (tsc_data)
+ if (tsc && tsc->count)
{
- if(tsc_data[SC_ARMOR_ELEMENT].timer!=-1)
+ if(tsc->data[SC_ARMOR_ELEMENT].timer!=-1)
{
- if (tsc_data[SC_ARMOR_ELEMENT].val1 == atk_elem)
- ratio -= tsc_data[SC_ARMOR_ELEMENT].val2;
+ if (tsc->data[SC_ARMOR_ELEMENT].val1 == atk_elem)
+ ratio -= tsc->data[SC_ARMOR_ELEMENT].val2;
else
- if (tsc_data[SC_ARMOR_ELEMENT].val3 == atk_elem)
- ratio -= tsc_data[SC_ARMOR_ELEMENT].val4;
+ if (tsc->data[SC_ARMOR_ELEMENT].val3 == atk_elem)
+ ratio -= tsc->data[SC_ARMOR_ELEMENT].val4;
}
}
return damage*ratio/100;
@@ -536,8 +534,8 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
{
struct map_session_data *sd = NULL;
struct mob_data *md = NULL;
- struct status_change *sc_data, *sc;
- short *sc_count;
+ struct status_change *sc;
+ struct status_change_entry *sci;
int class_;
nullpo_retr(0, bl);
@@ -553,8 +551,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
sd=(struct map_session_data *)bl;
}
- sc_data = status_get_sc_data(bl);
- sc_count = status_get_sc_count(bl);
+ sc = status_get_sc(bl);
if(flag&BF_LONG && map_getcell(bl->m, bl->x, bl->y, CELL_CHKPNEUMA) &&
((flag&BF_WEAPON && skill_num != NPC_GUIDEDATTACK) ||
@@ -563,12 +560,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
return 0;
}
- if (sc_count && *sc_count > 0) {
+ if (sc && sc->count) {
//First, sc_*'s that reduce damage to 0.
- if (sc_data[SC_SAFETYWALL].timer!=-1 && flag&BF_SHORT && (skill_num != NPC_GUIDEDATTACK && skill_num != AM_DEMONSTRATION)
+ if (sc->data[SC_SAFETYWALL].timer!=-1 && flag&BF_SHORT && (skill_num != NPC_GUIDEDATTACK && skill_num != AM_DEMONSTRATION)
) {
// セ?[フティウォ?[ル
- struct skill_unit_group *group = (struct skill_unit_group *)sc_data[SC_SAFETYWALL].val3;
+ struct skill_unit_group *group = (struct skill_unit_group *)sc->data[SC_SAFETYWALL].val3;
if (group) {
if (--group->val2<=0)
skill_delunitgroup(group);
@@ -578,28 +575,17 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
}
}
- if(sc_data[SC_LANDPROTECTOR].timer!=-1 && flag&BF_MAGIC)
+ if(sc->data[SC_LANDPROTECTOR].timer!=-1 && flag&BF_MAGIC)
return 0;
- /* Moved to battle_calc_weapon_attack for now.
- if(sc_data[SC_KAUPE].timer != -1 && damage > 0 && !skill_num) {
- if(rand()%100 < sc_data[SC_KAUPE].val2) {
- clif_skill_nodamage(bl,bl,SL_KAUPE,sc_data[SC_KAUPE].val1,1);
- if (--sc_data[SC_KAUPE].val3 <= 0) //We make it work like Safety Wall, even though it only blocks 1 time.
- status_change_end(bl, SC_KAUPE, -1);
- return 0;
- }
- }
- */
-
- if(sc_data[SC_AUTOGUARD].timer != -1 && flag&BF_WEAPON &&
- rand()%100 < sc_data[SC_AUTOGUARD].val2) {
+ if(sc->data[SC_AUTOGUARD].timer != -1 && flag&BF_WEAPON &&
+ rand()%100 < sc->data[SC_AUTOGUARD].val2) {
int delay;
- clif_skill_nodamage(bl,bl,CR_AUTOGUARD,sc_data[SC_AUTOGUARD].val1,1);
+ clif_skill_nodamage(bl,bl,CR_AUTOGUARD,sc->data[SC_AUTOGUARD].val1,1);
// different delay depending on skill level [celest]
- if (sc_data[SC_AUTOGUARD].val1 <= 5)
+ if (sc->data[SC_AUTOGUARD].val1 <= 5)
delay = 300;
- else if (sc_data[SC_AUTOGUARD].val1 > 5 && sc_data[SC_AUTOGUARD].val1 <= 9)
+ else if (sc->data[SC_AUTOGUARD].val1 > 5 && sc->data[SC_AUTOGUARD].val1 <= 9)
delay = 200;
else
delay = 100;
@@ -608,39 +594,39 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
else if(md)
md->canmove_tick = gettick() + delay;
- if(sc_data[SC_SHRINK].timer != -1 && rand()%100<5*sc_data[SC_AUTOGUARD].val1)
+ if(sc->data[SC_SHRINK].timer != -1 && rand()%100<5*sc->data[SC_AUTOGUARD].val1)
skill_blown(bl,src,skill_get_blewcount(CR_SHRINK,1));
return 0;
}
// -- moonsoul (chance to block attacks with new Lord Knight skill parrying)
//
- if(sc_data[SC_PARRYING].timer != -1 && flag&BF_WEAPON &&
- rand()%100 < sc_data[SC_PARRYING].val2) {
- clif_skill_nodamage(bl,bl,LK_PARRYING,sc_data[SC_PARRYING].val1,1);
+ if(sc->data[SC_PARRYING].timer != -1 && flag&BF_WEAPON &&
+ rand()%100 < sc->data[SC_PARRYING].val2) {
+ clif_skill_nodamage(bl,bl,LK_PARRYING,sc->data[SC_PARRYING].val1,1);
return 0;
}
- if(sc_data[SC_DODGE].timer != -1 && (flag&BF_LONG || (sc_data[SC_SPURT].timer != -1 && flag&BF_WEAPON))
+ if(sc->data[SC_DODGE].timer != -1 && !sc->opt1 && (flag&BF_LONG || (sc->data[SC_SPURT].timer != -1 && flag&BF_WEAPON))
&& rand()%100 < 20) {
clif_skill_nodamage(bl,bl,TK_DODGE,1,1);
- if (sc_data[SC_COMBO].timer == -1)
+ if (sc->data[SC_COMBO].timer == -1)
status_change_start(bl, SC_COMBO, TK_JUMPKICK, src->id, 0, 0, 2000, 0);
return 0;
}
- if(sc_data[SC_FOGWALL].timer != -1 && flag&BF_MAGIC
+ if(sc->data[SC_FOGWALL].timer != -1 && flag&BF_MAGIC
&& rand()%100 < 75 && !(skill_get_inf(skill_num)&INF_GROUND_SKILL))
return 0;
//Now damage increasing effects
- if(sc_data[SC_AETERNA].timer!=-1 && skill_num != PA_PRESSURE){
+ if(sc->data[SC_AETERNA].timer!=-1 && skill_num != PA_PRESSURE){
damage<<=1;
if (skill_num != ASC_BREAKER || flag & BF_MAGIC) //Only end it on the second attack of breaker. [Skotlex]
status_change_end( bl,SC_AETERNA,-1 );
}
- if(sc_data[SC_SPIDERWEB].timer!=-1) // [Celest]
+ if(sc->data[SC_SPIDERWEB].timer!=-1) // [Celest]
if ((flag&BF_SKILL && skill_get_pl(skill_num)==3) ||
(!flag&BF_SKILL && status_get_attack_element(src)==3)) {
damage<<=1;
@@ -648,20 +634,20 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
}
//Finally damage reductions....
- if(sc_data[SC_ASSUMPTIO].timer != -1){
+ if(sc->data[SC_ASSUMPTIO].timer != -1){
if(map_flag_vs(bl->m))
damage=damage*2/3; //Receive 66% damage
else
damage>>=1; //Receive 50% damage
}
- if(sc_data[SC_DEFENDER].timer != -1 && flag&BF_LONG && flag&BF_WEAPON)
- damage=damage*(100-sc_data[SC_DEFENDER].val2)/100;
+ if(sc->data[SC_DEFENDER].timer != -1 && flag&BF_LONG && flag&BF_WEAPON)
+ damage=damage*(100-sc->data[SC_DEFENDER].val2)/100;
- if(sc_data[SC_FOGWALL].timer != -1 && flag&BF_LONG && flag&BF_WEAPON)
+ if(sc->data[SC_FOGWALL].timer != -1 && flag&BF_LONG && flag&BF_WEAPON)
damage >>=1;
- if(sc_data[SC_ENERGYCOAT].timer!=-1 && flag&BF_WEAPON){
+ if(sc->data[SC_ENERGYCOAT].timer!=-1 && flag&BF_WEAPON){
if(sd){
if(sd->status.sp>0){
int per = sd->status.sp * 5 / (sd->status.max_sp + 1);
@@ -674,45 +660,44 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
status_change_end( bl,SC_ENERGYCOAT,-1 );
}
else
- damage -= damage * (sc_data[SC_ENERGYCOAT].val1 * 6) / 100;
+ damage -= damage * (sc->data[SC_ENERGYCOAT].val1 * 6) / 100;
}
- if(sc_data[SC_REJECTSWORD].timer!=-1 && flag&BF_WEAPON &&
+ if(sc->data[SC_REJECTSWORD].timer!=-1 && flag&BF_WEAPON &&
// Fixed the condition check [Aalye]
(src->type==BL_MOB || (src->type==BL_PC && (((struct map_session_data *)src)->status.weapon == 1 ||
((struct map_session_data *)src)->status.weapon == 2 ||
((struct map_session_data *)src)->status.weapon == 3)))){
- if(rand()%100 < (15*sc_data[SC_REJECTSWORD].val1)){
+ if(rand()%100 < (15*sc->data[SC_REJECTSWORD].val1)){
damage = damage*50/100;
clif_damage(bl,src,gettick(),0,0,damage,0,0,0);
battle_damage(bl,src,damage,0);
- clif_skill_nodamage(bl,bl,ST_REJECTSWORD,sc_data[SC_REJECTSWORD].val1,1);
- if((--sc_data[SC_REJECTSWORD].val2)<=0)
+ clif_skill_nodamage(bl,bl,ST_REJECTSWORD,sc->data[SC_REJECTSWORD].val1,1);
+ if((--sc->data[SC_REJECTSWORD].val2)<=0)
status_change_end(bl, SC_REJECTSWORD, -1);
}
}
//Finally Kyrie because it may, or not, reduce damage to 0.
- if(sc_data[SC_KYRIE].timer!=-1){
- sc=&sc_data[SC_KYRIE];
- sc->val2-=damage;
+ if(sc->data[SC_KYRIE].timer!=-1){
+ sci=&sc->data[SC_KYRIE];
+ sci->val2-=damage;
if(flag&BF_WEAPON || skill_num == TF_THROWSTONE){
- if(sc->val2>=0)
+ if(sci->val2>=0)
damage=0;
else
- damage=-sc->val2;
+ damage=-sci->val2;
}
- if((--sc->val3)<=0 || (sc->val2<=0) || skill_num == AL_HOLYLIGHT)
+ if((--sci->val3)<=0 || (sci->val2<=0) || skill_num == AL_HOLYLIGHT)
status_change_end(bl, SC_KYRIE, -1);
}
if (damage <= 0) return 0;
}
//SC effects from caster side.
- sc_data = status_get_sc_data(src);
- sc_count = status_get_sc_count(src);
- if (sc_count && *sc_count > 0) {
- if(sc_data[SC_FOGWALL].timer != -1 && flag&(BF_LONG|BF_MAGIC)) {
+ sc = status_get_sc(src);
+ if (sc && sc->count) {
+ if(sc->data[SC_FOGWALL].timer != -1 && flag&(BF_LONG|BF_MAGIC)) {
if (flag&BF_MAGIC) {
if(!(skill_get_inf(skill_num)&INF_GROUND_SKILL) && rand()%100 < 75)
return 0;
@@ -830,7 +815,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
// ビ?[ストベイン(+4 ?` +40) vs 動物 or ?ゥ虫
if((skill = pc_checkskill(sd,HT_BEASTBANE)) > 0 && (race==2 || race==4) ) {
damage += (skill * 4);
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_HUNTER)
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_HUNTER)
damage += sd->status.str;
}
@@ -953,7 +938,7 @@ static void battle_calc_base_damage(struct block_list *src, struct block_list *t
{
unsigned short baseatk=0, baseatk_=0, atkmin=0, atkmax=0, atkmin_=0, atkmax_=0;
struct map_session_data *sd;
- struct status_change *sc_data = status_get_sc_data(src);
+ struct status_change *sc= status_get_sc(src);
int t_size = status_get_size(target);
if (src->type == BL_PC)
@@ -1026,7 +1011,7 @@ static void battle_calc_base_damage(struct block_list *src, struct block_list *t
}
}
- if (sc_data && sc_data[SC_MAXIMIZEPOWER].timer!=-1)
+ if (sc && sc->data[SC_MAXIMIZEPOWER].timer!=-1)
{
atkmin = atkmax;
atkmin_ = atkmax_;
@@ -1053,7 +1038,7 @@ static void battle_calc_base_damage(struct block_list *src, struct block_list *t
//SizeFix only for players
if (!(
sd->special_state.no_sizefix ||
- (sc_data && sc_data[SC_WEAPONPERFECTION].timer!=-1) ||
+ (sc && sc->data[SC_WEAPONPERFECTION].timer!=-1) ||
(pc_isriding(sd) && (sd->status.weapon==4 || sd->status.weapon==5) && t_size==1) ||
(flag&8)
))
@@ -1089,8 +1074,8 @@ static struct Damage battle_calc_weapon_attack(
short t_race=0, t_ele=0, s_race=0; //Set to 0 because the compiler does not notices they are NOT gonna be used uninitialized
short s_ele, s_ele_;
short def1, def2;
- struct status_change *sc_data = status_get_sc_data(src);
- struct status_change *t_sc_data = status_get_sc_data(target);
+ struct status_change *sc = status_get_sc(src);
+ struct status_change *tsc = status_get_sc(target);
struct {
unsigned hit : 1; //the attack Hit? (not a miss)
unsigned cri : 1; //Critical hit
@@ -1129,6 +1114,11 @@ static struct Damage battle_calc_weapon_attack(
wd.flag=BF_SHORT|BF_WEAPON|BF_NORMAL; //Initial Flag
wd.dmg_lv=ATK_DEF; //This assumption simplifies the assignation later
+ if (sc && !sc->count)
+ sc = NULL; //Skip checking as there are no status changes active.
+ if (tsc && !tsc->count)
+ sc = NULL; //Skip checking as there are no status changes active.
+
switch (src->type)
{
case BL_PC:
@@ -1270,7 +1260,7 @@ static struct Damage battle_calc_weapon_attack(
//Check for counter
if(!skill_num)
{
- if(t_sc_data && t_sc_data[SC_AUTOCOUNTER].timer != -1)
+ if(tsc && tsc->data[SC_AUTOCOUNTER].timer != -1)
//If it got here and you had autocounter active, then the direction/range does not matches: critical
flag.cri = 1;
} //End counter-check
@@ -1330,12 +1320,12 @@ static struct Damage battle_calc_weapon_attack(
//Therefore, we use the old value 3 on cases when an sd gets attacked by a mob
cri -= status_get_luk(target) * (md&&tsd?3:2);
- if(t_sc_data)
+ if(tsc)
{
- if (t_sc_data[SC_SLEEP].timer!=-1 )
+ if (tsc->data[SC_SLEEP].timer!=-1 )
cri <<=1;
- if(t_sc_data[SC_JOINTBEAT].timer != -1 &&
- t_sc_data[SC_JOINTBEAT].val2 == 6) // Always take crits with Neck broken by Joint Beat [DracoRPG]
+ if(tsc->data[SC_JOINTBEAT].timer != -1 &&
+ tsc->data[SC_JOINTBEAT].val2 == 6) // Always take crits with Neck broken by Joint Beat [DracoRPG]
flag.cri=1;
}
switch (skill_num)
@@ -1362,7 +1352,7 @@ static struct Damage battle_calc_weapon_attack(
} else { //Check for Perfect Hit
if(sd && sd->perfect_hit > 0 && rand()%100 < sd->perfect_hit)
flag.hit = 1;
- if (sc_data && sc_data[SC_FUSION].timer != -1) {
+ if (sc && sc->count && sc->data[SC_FUSION].timer != -1) {
flag.hit = 1; //SG_FUSION always hit [Komurka]
flag.idef = flag.idef2 = 1; //def ignore [Komurka]
}
@@ -1384,15 +1374,15 @@ static struct Damage battle_calc_weapon_attack(
flag.hit = 1;
break;
case CR_SHIELDBOOMERANG:
- if (sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_CRUSADER)
+ if (sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_CRUSADER)
flag.hit = 1;
break;
}
- if ((t_sc_data && !flag.hit) &&
- (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))
+ if ((tsc && !flag.hit) &&
+ (tsc->data[SC_SLEEP].timer!=-1 ||
+ tsc->data[SC_STAN].timer!=-1 ||
+ tsc->data[SC_FREEZE].timer!=-1 ||
+ (tsc->data[SC_STONE].timer!=-1 && tsc->data[SC_STONE].val2==0))
)
flag.hit = 1;
}
@@ -1456,8 +1446,8 @@ static struct Damage battle_calc_weapon_attack(
if(rand()%100 >= hitrate)
wd.dmg_lv = ATK_FLEE;
- else if (t_sc_data && t_sc_data[SC_KAUPE].timer != -1 && rand()%100 < t_sc_data[SC_KAUPE].val2) {
- if (--t_sc_data[SC_KAUPE].val3 <= 0) //We make it work like Safety Wall, even though it only blocks 1 time.
+ else if (tsc && tsc->data[SC_KAUPE].timer != -1 && rand()%100 < tsc->data[SC_KAUPE].val2) {
+ if (--tsc->data[SC_KAUPE].val3 <= 0) //We make it work like Safety Wall, even though it only blocks 1 time.
status_change_end(target, SC_KAUPE, -1);
wd.dmg_lv = ATK_FLEE;
} else
@@ -1495,9 +1485,9 @@ static struct Damage battle_calc_weapon_attack(
wd.damage = hp_dmg;
wd.damage2 = 0;
- if (sc_data && sc_data[SC_SACRIFICE].timer != -1)
+ if (sc && sc->data[SC_SACRIFICE].timer != -1)
{
- if (--sc_data[SC_SACRIFICE].val2 <= 0)
+ if (--sc->data[SC_SACRIFICE].val2 <= 0)
status_change_end(src, SC_SACRIFICE,-1);
}
break;
@@ -1567,13 +1557,13 @@ static struct Damage battle_calc_weapon_attack(
} //End switch(skill_num)
//Skill damage modifiers that stack linearly
- if(sc_data && skill_num != PA_SACRIFICE)
+ if(sc && skill_num != PA_SACRIFICE)
{
- if(sc_data[SC_OVERTHRUST].timer != -1)
- skillratio += 5*sc_data[SC_OVERTHRUST].val1;
- if(sc_data[SC_MAXOVERTHRUST].timer != -1)
- skillratio += 20*sc_data[SC_MAXOVERTHRUST].val1;
- if(sc_data[SC_BERSERK].timer != -1)
+ if(sc->data[SC_OVERTHRUST].timer != -1)
+ skillratio += 5*sc->data[SC_OVERTHRUST].val1;
+ if(sc->data[SC_MAXOVERTHRUST].timer != -1)
+ skillratio += 20*sc->data[SC_MAXOVERTHRUST].val1;
+ if(sc->data[SC_BERSERK].timer != -1)
skillratio += 100;
}
if (!skill_num)
@@ -1700,7 +1690,7 @@ static struct Damage battle_calc_weapon_attack(
break;
case CR_SHIELDBOOMERANG:
skillratio += 30*skill_lv;
- if (sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_CRUSADER)
+ if (sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_CRUSADER)
skillratio += 100;
break;
case NPC_DARKCROSS:
@@ -1823,7 +1813,7 @@ static struct Damage battle_calc_weapon_attack(
break;
case TK_JUMPKICK:
skillratio += -70 + 10*skill_lv;
- if (sc_data && sc_data[SC_COMBO].timer != -1 && sc_data[SC_COMBO].val1 == skill_num)
+ if (sc && sc->data[SC_COMBO].timer != -1 && sc->data[SC_COMBO].val1 == skill_num)
skillratio += 10*status_get_lv(src)/3;
break;
case KN_CHARGEATK:
@@ -1858,16 +1848,16 @@ static struct Damage battle_calc_weapon_attack(
//Here comes a second pass for skills that stack to the previously defined % damage. [Skotlex]
skillratio = 100;
//Skill damage modifiers that affect linearly stacked damage.
- if (sc_data && skill_num != PA_SACRIFICE) {
- if(sc_data[SC_TRUESIGHT].timer != -1)
- skillratio += 2*sc_data[SC_TRUESIGHT].val1;
+ if (sc && skill_num != PA_SACRIFICE) {
+ if(sc->data[SC_TRUESIGHT].timer != -1)
+ skillratio += 2*sc->data[SC_TRUESIGHT].val1;
// It is still not quite decided whether it works on bosses or not...
- if(sc_data[SC_EDP].timer != -1 /*&& !(t_mode&MD_BOSS)*/ && skill_num != ASC_BREAKER && skill_num != ASC_METEORASSAULT)
- skillratio += 50 +50*sc_data[SC_EDP].val1;
+ if(sc->data[SC_EDP].timer != -1 /*&& !(t_mode&MD_BOSS)*/ && skill_num != ASC_BREAKER && skill_num != ASC_METEORASSAULT)
+ skillratio += 50 +50*sc->data[SC_EDP].val1;
}
switch (skill_num) {
case AS_SONICBLOW:
- if (sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_ASSASIN)
+ if (sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_ASSASIN)
skillratio += (map_flag_gvg(src->m))?25:100; //+25% dmg on woe/+100% dmg on nonwoe
if(sd && pc_checkskill(sd,AS_SONICACCEL)>0)
skillratio += 10;
@@ -1975,10 +1965,10 @@ static struct Damage battle_calc_weapon_attack(
}
//Post skill/vit reduction damage increases
- if (sc_data && skill_num != LK_SPIRALPIERCE)
+ if (sc && skill_num != LK_SPIRALPIERCE)
{ //SC skill damages
- if(sc_data[SC_AURABLADE].timer!=-1)
- ATK_ADD(20*sc_data[SC_AURABLADE].val1);
+ if(sc->data[SC_AURABLADE].timer!=-1)
+ ATK_ADD(20*sc->data[SC_AURABLADE].val1);
}
//Refine bonus
@@ -2043,12 +2033,12 @@ static struct Damage battle_calc_weapon_attack(
if (flag.lh && wd.damage2 > 0)
wd.damage2 = battle_attr_fix(src,target,wd.damage2,s_ele_,t_element);
}
- if(sc_data && sc_data[SC_WATK_ELEMENT].timer != -1)
+ if(sc && sc->data[SC_WATK_ELEMENT].timer != -1)
{ //Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex]
int damage=0;
battle_calc_base_damage(src, target, &damage, NULL, (flag.arrow?2:0));
- damage = damage*sc_data[SC_WATK_ELEMENT].val2/100;
- damage = battle_attr_fix(src,target,damage,sc_data[SC_WATK_ELEMENT].val1,t_element);
+ damage = damage*sc->data[SC_WATK_ELEMENT].val2/100;
+ damage = battle_attr_fix(src,target,damage,sc->data[SC_WATK_ELEMENT].val1,t_element);
ATK_ADD(damage);
}
}
@@ -2267,10 +2257,10 @@ static struct Damage battle_calc_weapon_attack(
(wd.damage > 0 || wd.damage2 > 0)) {
if (battle_config.equip_self_break_rate) { // Self weapon breaking
int breakrate = battle_config.equip_natural_break_rate;
- if (sd->sc_count) {
- if(sd->sc_data[SC_OVERTHRUST].timer!=-1)
+ if (sc) {
+ if(sc->data[SC_OVERTHRUST].timer!=-1)
breakrate += 10;
- if(sd->sc_data[SC_MAXOVERTHRUST].timer!=-1)
+ if(sc->data[SC_MAXOVERTHRUST].timer!=-1)
breakrate += 10;
}
if(rand() % 10000 < breakrate * battle_config.equip_self_break_rate / 100 || breakrate >= 10000)
@@ -2282,10 +2272,10 @@ static struct Damage battle_calc_weapon_attack(
breakrate[0] += sd->break_weapon_rate; // Break rate from equipment
breakrate[1] += sd->break_armor_rate;
- if (sd->sc_count) {
- if (sd->sc_data[SC_MELTDOWN].timer!=-1) {
- breakrate[0] += 100*sd->sc_data[SC_MELTDOWN].val1;
- breakrate[1] += 70*sd->sc_data[SC_MELTDOWN].val1;
+ if (sc) {
+ if (sc->data[SC_MELTDOWN].timer!=-1) {
+ breakrate[0] += 100*sc->data[SC_MELTDOWN].val1;
+ breakrate[1] += 70*sc->data[SC_MELTDOWN].val1;
breaktime = skill_get_time2(WS_MELTDOWN,1);
}
}
@@ -2556,7 +2546,7 @@ struct Damage battle_calc_magic_attack(
break;
case AL_HOLYLIGHT:
skillratio += 25;
- if (sd && sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_PRIEST)
+ if (sd && sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_PRIEST)
skillratio *= 5; //Does 5x damage include bonuses from other skills?
break;
case AL_RUWACH:
@@ -2804,11 +2794,11 @@ struct Damage battle_calc_misc_attack(
case NPC_DARKBREATH:
{
- struct status_change *sc_data = status_get_sc_data(target);
+ struct status_change *sc = status_get_sc(target);
int hitrate=status_get_hit(bl) - status_get_flee(target) + 80;
hitrate = ( (hitrate>95)?95: ((hitrate<5)?5:hitrate) );
- if(sc_data && (sc_data[SC_SLEEP].timer!=-1 || sc_data[SC_STAN].timer!=-1 ||
- sc_data[SC_FREEZE].timer!=-1 || (sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) ) )
+ if(sc && sc->count && (sc->data[SC_SLEEP].timer!=-1 || sc->data[SC_STAN].timer!=-1 ||
+ sc->data[SC_FREEZE].timer!=-1 || (sc->data[SC_STONE].timer!=-1 && sc->data[SC_STONE].val2==0) ) )
hitrate = 1000000;
if(rand()%100 < hitrate) {
damage = 500 + (skill_lv-1)*1000 + rand()%1000;
@@ -2935,11 +2925,11 @@ struct Damage battle_calc_attack( int attack_type,
int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
struct map_session_data *sd=NULL;
- struct status_change *sc_data;
+ struct status_change *sc;
int rdamage = 0;
if (bl->type == BL_PC) sd = (struct map_session_data*)bl;
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
if(flag&BF_WEAPON) {
if (flag & BF_SHORT) {
@@ -2948,9 +2938,9 @@ int battle_calc_return_damage(struct block_list *bl, int damage, int flag) {
rdamage += damage * sd->short_weapon_damage_return / 100;
if(rdamage < 1) rdamage = 1;
}
- if (sc_data && sc_data[SC_REFLECTSHIELD].timer != -1)
+ if (sc && sc->data[SC_REFLECTSHIELD].timer != -1)
{
- rdamage += damage * sc_data[SC_REFLECTSHIELD].val2 / 100;
+ rdamage += damage * sc->data[SC_REFLECTSHIELD].val2 / 100;
if (rdamage < 1) rdamage = 1;
}
} else if (flag & BF_LONG) {
@@ -2980,7 +2970,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
unsigned int tick,int flag)
{
struct map_session_data *sd = NULL, *tsd = NULL;
- struct status_change *sc_data, *tsc_data;
+ struct status_change *sc, *tsc;
int race, ele, damage,rdamage=0;
struct Damage wd;
@@ -2996,9 +2986,14 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
if (target->type == BL_PC)
tsd = (struct map_session_data *)target;
- sc_data = status_get_sc_data(src);
- tsc_data = status_get_sc_data(target);
+ sc = status_get_sc(src);
+ tsc = status_get_sc(target);
+ if (sc && !sc->count) //Avoid sc checks when there's none to check for. [Skotlex]
+ sc = NULL;
+ if (tsc && !tsc->count)
+ tsc = NULL;
+
race = status_get_race(target);
ele = status_get_elem_type(target);
@@ -3014,10 +3009,10 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
}
//Check for counter attacks that block your attack. [Skotlex]
- if(tsc_data)
+ if(tsc)
{
- if(tsc_data[SC_AUTOCOUNTER].timer != -1 &&
- (!sc_data || sc_data[SC_AUTOCOUNTER].timer == -1) &&
+ if(tsc->data[SC_AUTOCOUNTER].timer != -1 &&
+ (!sc || sc->data[SC_AUTOCOUNTER].timer == -1) &&
status_check_skilluse(target, src, KN_AUTOCOUNTER, 0)
) {
int dir = map_calc_dir(target,src->x,src->y);
@@ -3025,7 +3020,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
int dist = distance_bl(src, target);
if(dist <= 0 || (!map_check_dir(dir,t_dir) && dist <= status_get_range(target)+1))
{
- int skilllv = tsc_data[SC_AUTOCOUNTER].val1;
+ int skilllv = tsc->data[SC_AUTOCOUNTER].val1;
clif_skillcastcancel(target); //Remove the casting bar. [Skotlex]
clif_damage(src, target, tick, status_get_amotion(src), 1, 0, 1, 0, 0); //Display MISS.
status_change_end(target,SC_AUTOCOUNTER,-1);
@@ -3033,8 +3028,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
return 0;
}
}
- if (tsc_data[SC_BLADESTOP_WAIT].timer != -1 && !is_boss(src)) {
- int skilllv = tsc_data[SC_BLADESTOP_WAIT].val1;
+ if (tsc->data[SC_BLADESTOP_WAIT].timer != -1 && !is_boss(src)) {
+ int skilllv = tsc->data[SC_BLADESTOP_WAIT].val1;
int duration = skill_get_time2(MO_BLADESTOP,skilllv);
status_change_end(target, SC_BLADESTOP_WAIT, -1);
clif_damage(src, target, tick, status_get_amotion(src), 1, 0, 1, 0, 0); //Display MISS.
@@ -3049,15 +3044,15 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
if(sd && (damage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0 && sd->status.weapon <= 16) // triple blow works with bows ^^ [celest]
{
int triple_rate= 30 - damage; //Base Rate
- if (sc_data && sc_data[SC_SKILLRATE_UP].timer!=-1 && sc_data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK)
+ if (sc && sc->data[SC_SKILLRATE_UP].timer!=-1 && sc->data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK)
{
- triple_rate+= triple_rate*(sc_data[SC_SKILLRATE_UP].val2)/100;
+ triple_rate+= triple_rate*(sc->data[SC_SKILLRATE_UP].val2)/100;
status_change_end(src,SC_SKILLRATE_UP,-1);
}
if (rand()%100 < triple_rate) return skill_attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,damage,tick,0);
}
- else if (sc_data && sc_data[SC_SACRIFICE].timer != -1)
- return skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,sc_data[SC_SACRIFICE].val1,tick,0);
+ else if (sc && sc->data[SC_SACRIFICE].timer != -1)
+ return skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,sc->data[SC_SACRIFICE].val1,tick,0);
wd = battle_calc_weapon_attack(src,target, 0, 0,0);
@@ -3096,12 +3091,12 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
}
}
- if (sc_data && sc_data[SC_AUTOSPELL].timer != -1 && rand()%100 < sc_data[SC_AUTOSPELL].val4) {
+ if (sc && sc->data[SC_AUTOSPELL].timer != -1 && rand()%100 < sc->data[SC_AUTOSPELL].val4) {
int sp = 0, f = 0;
- int skillid = sc_data[SC_AUTOSPELL].val2;
- int skilllv = sc_data[SC_AUTOSPELL].val3;
+ int skillid = sc->data[SC_AUTOSPELL].val2;
+ int skilllv = sc->data[SC_AUTOSPELL].val3;
int i = rand()%100;
- if (sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_SAGE)
+ if (sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_SAGE)
i = 0; //Max chance, no skilllv reduction. [Skotlex]
if (i >= 50) skilllv -= 2;
else if (i >= 15) skilllv--;
@@ -3177,27 +3172,27 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
if (rdamage > 0) //By sending attack type "none" skill_additional_effect won't be invoked. [Skotlex]
battle_delay_damage(tick+wd.amotion, target, src, 0, 0, 0, rdamage, ATK_DEF, 0);
- if (tsc_data) {
- if (tsc_data[SC_POISONREACT].timer != -1 &&
+ if (tsc) {
+ if (tsc->data[SC_POISONREACT].timer != -1 &&
check_distance_bl(src, target, status_get_range(target)+1) &&
status_check_skilluse(target, src, TF_POISON, 0)
) { //Poison React
if (status_get_elem_type(src) == 5) {
- tsc_data[SC_POISONREACT].val2 = 0;
- skill_attack(BF_WEAPON,target,target,src,AS_POISONREACT,sc_data[SC_POISONREACT].val1,tick,0);
+ tsc->data[SC_POISONREACT].val2 = 0;
+ skill_attack(BF_WEAPON,target,target,src,AS_POISONREACT,tsc->data[SC_POISONREACT].val1,tick,0);
} else {
skill_attack(BF_WEAPON,target,target,src,TF_POISON, 5, tick, flag);
- --tsc_data[SC_POISONREACT].val2;
+ --tsc->data[SC_POISONREACT].val2;
}
- if (tsc_data[SC_POISONREACT].val2 <= 0)
+ if (tsc->data[SC_POISONREACT].val2 <= 0)
status_change_end(target, SC_POISONREACT, -1);
}
- if (tsc_data[SC_SPLASHER].timer != -1) //殴ったので対?ロのベナムスプラッシャ?[?態を解?
+ if (tsc->data[SC_SPLASHER].timer != -1) //殴ったので対?ロのベナムスプラッシャ?[?態を解?
status_change_end(target, SC_SPLASHER, -1);
}
//SG_FUSION hp penalty [Komurka]
- if (sd && sc_data && sc_data[SC_FUSION].timer!=-1)
+ if (sd && sc && sc->data[SC_FUSION].timer!=-1)
{
int hp=0;
if(target->type == BL_PC)
diff --git a/src/map/charcommand.c b/src/map/charcommand.c
index 216a6f450..e2d4f84c6 100644
--- a/src/map/charcommand.c
+++ b/src/map/charcommand.c
@@ -561,8 +561,8 @@ int charcommand_option(
if ((pl_sd = map_nick2sd(character)) != NULL) {
if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can change option only to lower or same level
- pl_sd->opt1 = opt1;
- pl_sd->opt2 = opt2;
+ pl_sd->sc.opt1 = opt1;
+ pl_sd->sc.opt2 = opt2;
pc_setoption(pl_sd, opt3);
clif_displaymessage(fd, msg_table[58]); // Character's options changed.
} else {
diff --git a/src/map/charsave.c b/src/map/charsave.c
index 8afa903b6..5ce1fb194 100644
--- a/src/map/charsave.c
+++ b/src/map/charsave.c
@@ -491,14 +491,14 @@ void charsave_save_scdata(int account_id, int char_id, struct status_change* sc_
for(i = 0; i < max_sc; i++)
{
- if (sc_data[i].timer == -1)
+ if (sc.data[i].timer == -1)
continue;
- timer = get_timer(sc_data[i].timer);
+ timer = get_timer(sc.data[i].timer);
if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
continue;
sprintf (tmp_sql, "%s ('%d','%d','%hu','%d','%d','%d','%d','%d'),", tmp_sql, account_id, char_id,
- i, DIFF_TICK(timer->tick,tick), sc_data[i].val1, sc_data[i].val2, sc_data[i].val3, sc_data[i].val4);
+ i, DIFF_TICK(timer->tick,tick), sc.data[i].val1, sc.data[i].val2, sc.data[i].val3, sc.data[i].val4);
count++;
}
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 2ae29ffbd..e22c63c26 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -1148,23 +1148,23 @@ int chrif_save_scdata(struct map_session_data *sd)
chrif_check(-1);
tick = gettick();
- WFIFOHEAD(char_fd, 14 + SC_MAX*sizeof(struct status_change_data));
+ WFIFOHEAD(char_fd, 14 + SC_MAX*sizeof(struct status_change_data));
WFIFOW(char_fd,0) = 0x2b1c;
WFIFOL(char_fd,4) = sd->status.account_id;
WFIFOL(char_fd,8) = sd->status.char_id;
for (i = 0; i < SC_MAX; i++)
{
- if (sd->sc_data[i].timer == -1)
+ if (sd->sc.data[i].timer == -1)
continue;
- timer = get_timer(sd->sc_data[i].timer);
+ timer = get_timer(sd->sc.data[i].timer);
if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
continue;
data.tick = DIFF_TICK(timer->tick,tick); //Duration that is left before ending.
data.type = i;
- data.val1 = sd->sc_data[i].val1;
- data.val2 = sd->sc_data[i].val2;
- data.val3 = sd->sc_data[i].val3;
- data.val4 = sd->sc_data[i].val4;
+ data.val1 = sd->sc.data[i].val1;
+ data.val2 = sd->sc.data[i].val2;
+ data.val3 = sd->sc.data[i].val3;
+ data.val4 = sd->sc.data[i].val4;
memcpy(WFIFOP(char_fd,14 +count*sizeof(struct status_change_data)),
&data, sizeof(struct status_change_data));
count++;
@@ -1467,7 +1467,7 @@ int send_users_tochar(int tid, unsigned int tick, int id, int data) {
WFIFOW(char_fd,0) = 0x2aff;
for (i = 0; i < count; i++) {
if (all_sd[i] &&
- !((battle_config.hide_GM_session || (all_sd[i]->status.option & OPTION_INVISIBLE)) && pc_isGM(all_sd[i])))
+ !((battle_config.hide_GM_session || (all_sd[i]->sc.option & OPTION_INVISIBLE)) && pc_isGM(all_sd[i])))
{
WFIFOL(char_fd,6+8*users) = all_sd[i]->status.account_id;
WFIFOL(char_fd,6+8*users+4) = all_sd[i]->status.char_id;
diff --git a/src/map/clif.c b/src/map/clif.c
index 7aafe9311..6df808a7d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -309,9 +309,9 @@ int clif_send_sub(struct block_list *bl, va_list ap)
//Check if hidden, better to modify the char's buffer than the
//given buffer to prevent intravision affecting the packet as
//it's being received by everyone. [Skotlex]
- if ((sd->special_state.intravision || sd->sc_data[SC_INTRAVISION].timer != -1 ) && bl != src_bl) {
- short *src_option = status_get_option(src_bl);
- if(src_option && (*src_option)&(OPTION_HIDE|OPTION_CLOAK))
+ if ((sd->special_state.intravision || sd->sc.data[SC_INTRAVISION].timer != -1 ) && bl != src_bl) {
+ struct status_change *sc = status_get_sc(src_bl);
+ if(sc && (sc->option)&(OPTION_HIDE|OPTION_CLOAK))
{ //optionの修正
switch(((unsigned short*)buf)[0])
{
@@ -765,7 +765,7 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
if(sd->disguise)
sdoption = OPTION_INVISIBLE;
else {
- sdoption = sd->status.option;
+ sdoption = sd->sc.option;
if(sdoption&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE))
sdoption &= ~OPTION_FALCON;
}
@@ -775,8 +775,8 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->speed;
- WBUFW(buf,8)=sd->opt1;
- WBUFW(buf,10)=sd->opt2;
+ WBUFW(buf,8)=sd->sc.opt1;
+ WBUFW(buf,10)=sd->sc.opt2;
WBUFW(buf,12)=sdoption;
WBUFW(buf,14)=sd->view_class;
WBUFW(buf,16)=sd->status.hair;
@@ -810,8 +810,8 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
WBUFW(buf,0)=0x1d8;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->speed;
- WBUFW(buf,8)=sd->opt1;
- WBUFW(buf,10)=sd->opt2;
+ WBUFW(buf,8)=sd->sc.opt1;
+ WBUFW(buf,10)=sd->sc.opt2;
WBUFW(buf,12)=sdoption;
WBUFW(buf,14)=sd->view_class;
WBUFW(buf,16)=sd->status.hair;
@@ -832,7 +832,7 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) {
WBUFL(buf,34)=sd->status.guild_id;
WBUFW(buf,38)=sd->guild_emblem_id;
WBUFW(buf,40)=sd->status.manner;
- WBUFW(buf,42)=sd->opt3;
+ WBUFW(buf,42)=sd->sc.opt3;
WBUFB(buf,44)=sd->status.karma;
WBUFB(buf,45)=sd->sex;
WBUFPOS(buf,46,sd->bl.x,sd->bl.y);
@@ -858,7 +858,7 @@ static int clif_dis0078(struct map_session_data *sd, unsigned char *buf) {
WBUFW(buf,6)=sd->speed;
WBUFW(buf,8)=0;
WBUFW(buf,10)=0;
- WBUFW(buf,12)=sd->status.option;
+ WBUFW(buf,12)=sd->sc.option;
WBUFW(buf,14)=sd->disguise;
//WBUFL(buf,34)=sd->status.guild_id;
//WBUFL(buf,38)=sd->guild_emblem_id;
@@ -888,7 +888,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
if(sd->disguise)
sdoption = OPTION_INVISIBLE;
else {
- sdoption = sd->status.option;
+ sdoption = sd->sc.option;
if(sdoption&(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE))
sdoption &= ~OPTION_FALCON;
}
@@ -899,8 +899,8 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->speed;
- WBUFW(buf,8)=sd->opt1;
- WBUFW(buf,10)=sd->opt2;
+ WBUFW(buf,8)=sd->sc.opt1;
+ WBUFW(buf,10)=sd->sc.opt2;
WBUFW(buf,12)=sdoption;
WBUFW(buf,14)=sd->view_class;
WBUFW(buf,16)=sd->status.hair;
@@ -918,7 +918,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFW(buf,36)=sd->head_dir;
WBUFL(buf,38)=sd->status.guild_id;
WBUFL(buf,42)=sd->guild_emblem_id;
- WBUFW(buf,46)=sd->opt3;
+ WBUFW(buf,46)=sd->sc.opt3;
WBUFB(buf,48)=sd->status.karma;
WBUFB(buf,49)=sd->sex;
WBUFPOS2(buf,50,sd->bl.x,sd->bl.y,sd->to_x,sd->to_y);
@@ -934,8 +934,8 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFW(buf,0)=0x1da;
WBUFL(buf,2)=sd->bl.id;
WBUFW(buf,6)=sd->speed;
- WBUFW(buf,8)=sd->opt1;
- WBUFW(buf,10)=sd->opt2;
+ WBUFW(buf,8)=sd->sc.opt1;
+ WBUFW(buf,10)=sd->sc.opt2;
WBUFW(buf,12)=sdoption;
WBUFW(buf,14)=sd->view_class;
WBUFW(buf,16)=sd->status.hair;
@@ -957,7 +957,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) {
WBUFL(buf,38)=sd->status.guild_id;
WBUFW(buf,42)=sd->guild_emblem_id;
WBUFW(buf,44)=sd->status.manner;
- WBUFW(buf,46)=sd->opt3;
+ WBUFW(buf,46)=sd->sc.opt3;
WBUFB(buf,48)=sd->status.karma;
WBUFB(buf,49)=sd->sex;
WBUFPOS2(buf,50,sd->bl.x,sd->bl.y,sd->to_x,sd->to_y);
@@ -982,7 +982,7 @@ static int clif_dis007b(struct map_session_data *sd,unsigned char *buf) {
WBUFW(buf,6)=sd->speed;
WBUFW(buf,8)=0;
WBUFW(buf,10)=0;
- WBUFW(buf,12)=sd->status.option;
+ WBUFW(buf,12)=sd->sc.option;
WBUFW(buf,14)=sd->disguise;
WBUFL(buf,22)=gettick();
//WBUFL(buf,38)=sd->status.guild_id;
@@ -1074,9 +1074,9 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=status_get_speed(&md->bl);
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(md->class_);
WBUFW(buf,18)=mob_get_weapon(md->class_);
@@ -1091,7 +1091,7 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
WBUFL(buf,34)=md->guardian_data->guild_id;
WBUFL(buf,38)=md->guardian_data->emblem_id;
}
- WBUFW(buf,42)=md->opt3;
+ WBUFW(buf,42)=md->sc.opt3;
WBUFB(buf,44)=0; // karma
WBUFB(buf,45)=mob_get_sex(md->class_);
WBUFPOS(buf,46,md->bl.x,md->bl.y);
@@ -1109,9 +1109,9 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
WBUFW(buf,0)=0x1d8;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=status_get_speed(&md->bl);
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(md->class_);
WBUFW(buf,18)=mob_get_weapon(md->class_);
@@ -1125,7 +1125,7 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
WBUFL(buf,34)=0; // guild id
WBUFW(buf,38)=0; // emblem id
WBUFW(buf,40)=0; // manner
- WBUFW(buf,42)=md->opt3;
+ WBUFW(buf,42)=md->sc.opt3;
WBUFB(buf,44)=0; // karma
WBUFB(buf,45)=mob_get_sex(md->class_);
WBUFPOS(buf,46,md->bl.x,md->bl.y);
@@ -1144,9 +1144,9 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf)
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=status_get_speed(&md->bl);
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,14)=view_class;
if (md->guardian_data && md->guardian_data->guild_id) { // Added guardian emblems [Valaris]
WBUFL(buf,34)=md->guardian_data->guild_id;
@@ -1180,9 +1180,9 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=status_get_speed(&md->bl);
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(md->class_);
WBUFW(buf,18)=mob_get_weapon(md->class_);
@@ -1198,7 +1198,7 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
WBUFL(buf,38)=md->guardian_data->guild_id;
WBUFL(buf,42)=md->guardian_data->emblem_id;
}
- WBUFW(buf,46)=md->opt3;
+ WBUFW(buf,46)=md->sc.opt3;
WBUFB(buf,48)=0; // karma
WBUFB(buf,49)=mob_get_sex(md->class_);
WBUFPOS2(buf,50,md->bl.x,md->bl.y,md->to_x,md->to_y);
@@ -1215,9 +1215,9 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
WBUFW(buf,0)=0x1da;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=status_get_speed(&md->bl);
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(md->class_);
WBUFW(buf,18)=mob_get_weapon(md->class_);
@@ -1234,7 +1234,7 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
WBUFW(buf,42)=md->guardian_data->emblem_id;
}
WBUFW(buf,44)=0; // manner
- WBUFW(buf,46)=md->opt3;
+ WBUFW(buf,46)=md->sc.opt3;
WBUFB(buf,48)=0; // karma
WBUFB(buf,49)=mob_get_sex(md->class_);
WBUFPOS2(buf,50,md->bl.x,md->bl.y,md->to_x,md->to_y);
@@ -1252,9 +1252,9 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) {
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=status_get_speed(&md->bl);
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,14)=view_class;
WBUFL(buf,22)=gettick();
if (md->guardian_data && md->guardian_data->guild_id) { // Added guardian emblems [Valaris]
@@ -1296,9 +1296,9 @@ static int clif_npc0078(struct npc_data *nd, unsigned char *buf) {
WBUFW(buf,0)=0x78;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,8)=nd->opt1;
- WBUFW(buf,10)=nd->opt2;
- WBUFW(buf,12)=nd->option;
+ WBUFW(buf,8)=nd->sc.opt1;
+ WBUFW(buf,10)=nd->sc.opt2;
+ WBUFW(buf,12)=nd->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(nd->class_);
WBUFW(buf,18)=mob_get_weapon(nd->class_);
@@ -1313,7 +1313,7 @@ static int clif_npc0078(struct npc_data *nd, unsigned char *buf) {
WBUFL(buf,34)=g->guild_id;
WBUFL(buf,38)=g->emblem_id;
}
- WBUFW(buf,42)=nd->opt3;
+ WBUFW(buf,42)=nd->sc.opt3;
WBUFB(buf,44)=0; // karma
WBUFB(buf,45)=mob_get_sex(nd->class_);
WBUFPOS(buf,46,nd->bl.x,nd->bl.y);
@@ -1331,9 +1331,9 @@ static int clif_npc0078(struct npc_data *nd, unsigned char *buf) {
WBUFW(buf,0)=0x1d8;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,8)=nd->opt1;
- WBUFW(buf,10)=nd->opt2;
- WBUFW(buf,12)=nd->option;
+ WBUFW(buf,8)=nd->sc.opt1;
+ WBUFW(buf,10)=nd->sc.opt2;
+ WBUFW(buf,12)=nd->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(nd->class_);
WBUFW(buf,18)=mob_get_weapon(nd->class_);
@@ -1347,7 +1347,7 @@ static int clif_npc0078(struct npc_data *nd, unsigned char *buf) {
WBUFL(buf,34)=0; // guild id
WBUFW(buf,38)=0; // emblem id
WBUFW(buf,40)=0; // manner
- WBUFW(buf,42)=nd->opt3;
+ WBUFW(buf,42)=nd->sc.opt3;
WBUFB(buf,44)=0; // karma
WBUFB(buf,45)=mob_get_sex(nd->class_);
WBUFPOS(buf,46,nd->bl.x,nd->bl.y);
@@ -1400,9 +1400,9 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) {
WBUFW(buf,0)=0x7b;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,8)=nd->opt1;
- WBUFW(buf,10)=nd->opt2;
- WBUFW(buf,12)=nd->option;
+ WBUFW(buf,8)=nd->sc.opt1;
+ WBUFW(buf,10)=nd->sc.opt2;
+ WBUFW(buf,12)=nd->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(nd->class_);
WBUFW(buf,18)=mob_get_weapon(nd->class_);
@@ -1418,7 +1418,7 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) {
WBUFL(buf,38)=g->guild_id;
WBUFL(buf,42)=g->emblem_id;
}
- WBUFW(buf,46)=nd->opt3;
+ WBUFW(buf,46)=nd->sc.opt3;
WBUFB(buf,48)=0; // karma
WBUFB(buf,49)=mob_get_sex(nd->class_);
WBUFPOS2(buf,50,nd->bl.x,nd->bl.y,nd->to_x,nd->to_y);
@@ -1435,9 +1435,9 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) {
WBUFW(buf,0)=0x1da;
WBUFL(buf,2)=nd->bl.id;
WBUFW(buf,6)=nd->speed;
- WBUFW(buf,8)=nd->opt1;
- WBUFW(buf,10)=nd->opt2;
- WBUFW(buf,12)=nd->option;
+ WBUFW(buf,8)=nd->sc.opt1;
+ WBUFW(buf,10)=nd->sc.opt2;
+ WBUFW(buf,12)=nd->sc.option;
WBUFW(buf,14)=view_class;
WBUFW(buf,16)=mob_get_hair(nd->class_);
WBUFW(buf,18)=mob_get_weapon(nd->class_);
@@ -1454,7 +1454,7 @@ static int clif_npc007b(struct npc_data *nd, unsigned char *buf) {
WBUFW(buf,42)=g->emblem_id;
}
WBUFW(buf,44)=0; // manner
- WBUFW(buf,46)=nd->opt3;
+ WBUFW(buf,46)=nd->sc.opt3;
WBUFB(buf,48)=0; // karma
WBUFB(buf,49)=mob_get_sex(nd->class_);
WBUFPOS2(buf,50,nd->bl.x,nd->bl.y,nd->to_x,nd->to_y);
@@ -1812,7 +1812,7 @@ int clif_spawnpc(struct map_session_data *sd) {
WBUFW(buf,0)=0x7c;
WBUFL(buf,2)=-sd->bl.id;
WBUFW(buf,6)=sd->speed;
- WBUFW(buf,12)=sd->status.option;
+ WBUFW(buf,12)=sd->sc.option;
WBUFW(buf,20)=sd->disguise;
WBUFPOS(buf,36,sd->bl.x,sd->bl.y);
clif_send(buf,packet_len_table[0x7c],&sd->bl,AREA);
@@ -1934,9 +1934,9 @@ int clif_spawnmob(struct mob_data *md)
WBUFW(buf,0)=0x7c;
WBUFL(buf,2)=md->bl.id;
WBUFW(buf,6)=md->speed;
- WBUFW(buf,8)=md->opt1;
- WBUFW(buf,10)=md->opt2;
- WBUFW(buf,12)=md->option;
+ WBUFW(buf,8)=md->sc.opt1;
+ WBUFW(buf,10)=md->sc.opt2;
+ WBUFW(buf,12)=md->sc.option;
WBUFW(buf,20)=viewclass;
WBUFPOS(buf,36,md->bl.x,md->bl.y);
clif_send(buf,packet_len_table[0x7c],&md->bl,AREA);
@@ -3548,11 +3548,10 @@ int clif_misceffect2(struct block_list *bl, int type) {
int clif_changeoption(struct block_list* bl)
{
unsigned char buf[32];
- short option;
+ struct status_change *sc;
nullpo_retr(0, bl);
-
- option = *status_get_option(bl);
+ sc = status_get_sc(bl);
WBUFW(buf,0) = 0x119;
if(bl->type==BL_PC && ((struct map_session_data *)bl)->disguise) {
@@ -3565,14 +3564,14 @@ int clif_changeoption(struct block_list* bl)
WBUFL(buf,2) = -bl->id;
WBUFW(buf,6) = 0;
WBUFW(buf,8) = 0;
- WBUFW(buf,10) = option;
+ WBUFW(buf,10) = sc?sc->option:0;
WBUFB(buf,12) = 0;
clif_send(buf,packet_len_table[0x119],bl,AREA);
} else {
WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = *status_get_opt1(bl);
- WBUFW(buf,8) = *status_get_opt2(bl);
- WBUFW(buf,10) = option;
+ WBUFW(buf,6) = sc?sc->opt1:0;
+ WBUFW(buf,8) = sc?sc->opt2:0;
+ WBUFW(buf,10) = sc?sc->option:0;
WBUFB(buf,12) = 0; // ??
clif_send(buf,packet_len_table[0x119],bl,AREA);
}
@@ -4370,21 +4369,21 @@ static int clif_calc_delay(struct block_list *dst, int type, int delay)
int clif_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2)
{
unsigned char buf[256];
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, src);
nullpo_retr(0, dst);
type = clif_calc_delay(dst, type, ddelay); //Type defaults to 0 for normal attacks.
- sc_data = status_get_sc_data(dst);
+ sc = status_get_sc(dst);
- if(sc_data) {
- if(sc_data[SC_HALLUCINATION].timer != -1) {
+ if(sc && sc->count) {
+ if(sc->data[SC_HALLUCINATION].timer != -1) {
if(damage > 0)
- damage = damage*(5+sc_data[SC_HALLUCINATION].val1) + rand()%100;
+ damage = damage*(5+sc->data[SC_HALLUCINATION].val1) + rand()%100;
if(damage2 > 0)
- damage2 = damage2*(5+sc_data[SC_HALLUCINATION].val1) + rand()%100;
+ damage2 = damage2*(5+sc->data[SC_HALLUCINATION].val1) + rand()%100;
}
}
@@ -5097,17 +5096,17 @@ 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)
{
unsigned char buf[64];
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, src);
nullpo_retr(0, dst);
type = clif_calc_delay(dst, (type>0)?type:skill_get_hit(skill_id), ddelay);
- sc_data = status_get_sc_data(dst);
+ sc = status_get_sc(dst);
- if(sc_data) {
- if(sc_data[SC_HALLUCINATION].timer != -1 && damage > 0)
- damage = damage*(5+sc_data[SC_HALLUCINATION].val1) + rand()%100;
+ if(sc && sc->count) {
+ if(sc->data[SC_HALLUCINATION].timer != -1 && damage > 0)
+ damage = damage*(5+sc->data[SC_HALLUCINATION].val1) + rand()%100;
}
#if PACKETVER < 3
@@ -5164,17 +5163,17 @@ 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)
{
unsigned char buf[64];
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, src);
nullpo_retr(0, dst);
type = clif_calc_delay(dst, (type>0)?type:skill_get_hit(skill_id), ddelay);
- sc_data = status_get_sc_data(dst);
+ sc = status_get_sc(dst);
- if(sc_data) {
- if(sc_data[SC_HALLUCINATION].timer != -1 && damage > 0)
- damage = damage*(5+sc_data[SC_HALLUCINATION].val1) + rand()%100;
+ if(sc && sc->count) {
+ if(sc->data[SC_HALLUCINATION].timer != -1 && damage > 0)
+ damage = damage*(5+sc->data[SC_HALLUCINATION].val1) + rand()%100;
}
WBUFW(buf,0)=0x115;
@@ -5692,7 +5691,7 @@ int clif_pvpset(struct map_session_data *sd,int pvprank,int pvpnum,int type)
WBUFW(buf,0) = 0x19a;
WBUFL(buf,2) = sd->bl.id;
- if(sd->status.option&0x46)
+ if(sd->sc.option&0x46)
// WTF? a -1 to an unsigned value...
WBUFL(buf,6) = 0xFFFFFFFF;
else
@@ -8061,7 +8060,6 @@ int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int ty
if(type)
clif_GM_kickack(sd,tsd->status.account_id);
- tsd->opt1 = tsd->opt2 = 0;
WFIFOHEAD(tsd->fd,packet_len_table[0x18b]);
WFIFOW(tsd->fd,0) = 0x18b;
WFIFOW(tsd->fd,2) = 0;
@@ -8757,15 +8755,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
(sd->view_class==JOB_WEDDING && !battle_config.wedding_ignorepalette) || (sd->view_class==JOB_XMAS && !battle_config.xmas_ignorepalette)))
clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->status.clothes_color);
- /* There shouldn't be a need for this anymore because... [Skotlex]
- * 1. sc_data is saved and loaded now.
- * 2. if it fails (sc_data is not being saved?) players can just reuse the skill.
- //if(sd->status.hp<sd->status.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 &&
- if(sd->status.hp<sd->status.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 &&
- (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ))
- // オートバーサーク発動
- status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0);
- */
if(battle_config.muting_players && sd->status.manner < 0 && battle_config.manner_system)
status_change_start(&sd->bl,SC_NOCHAT,0,0,0,0,0,0);
@@ -8861,7 +8850,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) {
if (!pc_can_move(sd))
return;
- if(sd->sc_data && sd->sc_data[SC_RUN].timer != -1)
+ if(sd->sc.count && sd->sc.data[SC_RUN].timer != -1)
return;
if (sd->invincible_timer != -1)
@@ -8893,7 +8882,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) {
WFIFOW(fd,0) = 0x18b;
/* Rovert's prevent logout option fixed [Valaris] */
- if (sd->sc_data[SC_CLOAKING].timer==-1 && sd->sc_data[SC_HIDING].timer==-1 &&
+ if (sd->sc.data[SC_CLOAKING].timer==-1 && sd->sc.data[SC_HIDING].timer==-1 &&
(!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout)
) {
clif_setwaitclose(fd);
@@ -9059,10 +9048,10 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
}
if ((is_atcommand(fd, sd, message, 0) != AtCommand_None) ||
- (is_charcommand(fd, sd, message,0) != CharCommand_None) ||
- (sd->sc_data &&
- (sd->sc_data[SC_BERSERK].timer != -1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer != -1 ))) //チャット禁止
+ (is_charcommand(fd, sd, message,0) != CharCommand_None))
+ return;
+ if (sd->sc.count &&
+ (sd->sc.data[SC_BERSERK].timer != -1 || sd->sc.data[SC_NOCHAT].timer != -1 ))
return;
buf = (unsigned char*)aCallocA(RFIFOW(fd,2) + 4, sizeof(char));
@@ -9251,12 +9240,13 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
clif_clearchar_area(&sd->bl, 1);
return;
}
- if (sd->npc_id != 0 || sd->opt1 > 0 || sd->status.option & 2 || sd->state.storage_flag ||
- (sd->sc_data &&
- (sd->sc_data[SC_TRICKDEAD].timer != -1 ||
- sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc_data[SC_DANCING].timer != -1))) //ダンス中
+ if (sd->npc_id || sd->sc.opt1 || sd->sc.option&OPTION_HIDE || sd->state.storage_flag)
+ return;
+
+ if (sd->sc.count &&
+ (sd->sc.data[SC_TRICKDEAD].timer != -1 ||
+ sd->sc.data[SC_AUTOCOUNTER].timer != -1 ||
+ sd->sc.data[SC_BLADESTOP].timer != -1))
return;
tick = gettick();
@@ -9275,9 +9265,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
switch(action_type) {
case 0x00: // once attack
case 0x07: // continuous attack
- if(sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class==JOB_WEDDING)
- return;
- if(sd->sc_data[SC_XMAS].timer != -1 || sd->view_class==JOB_XMAS)
+ if(sd->view_class==JOB_WEDDING || sd->view_class==JOB_XMAS)
return;
if (sd->vender_id != 0)
return;
@@ -9295,6 +9283,11 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 3) {
if (sd->skilltimer != -1) //No sitting while casting :P
break;
+ if (sd->sc.count && (
+ sd->sc.data[SC_DANCING].timer != -1 ||
+ (sd->sc.data[SC_GRAVITATION].timer != -1 && sd->sc.data[SC_GRAVITATION].val3 == BCT_SELF)
+ )) //No sitting during these states neither.
+ break;
pc_stopattack(sd);
pc_stop_walking(sd, 1);
pc_setsit(sd);
@@ -9376,15 +9369,16 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
sprintf(gm_command, "%s : %s", sd->status.name, RFIFOP(fd,28));
if ((is_charcommand(fd, sd, gm_command, 0) != CharCommand_None) ||
- (is_atcommand(fd, sd, gm_command, 0) != AtCommand_None) ||
- (sd && sd->sc_data &&
- (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer != -1))) //チャット禁止
+ (is_atcommand(fd, sd, gm_command, 0) != AtCommand_None)) {
+ if(gm_command) aFree(gm_command);
+ return;
+ }
+ if (sd->sc.count &&
+ (sd->sc.data[SC_BERSERK].timer!=-1 || sd->sc.data[SC_NOCHAT].timer != -1))
{
if(gm_command) aFree(gm_command);
return;
}
-
if(gm_command) aFree(gm_command);
//Chat Logging type 'W' / Whisper
@@ -9449,7 +9443,7 @@ if ((strncasecmp((const char*)RFIFOP(fd,4),"NPC:",4) == 0) && (strlen((const cha
sd->state.mainchat = 1;
clif_displaymessage(fd, msg_txt(380)); // Main chat has been activated.
}
- if (sd->sc_data[SC_NOCHAT].timer != -1) {
+ if (sd->sc.data[SC_NOCHAT].timer != -1) {
clif_displaymessage(fd, msg_txt(387));
return;
}
@@ -9477,7 +9471,7 @@ if ((strncasecmp((const char*)RFIFOP(fd,4),"NPC:",4) == 0) && (strlen((const cha
// otherwise, send message and answer immediatly
else {
if (dstsd->ignoreAll == 1) {
- if (dstsd->status.option & OPTION_INVISIBLE && pc_isGM(sd) < pc_isGM(dstsd))
+ if (dstsd->sc.option & OPTION_INVISIBLE && pc_isGM(sd) < pc_isGM(dstsd))
clif_wis_end(fd, 1); // 1: target character is not loged in
else
clif_wis_end(fd, 3); // 3: everyone ignored by target
@@ -9547,12 +9541,14 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) {
if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m)
return;
- if( sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 || sd->trade_partner!=0 ||
- pc_iscloaking(sd) || pc_ischasewalk(sd) || //Disable cloaking/chasewalking characters from looting [Skotlex]
- sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc_data[SC_NOCHAT].timer!=-1 ) //会話禁止
- {
+ if(sd->npc_id || sd->vender_id || sd->sc.opt1 || sd->trade_partner ||
+ pc_iscloaking(sd) || pc_ischasewalk(sd)) //Disable cloaking/chasewalking characters from looting [Skotlex]
+ return;
+ if(sd->sc.count && (
+ sd->sc.data[SC_TRICKDEAD].timer != -1 || //死んだふり
+ sd->sc.data[SC_BLADESTOP].timer != -1 || //白刃取り
+ sd->sc.data[SC_NOCHAT].timer!=-1 ) //会話禁止
+ ) {
clif_additem(sd,0,0,6); // send fail packet! [Valaris]
return;
}
@@ -9572,9 +9568,12 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) {
clif_clearchar_area(&sd->bl, 1);
return;
}
- if (sd->npc_id != 0 || sd->vender_id != 0 || sd->opt1 > 0 || sd->trade_partner != 0 ||
- sd->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
- sd->sc_data[SC_BLADESTOP].timer != -1)//白刃取り
+ if (sd->npc_id || sd->vender_id || sd->sc.opt1 || sd->trade_partner)
+ return;
+ if (sd->sc.count && (
+ sd->sc.data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ sd->sc.data[SC_BLADESTOP].timer != -1//白刃取り
+ ))
return;
item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2;
@@ -9593,15 +9592,22 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) {
clif_clearchar_area(&sd->bl, 1);
return;
}
- if (sd->vender_id != 0 || (sd->opt1 > 0 && sd->opt1 != OPT1_STONEWAIT) || sd->trade_partner != 0)
+ if (sd->vender_id || sd->trade_partner)
return;
- if (sd->npc_id!=0 && sd->npc_id != sd->npc_item_flag) //This flag enables you to use items while in an NPC. [Skotlex]
+
+ if (sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT)
return;
- if (sd->sc_data[SC_TRICKDEAD].timer != -1 || //死んだふり
- sd->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク
- sd->sc_data[SC_NOCHAT].timer!=-1 ||
- sd->sc_data[SC_GRAVITATION].timer!=-1) //会話禁止
+
+ if (sd->npc_id && sd->npc_id != sd->npc_item_flag) //This flag enables you to use items while in an NPC. [Skotlex]
+ return;
+
+ if (sd->sc.count && (
+ sd->sc.data[SC_TRICKDEAD].timer != -1 || //死んだふり
+ sd->sc.data[SC_BLADESTOP].timer != -1 || //白刃取り
+ sd->sc.data[SC_BERSERK].timer!=-1 || //バーサーク
+ sd->sc.data[SC_NOCHAT].timer!=-1 ||
+ sd->sc.data[SC_GRAVITATION].timer!=-1 //会話禁止
+ ))
return;
if (sd->invincible_timer != -1)
@@ -9635,7 +9641,8 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
if(sd->vender_id != 0 || sd->trade_partner != 0)
return;
- if(sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1 ) return;
+ if(sd->sc.data[SC_BLADESTOP].timer!=-1 || sd->sc.data[SC_BERSERK].timer!=-1 )
+ return;
if(sd->status.inventory[index].identify != 1) { // 未鑑定
clif_equipitemack(sd,index,0,0); // fail
@@ -9665,7 +9672,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
clif_clearchar_area(&sd->bl,1);
return;
}
- if(sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0 || sd->trade_partner != 0)
+ if(sd->npc_id!=0 || sd->vender_id != 0 || sd->sc.opt1 > 0 || sd->trade_partner != 0)
return;
index = RFIFOW(fd,2)-2;
@@ -9972,7 +9979,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
return;
} else if (DIFF_TICK(tick, sd->canact_tick) < 0 &&
// allow monk combos to ignore this delay [celest]
- !(sd->sc_count && sd->sc_data[SC_COMBO].timer!=-1 &&
+ !(sd->sc.count && sd->sc.data[SC_COMBO].timer!=-1 &&
(skillnum == MO_EXTREMITYFIST ||
skillnum == MO_CHAINCOMBO ||
skillnum == MO_COMBOFINISH ||
@@ -9983,12 +9990,9 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
return;
}
- if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) ||
- sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 ||
- sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == JOB_WEDDING ||
- sd->sc_data[SC_XMAS].timer != -1 || sd->view_class == JOB_XMAS)
-
+ if (sd->view_class == JOB_WEDDING || sd->view_class == JOB_XMAS)
return;
+
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
@@ -10002,10 +10006,10 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
} else {
sd->skillitem = 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_TIGERFIST &&
- sd->sc_data[SC_COMBO].val1 != CH_CHAINCRUSH))) {
+ if ((sd->sc.data[SC_COMBO].timer == -1 ||
+ (sd->sc.data[SC_COMBO].val1 != MO_COMBOFINISH &&
+ sd->sc.data[SC_COMBO].val1 != CH_TIGERFIST &&
+ sd->sc.data[SC_COMBO].val1 != CH_CHAINCRUSH))) {
if (!sd->state.skill_flag ) {
sd->state.skill_flag = 1;
clif_skillinfo(sd, MO_EXTREMITYFIST, INF_ATTACK_SKILL, -1);
@@ -10017,8 +10021,8 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
}
}
if (skillnum == TK_JUMPKICK) {
- if (sd->sc_data[SC_COMBO].timer == -1 ||
- sd->sc_data[SC_COMBO].val1 != TK_JUMPKICK) {
+ if (sd->sc.data[SC_COMBO].timer == -1 ||
+ sd->sc.data[SC_COMBO].val1 != TK_JUMPKICK) {
if (!sd->state.skill_flag ) {
sd->state.skill_flag = 1;
clif_skillinfo(sd, TK_JUMPKICK, INF_ATTACK_SKILL, -1);
@@ -10074,11 +10078,9 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, int skilll
return;
}
- if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) ||
- sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 ||
- sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == JOB_WEDDING ||
- sd->sc_data[SC_XMAS].timer != -1 || sd->view_class == JOB_XMAS)
+ if (sd->view_class == JOB_WEDDING || sd->view_class == JOB_XMAS)
return;
+
if (sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
if (sd->skillitem >= 0 && sd->skillitem == skillnum) {
@@ -10132,18 +10134,12 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd)
{
RFIFOHEAD(fd);
- if(sd->chatID) return;
-
- if (sd->npc_id!=0 || sd->vender_id != 0 || (sd->sc_data &&
- (sd->sc_data[SC_TRICKDEAD].timer != -1 ||
- sd->sc_data[SC_BERSERK].timer!=-1 ||
- sd->sc_data[SC_NOCHAT].timer!=-1 ||
- sd->sc_data[SC_WEDDING].timer!=-1 ||
- sd->view_class==JOB_WEDDING ||
- sd->sc_data[SC_XMAS].timer != -1 ||
- sd->view_class == JOB_XMAS)))
+ if(sd->chatID || sd->npc_id || sd->vender_id)
return;
+ if (sd->view_class==JOB_WEDDING || sd->view_class == JOB_XMAS)
+ return;
+
if(sd->invincible_timer != -1)
pc_delinvincibletimer(sd);
@@ -10554,10 +10550,12 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
RFIFOHEAD(fd);
if (is_charcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != CharCommand_None ||
- is_atcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != AtCommand_None ||
- (sd->sc_data &&
- (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer!=-1))) //チャット禁止
+ is_atcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != AtCommand_None)
+ return;
+ if (sd->sc.count && (
+ sd->sc.data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
+ sd->sc.data[SC_NOCHAT].timer!=-1 //チャット禁止
+ ))
return;
party_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
@@ -10755,10 +10753,12 @@ void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
RFIFOHEAD(fd);
if (is_charcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != CharCommand_None ||
- is_atcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != AtCommand_None ||
- (sd->sc_data &&
- (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
- sd->sc_data[SC_NOCHAT].timer!=-1))) //チャット禁止
+ is_atcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != AtCommand_None)
+ return;
+ if (sd->sc.count && (
+ sd->sc.data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可
+ sd->sc.data[SC_NOCHAT].timer!=-1 //チャット禁止
+ ))
return;
guild_send_message(sd, (char*)RFIFOP(fd,4), RFIFOW(fd,2)-4);
@@ -10945,11 +10945,11 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) {
void clif_parse_GMHide(int fd, struct map_session_data *sd) { // Modified by [Yor]
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide))) {
- if (sd->status.option & OPTION_INVISIBLE) {
- sd->status.option &= ~OPTION_INVISIBLE;
+ if (sd->sc.option & OPTION_INVISIBLE) {
+ sd->sc.option &= ~OPTION_INVISIBLE;
clif_displaymessage(fd, "Invisible: Off.");
} else {
- sd->status.option |= OPTION_INVISIBLE;
+ sd->sc.option |= OPTION_INVISIBLE;
clif_displaymessage(fd, "Invisible: On.");
}
clif_changeoption(&sd->bl);
diff --git a/src/map/map.c b/src/map/map.c
index 00df83fc0..920909279 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1527,16 +1527,16 @@ int map_quit(struct map_session_data *sd) {
skill_stop_dancing(&sd->bl);// ダンス/演奏中?
//Status that are not saved...
- if(sd->sc_count) {
- if(sd->sc_data[SC_HIDING].timer!=-1)
+ if(sd->sc.count) {
+ if(sd->sc.data[SC_HIDING].timer!=-1)
status_change_end(&sd->bl,SC_HIDING,-1);
- if(sd->sc_data[SC_CLOAKING].timer!=-1)
+ if(sd->sc.data[SC_CLOAKING].timer!=-1)
status_change_end(&sd->bl,SC_CLOAKING,-1);
- if(sd->sc_data[SC_RUN].timer!=-1)
+ if(sd->sc.data[SC_RUN].timer!=-1)
status_change_end(&sd->bl,SC_RUN,-1);
- if(sd->sc_data[SC_SPURT].timer!=-1)
+ if(sd->sc.data[SC_SPURT].timer!=-1)
status_change_end(&sd->bl,SC_SPURT,-1);
- if(sd->sc_data && sd->sc_data[SC_BERSERK].timer!=-1)
+ if(sd->sc.data[SC_BERSERK].timer!=-1)
status_change_end(&sd->bl,SC_BERSERK,-1);
}
skill_clear_unitgroup(&sd->bl); // スキルユニットグル?プの削除
@@ -1557,7 +1557,7 @@ int map_quit(struct map_session_data *sd) {
status_calc_pc(sd,4);
// skill_clear_unitgroup(&sd->bl); // [Sara-chan]
- if (!(sd->status.option & OPTION_INVISIBLE))
+ if (!(sd->sc.option & OPTION_INVISIBLE))
clif_clearchar_area(&sd->bl,2);
chrif_save_scdata(sd); //Save status changes, then clear'em out from memory. [Skotlex]
@@ -1593,7 +1593,7 @@ int map_quit(struct map_session_data *sd) {
} else { //Try to free some data, without saving anything (this could be invoked on map server change. [Skotlex]
if (sd->bl.prev != NULL)
{ //Remove from map...
- if (!(sd->status.option & OPTION_INVISIBLE))
+ if (!(sd->sc.option & OPTION_INVISIBLE))
clif_clearchar_area(&sd->bl,2);
map_delblock(&sd->bl);
}
diff --git a/src/map/map.h b/src/map/map.h
index 28a1748d6..b41f4f1f0 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -305,10 +305,19 @@ struct script_regstr {
int index;
char data[256];
};
-struct status_change {
+
+struct status_change_entry {
int timer;
int val1,val2,val3,val4;
};
+
+struct status_change {
+ struct status_change_entry data[MAX_STATUSCHANGE];
+ short count;
+ short opt1,opt2,opt3;
+ short option;
+};
+
struct vending {
short index;
unsigned short amount;
@@ -469,7 +478,6 @@ struct map_session_data {
unsigned short mapindex;
short to_x,to_y;
short speed,prev_speed;
- short opt1,opt2,opt3;
unsigned char dir,head_dir;
unsigned int client_tick,server_tick;
struct walkpath_data walkpath;
@@ -664,8 +672,7 @@ struct map_session_data {
int regstr_num;
struct script_regstr *regstr;
- struct status_change sc_data[MAX_STATUSCHANGE];
- short sc_count;
+ struct status_change sc;
short mission_mobid; //Stores the target mob_id for TK_MISSION
short mission_count; //Stores the bounty kill count for TK_MISSION
int devotion[5]; //Stores the char IDs of chars devoted to.
@@ -754,13 +761,13 @@ struct npc_data {
unsigned char name[NAME_LENGTH];
unsigned char exname[NAME_LENGTH];
int chat_id;
- short opt1,opt2,opt3,option;
short flag;
int walktimer; // [Valaris]
short to_x,to_y; // [Valaris]
struct walkpath_data walkpath;
unsigned int next_walktime;
unsigned int canmove_tick;
+ struct status_change sc; //They can't have status changes, but.. they want the visual opt values.
struct { // [Valaris]
unsigned state : 8;
@@ -829,7 +836,7 @@ struct mob_data {
unsigned alchemist: 1;
int provoke_flag; // Celest
} state;
- struct status_change sc_data[MAX_STATUSCHANGE];
+ struct status_change sc;
struct walkpath_data walkpath;
struct guardian_data* guardian_data;
struct item *lootitem;
@@ -854,8 +861,6 @@ struct mob_data {
unsigned int last_deadtime,last_spawntime,last_thinktime,last_linktime;
short move_fail_count;
short lootitem_count;
- short sc_count;
- short opt1,opt2,opt3,option;
short min_chase;
int deletetimer;
diff --git a/src/map/mob.c b/src/map/mob.c
index d07b420d2..a1cbeac41 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -463,19 +463,20 @@ int mob_can_move(struct mob_data *md)
{
nullpo_retr(0, md);
- if(DIFF_TICK(md->canmove_tick, gettick()) > 0 || md->skilltimer != -1 || (md->opt1 > 0 && md->opt1 != OPT1_STONEWAIT) || md->option&OPTION_HIDE)
+ if(DIFF_TICK(md->canmove_tick, gettick()) > 0 || md->skilltimer != -1 || (md->sc.opt1 > 0 && md->sc.opt1 != OPT1_STONEWAIT) || md->sc.option&OPTION_HIDE)
return 0;
// アンクル中で動けないとか
- if( md->sc_data[SC_ANKLE].timer != -1 || //アンクルスネア
- md->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
- md->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り
- md->sc_data[SC_SPIDERWEB].timer != -1 || //スパイダーウェッブ
- (md->sc_data[SC_DANCING].timer !=-1 && md->sc_data[SC_DANCING].val1 == CG_HERMODE) || //cannot move while Hermod is active.
- (md->sc_data[SC_GOSPEL].timer !=-1 && md->sc_data[SC_GOSPEL].val4 == BCT_SELF) || // cannot move while gospel is in effect
- md->sc_data[SC_STOP].timer != -1 ||
- md->sc_data[SC_CLOSECONFINE].timer != -1 ||
- md->sc_data[SC_CLOSECONFINE2].timer != -1
- )
+ if(md->sc.count && (
+ md->sc.data[SC_ANKLE].timer != -1 || //アンクルスネア
+ md->sc.data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター
+ md->sc.data[SC_BLADESTOP].timer != -1 || //白刃取り
+ md->sc.data[SC_SPIDERWEB].timer != -1 || //スパイダーウェッブ
+ (md->sc.data[SC_DANCING].timer !=-1 && md->sc.data[SC_DANCING].val1 == CG_HERMODE) || //cannot move while Hermod is active.
+ (md->sc.data[SC_GOSPEL].timer !=-1 && md->sc.data[SC_GOSPEL].val4 == BCT_SELF) || // cannot move while gospel is in effect
+ md->sc.data[SC_STOP].timer != -1 ||
+ md->sc.data[SC_CLOSECONFINE].timer != -1 ||
+ md->sc.data[SC_CLOSECONFINE2].timer != -1
+ ))
return 0;
return 1;
@@ -565,7 +566,7 @@ static int mob_walk(struct mob_data *md,unsigned int tick,int data)
map_foreachinmovearea(clif_mobinsight,md->bl.m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,-dx,-dy,BL_PC,md);
md->state.state=MS_IDLE;
- if(md->option&OPTION_CLOAK)
+ if(md->sc.option&OPTION_CLOAK)
skill_check_cloaking(&md->bl);
}
if((i=calc_next_walk_step(md))>0){
@@ -733,12 +734,12 @@ static int mob_attack(struct mob_data *md,unsigned int tick,int data)
if( mobskill_use(md,tick,-1) ) // スキル使用
return 0;
- if(md->sc_data && md->sc_data[SC_WINKCHARM].timer != -1)
+ if(md->sc.count && md->sc.data[SC_WINKCHARM].timer != -1)
clif_emotion(&md->bl, 3);
else
md->target_lv = battle_weapon_attack(&md->bl,tbl,tick,0);
- if(!(battle_config.monster_cloak_check_type&2) && md->sc_data[SC_CLOAKING].timer != -1)
+ if(!(battle_config.monster_cloak_check_type&2) && md->sc.data[SC_CLOAKING].timer != -1)
status_change_end(&md->bl,SC_CLOAKING,-1);
//Mobs can't move if they can't attack neither.
@@ -941,7 +942,7 @@ int mob_walktoxy(struct mob_data *md,int x,int y,int easy)
md->to_x=x;
md->to_y=y;
- if (md->sc_data[SC_CONFUSION].timer != -1) //Randomize target direction.
+ if (md->sc.data[SC_CONFUSION].timer != -1) //Randomize target direction.
map_random_dir(&md->bl, &md->to_x, &md->to_y);
if(md->state.state == MS_WALK)
@@ -1126,27 +1127,27 @@ int mob_spawn (int id)
md->skilltimerskill[i].timer = -1;
for (i = 0; i < MAX_STATUSCHANGE; i++) {
- md->sc_data[i].timer = -1;
- md->sc_data[i].val1 = md->sc_data[i].val2 = md->sc_data[i].val3 = md->sc_data[i].val4 = 0;
+ md->sc.data[i].timer = -1;
+ md->sc.data[i].val1 = md->sc.data[i].val2 = md->sc.data[i].val3 = md->sc.data[i].val4 = 0;
}
- md->sc_count = 0;
- md->opt1 = md->opt2 = md->opt3 = md->option = 0;
+ md->sc.count = 0;
+ md->sc.opt1 = md->sc.opt2 = md->sc.opt3 = md->sc.option = 0;
if(md->db->option){ // Added for carts, falcons and pecos for cloned monsters. [Valaris]
if(md->db->option & 0x0008)
- md->option |= 0x0008;
+ md->sc.option |= 0x0008;
if(md->db->option & 0x0080)
- md->option |= 0x0080;
+ md->sc.option |= 0x0080;
if(md->db->option & 0x0100)
- md->option |= 0x0100;
+ md->sc.option |= 0x0100;
if(md->db->option & 0x0200)
- md->option |= 0x0200;
+ md->sc.option |= 0x0200;
if(md->db->option & 0x0400)
- md->option |= 0x0400;
+ md->sc.option |= 0x0400;
if(md->db->option & OPTION_FALCON)
- md->option |= OPTION_FALCON;
+ md->sc.option |= OPTION_FALCON;
if(md->db->option & OPTION_RIDING)
- md->option |= OPTION_RIDING;
+ md->sc.option |= OPTION_RIDING;
}
memset(md->skillunit, 0, sizeof(md->skillunit));
@@ -1598,10 +1599,10 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
}
// Abnormalities
- if((md->opt1 > 0 && md->opt1 != OPT1_STONEWAIT) || md->state.state == MS_DELAY || md->sc_data[SC_BLADESTOP].timer != -1)
+ if((md->sc.opt1 > 0 && md->sc.opt1 != OPT1_STONEWAIT) || md->state.state == MS_DELAY || md->sc.data[SC_BLADESTOP].timer != -1)
return 0;
- if (md->sc_data && md->sc_data[SC_BLIND].timer != -1)
+ if (md->sc.count && md->sc.data[SC_BLIND].timer != -1)
blind_flag = 1;
mode = status_get_mode(&md->bl);
@@ -2210,9 +2211,13 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
return 0;
}
- if(md->sc_count) {
- if(md->sc_data[SC_CONFUSION].timer != -1)
+ if(md->sc.count) {
+ if(md->sc.data[SC_CONFUSION].timer != -1)
status_change_end(&md->bl, SC_CONFUSION, -1);
+ if(md->sc.data[SC_HIDING].timer != -1)
+ status_change_end(&md->bl, SC_HIDING, -1);
+ if(md->sc.data[SC_CLOAKING].timer != -1)
+ status_change_end(&md->bl, SC_CLOAKING, -1);
}
if(damage > max_hp>>2)
@@ -2297,11 +2302,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
}
} // end addition
- if(md->option&OPTION_HIDE)
- status_change_end(&md->bl, SC_HIDING, -1);
- if(md->option&OPTION_CLOAK)
- status_change_end(&md->bl, SC_CLOAKING, -1);
-
if(md->special_state.ai == 2 && //スフィアーマイン
src && md->master_id == src->id)
{
@@ -2317,11 +2317,11 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
return damage;
//Not the most correct way ever, but this is totally custom anyway.... [Skotlex]
- if (md->sc_data[SC_KAIZEL].timer != -1) {
+ if (md->sc.data[SC_KAIZEL].timer != -1) {
max_hp = status_get_max_hp(&md->bl);
- mob_heal(md, 10*md->sc_data[SC_KAIZEL].val1*max_hp/100);
+ mob_heal(md, 10*md->sc.data[SC_KAIZEL].val1*max_hp/100);
clif_resurrection(&md->bl, 1);
- status_change_start(&md->bl,SkillStatusChangeTable[SL_KAIZEL],10,0,0,0,skill_get_time2(SL_KAIZEL, md->sc_data[SC_KAIZEL].val1),0);
+ status_change_start(&md->bl,SkillStatusChangeTable[SL_KAIZEL],10,0,0,0,skill_get_time2(SL_KAIZEL, md->sc.data[SC_KAIZEL].val1),0);
status_change_end(&md->bl,SC_KAIZEL,-1);
return damage;
}
@@ -2332,7 +2332,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
//changestate will clear all status effects, so we need to know if RICHMANKIM is in effect before then. [Skotlex]
//I just recycled ret because it isn't used until much later and I didn't want to add a new variable for it.
- ret = (md->sc_data[SC_RICHMANKIM].timer != -1)?(25 + 11*md->sc_data[SC_RICHMANKIM].val1):0;
+ ret = (md->sc.data[SC_RICHMANKIM].timer != -1)?(25 + 11*md->sc.data[SC_RICHMANKIM].val1):0;
map_freeblock_lock();
mob_changestate(md,MS_DEAD,0);
@@ -2990,22 +2990,22 @@ int mob_warp(struct mob_data *md,int m,int x,int y,int type)
if(type >= 0) {
if(map[md->bl.m].flag.monster_noteleport)
return 0;
- if(md->sc_count) { //Clear a few status changes (taken directly from pc_setpos). [Skotlex]
- if(md->sc_data[SC_TRICKDEAD].timer != -1)
+ if(md->sc.count) { //Clear a few status changes (taken directly from pc_setpos). [Skotlex]
+ if(md->sc.data[SC_TRICKDEAD].timer != -1)
status_change_end(&md->bl, SC_TRICKDEAD, -1);
- if(md->sc_data[SC_BLADESTOP].timer!=-1)
+ if(md->sc.data[SC_BLADESTOP].timer!=-1)
status_change_end(&md->bl,SC_BLADESTOP,-1);
- if(md->sc_data && md->sc_data[SC_RUN].timer!=-1)
+ if(md->sc.data && md->sc.data[SC_RUN].timer!=-1)
status_change_end(&md->bl,SC_RUN,-1);
- if(md->sc_data[SC_DANCING].timer!=-1)
+ if(md->sc.data[SC_DANCING].timer!=-1)
skill_stop_dancing(&md->bl);
- if (md->sc_data[SC_DEVOTION].timer!=-1)
+ if (md->sc.data[SC_DEVOTION].timer!=-1)
status_change_end(&md->bl,SC_DEVOTION,-1);
- if (md->sc_data[SC_CLOSECONFINE].timer!=-1)
+ if (md->sc.data[SC_CLOSECONFINE].timer!=-1)
status_change_end(&md->bl,SC_CLOSECONFINE,-1);
- if (md->sc_data[SC_CLOSECONFINE2].timer!=-1)
+ if (md->sc.data[SC_CLOSECONFINE2].timer!=-1)
status_change_end(&md->bl,SC_CLOSECONFINE2,-1);
- if (md->sc_data[SC_RUN].timer!=-1)
+ if (md->sc.data[SC_RUN].timer!=-1)
status_change_end(&md->bl,SC_RUN,-1);
}
clif_clearchar_area(&md->bl,type);
@@ -3269,7 +3269,7 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data )
break;
}
- if (md->sc_count && md->sc_data[SC_MAGICPOWER].timer != -1 && md->skillid != HW_MAGICPOWER)
+ if (md->sc.count && md->sc.data[SC_MAGICPOWER].timer != -1 && md->skillid != HW_MAGICPOWER)
status_change_end(&md->bl, SC_MAGICPOWER, -1);
if (md->db->skill[md->skillidx].emotion >= 0)
@@ -3398,7 +3398,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx)
if(!status_check_skilluse(&md->bl, target, skill_id, 0))
return 0;
- if(md->sc_data && md->sc_data[SC_WINKCHARM].timer != -1 && target->type == BL_PC) {
+ if(md->sc.count && md->sc.data[SC_WINKCHARM].timer != -1 && target->type == BL_PC) {
clif_emotion(&md->bl, 3);
return 0;
}
@@ -3457,7 +3457,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx)
md->skilllv = skill_lv;
md->skillidx = skill_idx;
- if(!(battle_config.monster_cloak_check_type&2) && md->sc_data[SC_CLOAKING].timer != -1 && md->skillid != AS_CLOAKING)
+ if(!(battle_config.monster_cloak_check_type&2) && md->sc.data[SC_CLOAKING].timer != -1 && md->skillid != AS_CLOAKING)
status_change_end(&md->bl,SC_CLOAKING,-1);
if( casttime>0 ){
@@ -3529,7 +3529,7 @@ int mobskill_use_pos( struct mob_data *md,
md->skillid = skill_id;
md->skilllv = skill_lv;
md->skillidx = skill_idx;
- if(!(battle_config.monster_cloak_check_type&2) && md->sc_data[SC_CLOAKING].timer != -1)
+ if(!(battle_config.monster_cloak_check_type&2) && md->sc.data[SC_CLOAKING].timer != -1)
status_change_end(&md->bl,SC_CLOAKING,-1);
if( casttime>0 ){
md->skilltimer =
@@ -3627,11 +3627,11 @@ int mob_getfriendstatus_sub(struct block_list *bl,va_list ap)
if( cond2==-1 ){
int j;
for(j=SC_COMMON_MIN;j<=SC_COMMON_MAX && !flag;j++){
- if ((flag=(md->sc_data[j].timer!=-1))) //Once an effect was found, break out. [Skotlex]
+ if ((flag=(md->sc.data[j].timer!=-1))) //Once an effect was found, break out. [Skotlex]
break;
}
}else
- flag=( md->sc_data[cond2].timer!=-1 );
+ flag=( md->sc.data[cond2].timer!=-1 );
if( flag^( cond1==MSC_FRIENDSTATUSOFF ) )
(*fr)=md;
@@ -3697,15 +3697,15 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
}
case MSC_MYSTATUSON: // status[num] on
case MSC_MYSTATUSOFF: // status[num] off
- if (!md->sc_data) {
+ if (!md->sc.count) {
flag = 0;
} else if (ms[i].cond2 == -1) {
int j;
for (j = SC_COMMON_MIN; j <= SC_COMMON_MAX; j++)
- if ((flag = (md->sc_data[j].timer != -1)) != 0)
+ if ((flag = (md->sc.data[j].timer != -1)) != 0)
break;
} else {
- flag = (md->sc_data[ms[i].cond2].timer != -1);
+ flag = (md->sc.data[ms[i].cond2].timer != -1);
}
flag ^= (ms[i].cond1 == MSC_MYSTATUSOFF); break;
case MSC_FRIENDHPLTMAXRATE: // friend HP < maxhp%
@@ -3961,7 +3961,7 @@ int mob_clone_spawn(struct map_session_data *sd, char *map, int x, int y, const
mob_db_data[class_]->head_top=sd->status.head_top;
mob_db_data[class_]->head_mid=sd->status.head_mid;
mob_db_data[class_]->head_buttom=sd->status.head_bottom;
- mob_db_data[class_]->option=sd->status.option;
+ mob_db_data[class_]->option=sd->sc.option;
mob_db_data[class_]->clothes_color=sd->status.clothes_color;
//Skill copy [Skotlex]
diff --git a/src/map/npc.c b/src/map/npc.c
index 86b4c823c..bcf66db6c 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -104,11 +104,11 @@ int npc_enable(const char *name,int flag)
clif_spawnnpc(nd);
}else if (flag&2){
nd->flag&=~1;
- nd->option = 0x0000;
+ nd->sc.option = 0x0000;
clif_changeoption(&nd->bl);
}else if (flag&4){
nd->flag|=1;
- nd->option = 0x0002;
+ nd->sc.option = 0x0002;
clif_changeoption(&nd->bl);
}else{ // 無効化
nd->flag|=1;
@@ -794,7 +794,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
switch(map[m].npc[i]->bl.subtype) {
case WARP:
// hidden chars cannot use warps -- is it the same for scripts too?
- if (sd->status.option&6 ||
+ if (sd->sc.option&6 ||
(!battle_config.duel_allow_teleport && sd->duel_group)) // duel rstrct [LuzZza]
break;
skill_stop_dancing(&sd->bl);
@@ -1950,10 +1950,10 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin
nd->u.scr.src_id = src_id;
/* Cleaned up above with memset...
nd->chat_id = 0;
- nd->option = 0;
- nd->opt1 = 0;
- nd->opt2 = 0;
- nd->opt3 = 0;
+ nd->sc.option = 0;
+ nd->sc.opt1 = 0;
+ nd->sc.opt2 = 0;
+ nd->sc.opt3 = 0;
*/
nd->walktimer = -1;
diff --git a/src/map/pc.c b/src/map/pc.c
index 107aaf276..34933136a 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -352,24 +352,31 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
*/
int pc_can_move(struct map_session_data *sd)
{
- if (sd->canmove_tick > gettick() || (sd->opt1 > 0 && sd->opt1 != OPT1_STONEWAIT) ||
- sd->sc_data[SC_ANKLE].timer != -1 ||
- sd->sc_data[SC_AUTOCOUNTER].timer !=-1 ||
- sd->sc_data[SC_TRICKDEAD].timer !=-1 ||
- sd->sc_data[SC_BLADESTOP].timer !=-1 ||
- sd->sc_data[SC_SPIDERWEB].timer !=-1 ||
- (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val4 && sd->sc_data[SC_LONGING].timer == -1) ||
- (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val1 == CG_HERMODE) || //cannot move while Hermod is active.
- (sd->sc_data[SC_GOSPEL].timer !=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_SELF) || // cannot move while gospel is in effect
- sd->sc_data[SC_STOP].timer != -1 ||
- sd->sc_data[SC_CLOSECONFINE].timer != -1 ||
- sd->sc_data[SC_CLOSECONFINE2].timer != -1
- )
+
+ if (sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT)
return 0;
- if ((sd->status.option & 2) && pc_checkskill(sd, RG_TUNNELDRIVE) <= 0)
+ if ((sd->sc.option & OPTION_HIDE) && pc_checkskill(sd, RG_TUNNELDRIVE) <= 0)
+ return 0;
+
+ if (DIFF_TICK(sd->canmove_tick, gettick()) > 0)
return 0;
+ if (sd->sc.count && (
+ sd->sc.data[SC_ANKLE].timer != -1 ||
+ sd->sc.data[SC_AUTOCOUNTER].timer !=-1 ||
+ sd->sc.data[SC_TRICKDEAD].timer !=-1 ||
+ sd->sc.data[SC_BLADESTOP].timer !=-1 ||
+ sd->sc.data[SC_SPIDERWEB].timer !=-1 ||
+ (sd->sc.data[SC_DANCING].timer !=-1 && sd->sc.data[SC_DANCING].val4 && sd->sc.data[SC_LONGING].timer == -1) ||
+ (sd->sc.data[SC_DANCING].timer !=-1 && sd->sc.data[SC_DANCING].val1 == CG_HERMODE) || //cannot move while Hermod is active.
+ (sd->sc.data[SC_GOSPEL].timer !=-1 && sd->sc.data[SC_GOSPEL].val4 == BCT_SELF) || // cannot move while gospel is in effect
+ sd->sc.data[SC_STOP].timer != -1 ||
+ sd->sc.data[SC_CLOSECONFINE].timer != -1 ||
+ sd->sc.data[SC_CLOSECONFINE2].timer != -1
+ ))
+ return 0;
+
return 1;
}
@@ -409,6 +416,7 @@ int pc_makesavestatus(struct map_session_data *sd)
// 死亡?態だったのでhpを1、位置をセ?ブ場所に?更
if(!sd->state.waitingdisconnect) {
+ sd->sc.option = sd->sc.option;
if(pc_isdead(sd)){
pc_setrestartvalue(sd,0);
memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
@@ -593,28 +601,31 @@ int pc_isequip(struct map_session_data *sd,int n)
return 0;
if(map[sd->bl.m].zone && map[sd->bl.m].flag.restricted && (item->flag.no_equip&map[sd->bl.m].zone || !pc_isAllowedCardOn(sd,item->slot,n,map[sd->bl.m].zone)))
return 0;
- if((item->equip & 0x0002 || item->equip & 0x0020) && item->type == 4 && sd->sc_data[SC_STRIPWEAPON].timer != -1) // Also works with left-hand weapons [DracoRPG]
- return 0;
- if(item->equip & 0x0020 && item->type == 5 && sd->sc_data[SC_STRIPSHIELD].timer != -1) // Also works with left-hand weapons [DracoRPG]
- return 0;
- if(item->equip & 0x0010 && sd->sc_data[SC_STRIPARMOR].timer != -1)
- return 0;
- if(item->equip & 0x0100 && sd->sc_data[SC_STRIPHELM].timer != -1)
- return 0;
+ if (sd->sc.count) {
+
+ if((item->equip & 0x0002 || item->equip & 0x0020) && item->type == 4 && sd->sc.data[SC_STRIPWEAPON].timer != -1) // Also works with left-hand weapons [DracoRPG]
+ return 0;
+ if(item->equip & 0x0020 && item->type == 5 && sd->sc.data[SC_STRIPSHIELD].timer != -1) // Also works with left-hand weapons [DracoRPG]
+ return 0;
+ if(item->equip & 0x0010 && sd->sc.data[SC_STRIPARMOR].timer != -1)
+ return 0;
+ if(item->equip & 0x0100 && sd->sc.data[SC_STRIPHELM].timer != -1)
+ return 0;
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_SUPERNOVICE) {
- //Spirit of Super Novice equip bonuses. [Skotlex]
- if (sd->status.base_level > 90 && item->equip & 0x301)
- return 1; //Can equip all helms
- if (sd->status.base_level > 96 && item->equip & 0x022 && item->type == 4)
- switch(item->look) { //In weapons, the look determines type of weapon.
- case 0x01: //Level 4 Knives are equippable.. this means all knives, I'd guess?
- case 0x02: //All 1H swords
- case 0x06: //All 1H Axes
- case 0x08: //All Maces
- case 0x0a: //All Staffs
- return 1;
- }
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_SUPERNOVICE) {
+ //Spirit of Super Novice equip bonuses. [Skotlex]
+ if (sd->status.base_level > 90 && item->equip & 0x301)
+ return 1; //Can equip all helms
+ if (sd->status.base_level > 96 && item->equip & 0x022 && item->type == 4)
+ switch(item->look) { //In weapons, the look determines type of weapon.
+ case 0x01: //Level 4 Knives are equippable.. this means all knives, I'd guess?
+ case 0x02: //All 1H swords
+ case 0x06: //All 1H Axes
+ case 0x08: //All Maces
+ case 0x0a: //All Staffs
+ return 1;
+ }
+ }
}
//Not equipable by class. [Skotlex]
if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
@@ -658,7 +669,7 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where)
default:
return 0;
}
- if (sd->sc_count && sd->sc_data[i].timer != -1)
+ if (sd->sc.count && sd->sc.data[i].timer != -1)
return 0;
for (i = 0; i < 11; i++) {
@@ -755,15 +766,16 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
// ステ?タス異常の初期化
for(i = 0; i < MAX_STATUSCHANGE; i++) {
- sd->sc_data[i].timer=-1;
+ sd->sc.data[i].timer=-1;
}
- sd->sc_count=0;
+ sd->sc.count=0;
if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
(pc_isGM(sd) >= get_atcommand_level(AtCommand_Hide)))
sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE);
else
sd->status.option &= OPTION_MASK;
+ sd->sc.option = sd->status.option; //This is the actual option used in battle.
// パ?ティ??係の初期化
sd->party_x = -1;
sd->party_y = -1;
@@ -1016,7 +1028,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
sd->status.skill[i].flag=0;
}
else
- if(sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_BARDDANCER && i >= DC_HUMMING && i<= DC_SERVICEFORYOU)
+ if(sd->sc.count && sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_BARDDANCER && i >= DC_HUMMING && i<= DC_SERVICEFORYOU)
{ //Enable Bard/Dancer spirit linked skills.
if (sd->status.sex) { //Link dancer skills to bard.
sd->status.skill[i].id=i;
@@ -1058,7 +1070,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
f=0; // Do not unlock normal skills when Basic Skills is not maxed out (can happen because of skill reset)
}
if(sd->status.skill[id].id==0 ){
- if(sd->sc_data[SC_SPIRIT].timer != -1 && skill_get_inf2(id)&INF2_SPIRIT_SKILL) { //Enable Spirit Skills. [Skotlex]
+ if(sd->sc.count && sd->sc.data[SC_SPIRIT].timer != -1 && skill_get_inf2(id)&INF2_SPIRIT_SKILL) { //Enable Spirit Skills. [Skotlex]
sd->status.skill[id].id=id;
sd->status.skill[id].lv=1;
sd->status.skill[id].flag=1; //So it is not saved, and tagged as a "bonus" skill.
@@ -1142,17 +1154,17 @@ int pc_checkweighticon(struct map_session_data *sd)
flag=2;
if(flag==1){
- if(sd->sc_data[SC_WEIGHT50].timer==-1)
+ if(sd->sc.data[SC_WEIGHT50].timer==-1)
status_change_start(&sd->bl,SC_WEIGHT50,0,0,0,0,0,0);
}else{
- if(sd->sc_data[SC_WEIGHT50].timer!=-1)
+ if(sd->sc.data[SC_WEIGHT50].timer!=-1)
status_change_end(&sd->bl,SC_WEIGHT50,-1);
}
if(flag==2){
- if(sd->sc_data[SC_WEIGHT90].timer==-1)
+ if(sd->sc.data[SC_WEIGHT90].timer==-1)
status_change_start(&sd->bl,SC_WEIGHT90,0,0,0,0,0,0);
}else{
- if(sd->sc_data[SC_WEIGHT90].timer!=-1)
+ if(sd->sc.data[SC_WEIGHT90].timer!=-1)
status_change_end(&sd->bl,SC_WEIGHT90,-1);
}
return 0;
@@ -2789,18 +2801,26 @@ int pc_useitem(struct map_session_data *sd,int n)
amount = sd->status.inventory[n].amount;
if(sd->status.inventory[n].nameid <= 0 ||
sd->status.inventory[n].amount <= 0 ||
- gettick() < sd->canuseitem_tick || //Prevent mass item usage. [Skotlex]
- sd->sc_data[SC_BERSERK].timer!=-1 ||
- sd->sc_data[SC_MARIONETTE].timer!=-1 ||
- sd->sc_data[SC_GRAVITATION].timer!=-1 ||
+ DIFF_TICK(sd->canuseitem_tick, gettick()) > 0 //Prevent mass item usage. [Skotlex]
+ )
+ return 1;
+ if (sd->sc.count && (
+ sd->sc.data[SC_BERSERK].timer!=-1 ||
+ sd->sc.data[SC_MARIONETTE].timer!=-1 ||
+ sd->sc.data[SC_GRAVITATION].timer!=-1 ||
//Cannot use Potions/Healing items while under Gospel.
- (sd->sc_data[SC_GOSPEL].timer!=-1 && sd->sc_data[SC_GOSPEL].val4 != BCT_SELF && sd->inventory_data[n]->type == 0) ||
- (pc_issit(sd) && (sd->itemid == 605 || sd->itemid == 606)) ||
+ (sd->sc.data[SC_GOSPEL].timer!=-1 && sd->sc.data[SC_GOSPEL].val4 != BCT_SELF && sd->inventory_data[n]->type == 0)
+ )) {
+ clif_useitemack(sd,n,0,0);
+ return 1;
+ }
+ if ((pc_issit(sd) && (sd->itemid == 605 || sd->itemid == 606)) ||
//added item_noequip.txt items check by Maya&[Lupus]
(map[sd->bl.m].flag.pvp && (sd->inventory_data[n]->flag.no_equip&1) ) || // PVP
(map_flag_gvg(sd->bl.m) && (sd->inventory_data[n]->flag.no_equip&2) ) || // GVG
(map[sd->bl.m].zone && map[sd->bl.m].flag.restricted && (sd->inventory_data[n]->flag.no_equip&map[sd->bl.m].zone)) || // Zone restriction
- !pc_isUseitem(sd,n) ) {
+ !pc_isUseitem(sd,n)
+ ) {
clif_useitemack(sd,n,0,0);
return 1;
}
@@ -2822,7 +2842,7 @@ int pc_useitem(struct map_session_data *sd,int n)
}
if(sd->status.inventory[n].card[0]==0x00fe && pc_istop10fame(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST)) {
potion_flag = 2; // Famous player's potions have 50% more efficiency
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_ROGUE)
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_ROGUE)
potion_flag = 3; //Even more effective potions.
}
sd->canuseitem_tick= gettick() + battle_config.item_use_interval; //Update item use time.
@@ -3035,7 +3055,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
if(md->state.steal_flag || status_get_mode(bl)&MD_BOSS || md->master_id ||
(md->class_>=1324 && md->class_<1364) || // prevent stealing from treasure boxes [Valaris]
map[md->bl.m].flag.nomobloot || // check noloot map flag [Lorky]
- md->sc_data[SC_STONE].timer != -1 || md->sc_data[SC_FREEZE].timer != -1 //status change check
+ md->sc.data[SC_STONE].timer != -1 || md->sc.data[SC_FREEZE].timer != -1 //status change check
)
return 0;
@@ -3112,7 +3132,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) {
- if (md->sc_data && (md->sc_data[SC_STONE].timer != -1 || md->sc_data[SC_FREEZE].timer != -1))
+ if (md->sc.data && (md->sc.data[SC_STONE].timer != -1 || md->sc.data[SC_FREEZE].timer != -1))
return 0;
skill = pc_checkskill(sd,RG_STEALCOIN)*10;
rate = skill + (sd->status.base_level - md->db->lv)*3 + sd->paramc[4]*2 + sd->paramc[5]*2;
@@ -3188,42 +3208,40 @@ int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,in
m=map_mapindex2mapid(mapindex);
- if (sd->sc_count) {
- if (sd->sc_data[SC_TRICKDEAD].timer != -1)
+ if (sd->sc.count) {
+ if (sd->sc.data[SC_TRICKDEAD].timer != -1)
status_change_end(&sd->bl, SC_TRICKDEAD, -1);
- if (sd->sc_data[SC_BLADESTOP].timer!=-1)
+ if (sd->sc.data[SC_BLADESTOP].timer!=-1)
status_change_end(&sd->bl,SC_BLADESTOP,-1);
- if (sd->sc_data[SC_RUN].timer!=-1)
+ if (sd->sc.data[SC_RUN].timer!=-1)
status_change_end(&sd->bl,SC_RUN,-1);
- if (sd->sc_data[SC_DANCING].timer!=-1) // clear dance effect when warping [Valaris]
+ if (sd->sc.data[SC_DANCING].timer!=-1) // clear dance effect when warping [Valaris]
skill_stop_dancing(&sd->bl);
- if (sd->sc_data[SC_DEVOTION].timer!=-1)
+ if (sd->sc.data[SC_DEVOTION].timer!=-1)
status_change_end(&sd->bl,SC_DEVOTION,-1);
- if (sd->sc_data[SC_CLOSECONFINE].timer!=-1)
+ if (sd->sc.data[SC_CLOSECONFINE].timer!=-1)
status_change_end(&sd->bl,SC_CLOSECONFINE,-1);
- if (sd->sc_data[SC_CLOSECONFINE2].timer!=-1)
+ if (sd->sc.data[SC_CLOSECONFINE2].timer!=-1)
status_change_end(&sd->bl,SC_CLOSECONFINE2,-1);
- if (sd->sc_data[SC_RUN].timer!=-1)
+ if (sd->sc.data[SC_RUN].timer!=-1)
status_change_end(&sd->bl,SC_RUN,-1);
+ if (sd->sc.data[SC_HIDING].timer!=-1)
+ status_change_end(&sd->bl, SC_HIDING, -1);
+ if (sd->sc.data[SC_CLOAKING].timer!=-1)
+ status_change_end(&sd->bl, SC_CLOAKING, -1);
+ if (sd->sc.data[SC_CHASEWALK].timer!=-1)
+ status_change_end(&sd->bl, SC_CHASEWALK, -1);
if (sd->bl.m != m) { //Cancel some map related stuff.
- if (sd->sc_data[SC_WARM].timer != -1)
+ if (sd->sc.data[SC_WARM].timer != -1)
status_change_end(&sd->bl,SC_WARM,-1);
- if (sd->sc_data[SC_SUN_COMFORT].timer != -1)
+ if (sd->sc.data[SC_SUN_COMFORT].timer != -1)
status_change_end(&sd->bl,SC_SUN_COMFORT,-1);
- if (sd->sc_data[SC_MOON_COMFORT].timer != -1)
+ if (sd->sc.data[SC_MOON_COMFORT].timer != -1)
status_change_end(&sd->bl,SC_MOON_COMFORT,-1);
- if (sd->sc_data[SC_STAR_COMFORT].timer != -1)
+ if (sd->sc.data[SC_STAR_COMFORT].timer != -1)
status_change_end(&sd->bl,SC_STAR_COMFORT,-1);
}
}
-
- if(sd->status.option&OPTION_HIDE)
- status_change_end(&sd->bl, SC_HIDING, -1);
- if(pc_iscloaking(sd))
- status_change_end(&sd->bl, SC_CLOAKING, -1);
- if(pc_ischasewalk(sd))
- status_change_end(&sd->bl, SC_CHASEWALK, -1);
-
if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) {
pet_stopattack(sd->pd);
pet_changestate(sd->pd,MS_IDLE,0);
@@ -3441,7 +3459,7 @@ int pc_run(struct map_session_data *sd, int skilllv, int dir)
nullpo_retr(0, sd);
if (!pc_can_move(sd)) {
- if(sd->sc_data[SC_RUN].timer!=-1)
+ if(sd->sc.data[SC_RUN].timer!=-1)
status_change_end(&sd->bl,SC_RUN,-1);
return 0;
}
@@ -3462,7 +3480,7 @@ int pc_run(struct map_session_data *sd, int skilllv, int dir)
//進めない場合 駆け足終了 障害物で止まった場合スパート状態解除
if(to_x == sd->bl.x && to_y == sd->bl.y){
- if(sd->sc_data[SC_RUN].timer!=-1)
+ if(sd->sc.data[SC_RUN].timer!=-1)
status_change_end(&sd->bl,SC_RUN,-1);
} else
pc_walktoxy(sd, to_x, to_y);
@@ -3613,9 +3631,9 @@ static int pc_walk(int tid,unsigned int tick,int id,int data)
if (pc_iscloaking(sd)) // クロ?キングの消滅?査
skill_check_cloaking(&sd->bl);
/* 被ディボ?ション?査 */
- if (sd->sc_count) {
- if (sd->sc_data[SC_DANCING].timer != -1)
- skill_unit_move_unit_group((struct skill_unit_group *)sd->sc_data[SC_DANCING].val2, sd->bl.m, dx, dy);
+ if (sd->sc.count) {
+ if (sd->sc.data[SC_DANCING].timer != -1)
+ skill_unit_move_unit_group((struct skill_unit_group *)sd->sc.data[SC_DANCING].val2, sd->bl.m, dx, dy);
}
if (map_getcell(sd->bl.m,x,y,CELL_CHKNPC))
npc_touch_areanpc(sd,sd->bl.m,x,y);
@@ -3629,8 +3647,8 @@ static int pc_walk(int tid,unsigned int tick,int id,int data)
i = 1;
sd->walktimer = add_timer (tick+i, pc_walk, id, sd->walkpath.path_pos);
}
- else if(sd->sc_data[SC_RUN].timer!=-1) //Keep trying to run.
- pc_run(sd, sd->sc_data[SC_RUN].val1, sd->sc_data[SC_RUN].val2);
+ else if(sd->sc.data[SC_RUN].timer!=-1) //Keep trying to run.
+ pc_run(sd, sd->sc.data[SC_RUN].val1, sd->sc.data[SC_RUN].val2);
else { //Stopped walking. Update to_x and to_y to current location [Skotlex]
sd->to_x = sd->bl.x;
sd->to_y = sd->bl.y;
@@ -3676,7 +3694,7 @@ int pc_walktoxy (struct map_session_data *sd, int x, int y)
sd->to_x = x;
sd->to_y = y;
- if (sd->sc_data[SC_CONFUSION].timer != -1) //Randomize the target position
+ if (sd->sc.data[SC_CONFUSION].timer != -1) //Randomize the target position
map_random_dir(&sd->bl, &sd->to_x, &sd->to_y);
if (sd->walktimer != -1)
@@ -3738,7 +3756,7 @@ int pc_stop_walking (struct map_session_data *sd, int type)
sd->to_y = sd->bl.y;
if (type & 0x01)
clif_fixpos(&sd->bl);
- if (sd->sc_data[SC_RUN].timer != -1)
+ if (sd->sc.data[SC_RUN].timer != -1)
status_change_end(&sd->bl, SC_RUN, -1);
return 0;
}
@@ -3837,36 +3855,36 @@ int pc_checkallowskill(struct map_session_data *sd)
{
nullpo_retr(0, sd);
- if(!sd->sc_count)
+ if(!sd->sc.count)
return 0;
// Skills requiring specific weapon types
- if(sd->sc_data[SC_TWOHANDQUICKEN].timer!=-1 && !(skill_get_weapontype(KN_TWOHANDQUICKEN)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_TWOHANDQUICKEN].timer!=-1 && !(skill_get_weapontype(KN_TWOHANDQUICKEN)&(1<<sd->status.weapon)))
status_change_end(&sd->bl,SC_TWOHANDQUICKEN,-1);
- if(sd->sc_data[SC_ONEHAND].timer!=-1 && !(skill_get_weapontype(KN_ONEHAND)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_ONEHAND].timer!=-1 && !(skill_get_weapontype(KN_ONEHAND)&(1<<sd->status.weapon)))
status_change_end(&sd->bl,SC_ONEHAND,-1);
- if(sd->sc_data[SC_AURABLADE].timer!=-1 && !(skill_get_weapontype(LK_AURABLADE)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_AURABLADE].timer!=-1 && !(skill_get_weapontype(LK_AURABLADE)&(1<<sd->status.weapon)))
// Aura Blade requires any weapon but bare fists
status_change_end(&sd->bl,SC_AURABLADE,-1);
- if(sd->sc_data[SC_PARRYING].timer!=-1 && !(skill_get_weapontype(LK_PARRYING)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_PARRYING].timer!=-1 && !(skill_get_weapontype(LK_PARRYING)&(1<<sd->status.weapon)))
status_change_end(&sd->bl,SC_PARRYING,-1);
- if(sd->sc_data[SC_SPEARSQUICKEN].timer!=-1 && !(skill_get_weapontype(CR_SPEARQUICKEN)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_SPEARSQUICKEN].timer!=-1 && !(skill_get_weapontype(CR_SPEARQUICKEN)&(1<<sd->status.weapon)))
// Spear Quicken requires a Two-handed spear
status_change_end(&sd->bl,SC_SPEARSQUICKEN,-1);
- if(sd->sc_data[SC_ADRENALINE].timer!=-1 && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_ADRENALINE].timer!=-1 && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon)))
status_change_end(&sd->bl,SC_ADRENALINE,-1);
- if(sd->sc_data[SC_ADRENALINE2].timer!=-1 && !(skill_get_weapontype(BS_ADRENALINE2)&(1<<sd->status.weapon)))
+ if(sd->sc.data[SC_ADRENALINE2].timer!=-1 && !(skill_get_weapontype(BS_ADRENALINE2)&(1<<sd->status.weapon)))
status_change_end(&sd->bl,SC_ADRENALINE2,-1);
- if( sd->sc_data[SC_SPURT].timer!=-1 && sd->status.weapon)
+ if( sd->sc.data[SC_SPURT].timer!=-1 && sd->status.weapon)
// Spurt requires bare hands (feet, in fact xD)
status_change_end(&sd->bl,SC_SPURT,-1);
if(sd->status.shield <= 0) { // Skills requiring a shield
- if(sd->sc_data[SC_AUTOGUARD].timer!=-1) // Guard
+ if(sd->sc.data[SC_AUTOGUARD].timer!=-1) // Guard
status_change_end(&sd->bl,SC_AUTOGUARD,-1);
- if(sd->sc_data[SC_DEFENDER].timer!=-1) // Defending Aura
+ if(sd->sc.data[SC_DEFENDER].timer!=-1) // Defending Aura
status_change_end(&sd->bl,SC_DEFENDER,-1);
- if(sd->sc_data[SC_REFLECTSHIELD].timer!=-1) // Shield Reflect
+ if(sd->sc.data[SC_REFLECTSHIELD].timer!=-1) // Shield Reflect
status_change_end(&sd->bl,SC_REFLECTSHIELD,-1);
}
return 0;
@@ -4423,7 +4441,7 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data)
map_freeblock_lock();
sd->attacktarget_lv = battle_weapon_attack(&sd->bl,bl,tick,0);
- if(!(battle_config.pc_cloak_check_type&2) && sd->sc_data[SC_CLOAKING].timer != -1)
+ if(!(battle_config.pc_cloak_check_type&2) && sd->sc.data[SC_CLOAKING].timer != -1)
status_change_end(&sd->bl,SC_CLOAKING,-1);
if(sd->status.pet_id > 0 && sd->pd && sd->petDB && battle_config.pet_attack_support)
@@ -5064,8 +5082,8 @@ int pc_resetlvl(struct map_session_data* sd,int type)
sd->status.job_level=1;
sd->status.base_exp=sd->status.base_exp=0;
sd->status.job_exp=sd->status.job_exp=0;
- if(sd->status.option !=0)
- sd->status.option = 0;
+ if(sd->sc.option !=0)
+ sd->sc.option = 0;
sd->status.str=1;
sd->status.agi=1;
@@ -5279,21 +5297,29 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
}
// ? いていたら足を止める
- if (sd->sc_data) {
- if (sd->sc_data[SC_ENDURE].timer != -1 && (src != NULL && src->type == BL_MOB) && !map_flag_gvg(sd->bl.m)) {
- if (!sd->special_state.infinite_endure && (--sd->sc_data[SC_ENDURE].val2) < 0)
+ if (sd->sc.count) {
+ if (sd->sc.data[SC_ENDURE].timer != -1 && (src != NULL && src->type == BL_MOB) && !map_flag_gvg(sd->bl.m)) {
+ if (!sd->special_state.infinite_endure && (--sd->sc.data[SC_ENDURE].val2) < 0)
status_change_end(&sd->bl, SC_ENDURE, -1);
}
- if (sd->sc_data[SC_GRAVITATION].timer != -1 &&
- sd->sc_data[SC_GRAVITATION].val3 == BCT_SELF) {
- struct skill_unit_group *sg = (struct skill_unit_group *)sd->sc_data[SC_GRAVITATION].val4;
+ if (sd->sc.data[SC_GRAVITATION].timer != -1 &&
+ sd->sc.data[SC_GRAVITATION].val3 == BCT_SELF) {
+ struct skill_unit_group *sg = (struct skill_unit_group *)sd->sc.data[SC_GRAVITATION].val4;
if (sg) {
skill_delunitgroup(sg);
status_change_end(&sd->bl, SC_GRAVITATION, -1);
}
}
- if (sd->sc_data[SC_CONFUSION].timer != -1)
+ if (sd->sc.data[SC_CONFUSION].timer != -1)
status_change_end(&sd->bl, SC_CONFUSION, -1);
+ if (sd->sc.data[SC_TRICKDEAD].timer != -1)
+ status_change_end(&sd->bl, SC_TRICKDEAD, -1);
+ if (sd->sc.data[SC_HIDING].timer != -1)
+ status_change_end(&sd->bl, SC_HIDING, -1);
+ if (sd->sc.data[SC_CLOAKING].timer != -1)
+ status_change_end(&sd->bl, SC_CLOAKING, -1);
+ if (sd->sc.data[SC_CHASEWALK].timer != -1)
+ status_change_end(&sd->bl, SC_CHASEWALK, -1);
}
// 演奏/ダンスの中?
@@ -5308,20 +5334,11 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
if(sd->status.pet_id > 0 && sd->pd && sd->petDB && battle_config.pet_damage_support)
pet_target_check(sd,src,1);
- if (sd->sc_data[SC_TRICKDEAD].timer != -1)
- status_change_end(&sd->bl, SC_TRICKDEAD, -1);
- if(sd->status.option&OPTION_HIDE)
- status_change_end(&sd->bl, SC_HIDING, -1);
- if(pc_iscloaking(sd))
- status_change_end(&sd->bl, SC_CLOAKING, -1);
- if(pc_ischasewalk(sd))
- status_change_end(&sd->bl, SC_CHASEWALK, -1);
-
clif_updatestatus(sd,SP_HP);
if(sd->status.hp>0){
- if(sd->status.hp<sd->status.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 &&
- (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ))
+ if(sd->status.hp<sd->status.max_hp>>2 && sd->sc.data[SC_AUTOBERSERK].timer != -1 &&
+ (sd->sc.data[SC_PROVOKE].timer==-1 || sd->sc.data[SC_PROVOKE].val2==0 ))
// オ?トバ?サ?ク?動
status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0);
@@ -5354,9 +5371,9 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
pc_stop_walking(sd,0);
skill_castcancel(&sd->bl,0); // 詠唱の中止
skill_stop_dancing(&sd->bl); //You should stop dancing when dead... [Skotlex]
- if (sd->sc_data[SC_GOSPEL].timer != -1 && sd->sc_data[SC_GOSPEL].val4 == BCT_SELF)
+ if (sd->sc.data[SC_GOSPEL].timer != -1 && sd->sc.data[SC_GOSPEL].val4 == BCT_SELF)
{ //Remove Gospel [Skotlex]
- struct skill_unit_group *sg = (struct skill_unit_group *)sd->sc_data[SC_GOSPEL].val3;
+ struct skill_unit_group *sg = (struct skill_unit_group *)sd->sc.data[SC_GOSPEL].val3;
if (sg)
skill_delunitgroup(sg);
}
@@ -5477,7 +5494,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
if(battle_config.death_penalty_type && sd->state.snovice_flag != 4
&& (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE // only novices will receive no penalty
&& !map[sd->bl.m].flag.nopenalty && !map_flag_gvg(sd->bl.m)
- && !(sd->sc_count && sd->sc_data[SC_BABY].timer!=-1))
+ && !(sd->sc.count && sd->sc.data[SC_BABY].timer!=-1))
{
if(battle_config.death_penalty_type==1 && battle_config.death_penalty_base > 0)
sd->status.base_exp -= (int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
@@ -5525,7 +5542,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
}
}
//Clear these data here so that SC_BABY check may work. [Skotlex]
- resurrect_flag = (sd->sc_data[SC_KAIZEL].timer != -1)?sd->sc_data[SC_KAIZEL].val1:0; //Auto-resurrect later in the code.
+ resurrect_flag = (sd->sc.data[SC_KAIZEL].timer != -1)?sd->sc.data[SC_KAIZEL].val1:0; //Auto-resurrect later in the code.
status_change_clear(&sd->bl,0); // ステ?タス異常を解除する
clif_updatestatus(sd,SP_HP);
status_calc_pc(sd,0);
@@ -5908,7 +5925,7 @@ int pc_heal(struct map_session_data *sd,int hp,int sp)
sp = 0;
}
- if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中は回復させないらしい
+ if(sd->sc.count && sd->sc.data[SC_BERSERK].timer!=-1) //バ?サ?ク中は回復させないらしい
return 0;
if(hp+sd->status.hp>sd->status.max_hp)
@@ -5929,8 +5946,8 @@ int pc_heal(struct map_session_data *sd,int hp,int sp)
if(sp)
clif_updatestatus(sd,SP_SP);
- if(sd->status.hp>=sd->status.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 &&
- (sd->sc_data[SC_PROVOKE].timer!=-1 && sd->sc_data[SC_PROVOKE].val2==1 ))
+ if(sd->status.hp>=sd->status.max_hp>>2 && sd->sc.data[SC_AUTOBERSERK].timer != -1 &&
+ (sd->sc.data[SC_PROVOKE].timer!=-1 && sd->sc.data[SC_PROVOKE].val2==1 ))
status_change_end(&sd->bl,SC_PROVOKE,-1); //End auto berserk.
return hp + sp;
@@ -5948,7 +5965,7 @@ int pc_itemheal(struct map_session_data *sd,int hp,int sp)
nullpo_retr(0, sd);
- if(sd->sc_count && sd->sc_data[SC_GOSPEL].timer!=-1) //バ?サ?ク中は回復させないらしい
+ if(sd->sc.count && sd->sc.data[SC_GOSPEL].timer!=-1) //バ?サ?ク中は回復させないらしい
return 0;
if(pc_checkoverhp(sd)) {
@@ -6141,7 +6158,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if(pc_isriding(sd)) { // remove peco status if changing into invalid class [Valaris]
if(!(pc_checkskill(sd,KN_RIDING)))
- pc_setoption(sd,sd->status.option&~OPTION_RIDING);
+ pc_setoption(sd,sd->sc.option&~OPTION_RIDING);
else
pc_setriding(sd);
}
@@ -6255,7 +6272,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
int pc_setoption(struct map_session_data *sd,int type)
{
nullpo_retr(0, sd);
- if (type&OPTION_RIDING && !(sd->status.option&OPTION_RIDING) && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
+ if (type&OPTION_RIDING && !(sd->sc.option&OPTION_RIDING) && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
{ //We are going to mount. [Skotlex]
switch (sd->status.class_)
{
@@ -6281,7 +6298,7 @@ int pc_setoption(struct map_session_data *sd,int type)
clif_status_load(&sd->bl,SI_RIDING,1);
status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds.
}
- else if (!(type&OPTION_RIDING) && sd->status.option&OPTION_RIDING && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
+ else if (!(type&OPTION_RIDING) && sd->sc.option&OPTION_RIDING && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
{ //We are going to dismount.
switch (sd->status.class_)
{
@@ -6307,22 +6324,22 @@ int pc_setoption(struct map_session_data *sd,int type)
clif_status_load(&sd->bl,SI_RIDING,0);
status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds.
}
- if (type&OPTION_FALCON && !(sd->status.option&OPTION_FALCON)) //Falcon ON
+ if (type&OPTION_FALCON && !(sd->sc.option&OPTION_FALCON)) //Falcon ON
clif_status_load(&sd->bl,SI_FALCON,1);
- else if (!(type&OPTION_FALCON) && sd->status.option&OPTION_FALCON) //Falcon OFF
+ else if (!(type&OPTION_FALCON) && sd->sc.option&OPTION_FALCON) //Falcon OFF
clif_status_load(&sd->bl,SI_FALCON,0);
//SG flying [Komurka]
- if (type&OPTION_FLYING && !(sd->status.option&OPTION_FLYING)) //Flying ON
+ if (type&OPTION_FLYING && !(sd->sc.option&OPTION_FLYING)) //Flying ON
{
if (sd->status.class_==JOB_STAR_GLADIATOR) sd->status.class_ = sd->view_class = JOB_STAR_GLADIATOR2;
}
- else if (!(type&OPTION_FLYING) && sd->status.option&OPTION_FLYING) //Flying OFF
+ else if (!(type&OPTION_FLYING) && sd->sc.option&OPTION_FLYING) //Flying OFF
{
if (sd->status.class_==JOB_STAR_GLADIATOR2) sd->status.class_ = sd->view_class = JOB_STAR_GLADIATOR;
}
- sd->status.option=type;
+ sd->sc.option=type;
clif_changeoption(&sd->bl);
status_calc_pc(sd,0);
return 0;
@@ -6341,7 +6358,7 @@ int pc_setcart(struct map_session_data *sd,int type)
if (type < 0 || type > 5)
return 0; //Never trust the values sent by the client! [Skotlex]
- option = sd->status.option;
+ option = sd->sc.option;
for (i = 0; i < 6; i++)
{ //This should preserve the current option, only modifying the cart bit.
if (i == type)
@@ -6372,7 +6389,7 @@ int pc_setcart(struct map_session_data *sd,int type)
int pc_setfalcon(struct map_session_data *sd)
{
if(pc_checkskill(sd,HT_FALCON)>0){ // ファルコンマスタリ?スキル所持
- pc_setoption(sd,sd->status.option|0x0010);
+ pc_setoption(sd,sd->sc.option|0x0010);
}
return 0;
@@ -6385,7 +6402,7 @@ int pc_setfalcon(struct map_session_data *sd)
int pc_setriding(struct map_session_data *sd)
{
if((pc_checkskill(sd,KN_RIDING)>0)){ // ライディングスキル所持
- pc_setoption(sd,sd->status.option|OPTION_RIDING);
+ pc_setoption(sd,sd->sc.option|OPTION_RIDING);
}
return 0;
}
@@ -6874,7 +6891,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
// -- moonsoul (if player is berserk then cannot equip)
//
- if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1){
+ if(sd->sc.count && sd->sc.data[SC_BERSERK].timer!=-1){
clif_equipitemack(sd,n,0,0); // fail
return 0;
}
@@ -6982,16 +6999,16 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
status_calc_pc(sd,0);
if(sd->special_state.infinite_endure) {
- if(sd->sc_data[SC_ENDURE].timer == -1)
+ if(sd->sc.data[SC_ENDURE].timer == -1)
status_change_start(&sd->bl,SC_ENDURE,10,1,0,0,0,0);
}
else {
- if(sd->sc_count && sd->sc_data[SC_ENDURE].timer != -1 && sd->sc_data[SC_ENDURE].val2)
+ if(sd->sc.count && sd->sc.data[SC_ENDURE].timer != -1 && sd->sc.data[SC_ENDURE].val2)
status_change_end(&sd->bl,SC_ENDURE,-1);
}
- if(sd->sc_count) {
- if (sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele))
+ if(sd->sc.count) {
+ if (sd->sc.data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele))
status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
}
@@ -7013,7 +7030,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
// -- moonsoul (if player is berserk then cannot unequip)
//
- if(!(flag&2) && sd->sc_count && (sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1)){
+ if(!(flag&2) && sd->sc.count && (sd->sc.data[SC_BLADESTOP].timer!=-1 || sd->sc.data[SC_BERSERK].timer!=-1)){
clif_unequipitemack(sd,n,0,0);
return 0;
}
@@ -7040,7 +7057,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
sd->status.weapon = sd->weapontype2;
pc_calcweapontype(sd);
clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
- if(sd->sc_data[SC_DANCING].timer!=-1) //When unequipping, stop dancing. [Skotlex]
+ if(sd->sc.data[SC_DANCING].timer!=-1) //When unequipping, stop dancing. [Skotlex]
skill_stop_dancing(&sd->bl);
}
if(sd->status.inventory[n].equip & 0x0020) {
@@ -7075,7 +7092,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
if(flag&1) {
status_calc_pc(sd,0);
- if(sd->sc_count && sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele))
+ if(sd->sc.count && sd->sc.data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele))
status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
}
@@ -7435,11 +7452,11 @@ static int pc_spheal(struct map_session_data *sd)
if(pc_issit(sd))
a += a;
- if (sd->sc_count) {
- if (sd->sc_data[SC_MAGNIFICAT].timer!=-1) // マグニフィカ?ト
+ if (sd->sc.count) {
+ if (sd->sc.data[SC_MAGNIFICAT].timer!=-1) // マグニフィカ?ト
a += a;
- if (sd->sc_data[SC_REGENERATION].timer != -1)
- a *= sd->sc_data[SC_REGENERATION].val1;
+ if (sd->sc.data[SC_REGENERATION].timer != -1)
+ a *= sd->sc.data[SC_REGENERATION].val1;
}
// Re-added back to status_calc
//if((skill = pc_checkskill(sd,HP_MEDITATIO)) > 0) //Increase natural SP regen with Meditatio [DracoRPG]
@@ -7472,11 +7489,11 @@ static int pc_hpheal(struct map_session_data *sd)
if(pc_issit(sd))
a += a;
- if (sd->sc_count) {
- if (sd->sc_data[SC_MAGNIFICAT].timer != -1) // Modified by RoVeRT
+ if (sd->sc.count) {
+ if (sd->sc.data[SC_MAGNIFICAT].timer != -1) // Modified by RoVeRT
a += a;
- if (sd->sc_data[SC_REGENERATION].timer != -1)
- a *= sd->sc_data[SC_REGENERATION].val1;
+ if (sd->sc.data[SC_REGENERATION].timer != -1)
+ a *= sd->sc.data[SC_REGENERATION].val1;
}
if (sd->status.guild_id > 0) {
struct guild_castle *gc = guild_mapindex2gc(sd->mapindex); // Increased guild castle regen [Valaris]
@@ -7513,7 +7530,7 @@ static int pc_natural_heal_hp(struct map_session_data *sd)
if(sd->walktimer == -1) {
inc_num = pc_hpheal(sd);
- if(sd->sc_data[SC_TENSIONRELAX].timer!=-1 ){ // テンションリラックス
+ if(sd->sc.data[SC_TENSIONRELAX].timer!=-1 ){ // テンションリラックス
sd->hp_sub += 2*inc_num;
sd->inchealhptick += 3*natural_heal_diff_tick;
} else {
@@ -7589,7 +7606,7 @@ static int pc_natural_heal_sp(struct map_session_data *sd)
bsp=sd->status.sp;
inc_num = pc_spheal(sd);
- if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer == -1 || (sd->sc_data[SC_SPIRIT].timer!=-1 && sd->sc_data[SC_SPIRIT].val2 == SL_MONK))
+ if(sd->sc.data[SC_EXPLOSIONSPIRITS].timer == -1 || (sd->sc.data[SC_SPIRIT].timer!=-1 && sd->sc.data[SC_SPIRIT].val2 == SL_MONK))
sd->sp_sub += inc_num;
if(sd->walktimer == -1)
sd->inchealsptick += natural_heal_diff_tick;
@@ -7775,12 +7792,12 @@ static int pc_natural_heal_sub(struct map_session_data *sd,va_list ap) {
// -- moonsoul (if conditions below altered to disallow natural healing if under berserk status)
if (pc_isdead(sd) || pc_ishiding(sd) ||
//-- cannot regen for 5 minutes after using Berserk --- [Celest]
- (sd->sc_count && (
- (sd->sc_data[SC_POISON].timer != -1 && sd->sc_data[SC_SLOWPOISON].timer == -1) ||
- (sd->sc_data[SC_DPOISON].timer != -1 && sd->sc_data[SC_SLOWPOISON].timer == -1) ||
- sd->sc_data[SC_BERSERK].timer != -1 ||
- sd->sc_data[SC_TRICKDEAD].timer != -1 ||
- sd->sc_data[SC_BLEEDING].timer != -1
+ (sd->sc.count && (
+ (sd->sc.data[SC_POISON].timer != -1 && sd->sc.data[SC_SLOWPOISON].timer == -1) ||
+ (sd->sc.data[SC_DPOISON].timer != -1 && sd->sc.data[SC_SLOWPOISON].timer == -1) ||
+ sd->sc.data[SC_BERSERK].timer != -1 ||
+ sd->sc.data[SC_TRICKDEAD].timer != -1 ||
+ sd->sc.data[SC_BLEEDING].timer != -1
))
) { //Cannot heal neither natural or special.
sd->hp_sub = sd->inchealhptick = sd->inchealspirithptick = 0;
@@ -7792,9 +7809,9 @@ static int pc_natural_heal_sub(struct map_session_data *sd,va_list ap) {
sd->sp_sub = sd->inchealsptick = 0;
} else { //natural heal
pc_natural_heal_hp(sd);
- if(sd->sc_count && (
- sd->sc_data[SC_EXTREMITYFIST].timer != -1 ||
- sd->sc_data[SC_DANCING].timer != -1
+ if(sd->sc.count && (
+ sd->sc.data[SC_EXTREMITYFIST].timer != -1 ||
+ sd->sc.data[SC_DANCING].timer != -1
)) //No SP natural heal.
sd->sp_sub = sd->inchealsptick = 0;
else
@@ -7999,7 +8016,7 @@ int map_night_timer(int tid, unsigned int tick, int id, int data)
void pc_setstand(struct map_session_data *sd){
nullpo_retv(sd);
- if(sd->sc_count && sd->sc_data[SC_TENSIONRELAX].timer!=-1)
+ if(sd->sc.count && sd->sc.data[SC_TENSIONRELAX].timer!=-1)
status_change_end(&sd->bl,SC_TENSIONRELAX,-1);
sd->state.dead_sit = 0;
diff --git a/src/map/pc.h b/src/map/pc.h
index b05323100..4c7cb886a 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -18,13 +18,13 @@
#define pc_issit(sd) ((sd)->state.dead_sit == 2)
#define pc_setdir(sd,b,h) ((sd)->dir = (b) ,(sd)->head_dir = (h) )
#define pc_setchatid(sd,n) ((sd)->chatID = n)
-#define pc_ishiding(sd) ((sd)->status.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK))
-#define pc_iscloaking(sd) (!((sd)->status.option&OPTION_CHASEWALK) && ((sd)->status.option&OPTION_CLOAK))
-#define pc_ischasewalk(sd) ((sd)->status.option&OPTION_CHASEWALK)
-#define pc_iscarton(sd) ((sd)->status.option&CART_MASK)
-#define pc_isfalcon(sd) ((sd)->status.option&OPTION_FALCON)
-#define pc_isriding(sd) ((sd)->status.option&OPTION_RIDING)
-#define pc_isinvisible(sd) ((sd)->status.option&OPTION_INVISIBLE)
+#define pc_ishiding(sd) ((sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK))
+#define pc_iscloaking(sd) (!((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK))
+#define pc_ischasewalk(sd) ((sd)->sc.option&OPTION_CHASEWALK)
+#define pc_iscarton(sd) ((sd)->sc.option&CART_MASK)
+#define pc_isfalcon(sd) ((sd)->sc.option&OPTION_FALCON)
+#define pc_isriding(sd) ((sd)->sc.option&OPTION_RIDING)
+#define pc_isinvisible(sd) ((sd)->sc.option&OPTION_INVISIBLE)
#define pc_is50overweight(sd) (sd->weight*2 >= sd->max_weight)
#define pc_is90overweight(sd) (sd->weight*10 >= sd->max_weight*9)
#define pc_maxparameter(sd) ((sd->class_&JOBL_BABY) ? battle_config.max_baby_parameter : battle_config.max_parameter)
diff --git a/src/map/pet.c b/src/map/pet.c
index 48e62cfb4..17d97d225 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1748,7 +1748,7 @@ int pet_recovery_timer(int tid,unsigned int tick,int id,int data)
return 0;
}
- if(sd->sc_data && sd->sc_data[pd->recovery->type].timer != -1)
+ if(sd->sc.count && sd->sc.data[pd->recovery->type].timer != -1)
{ //Display a heal animation?
//Detoxify is chosen for now.
clif_skill_nodamage(&pd->bl,&sd->bl,TF_DETOXIFY,1,1);
diff --git a/src/map/script.c b/src/map/script.c
index 9a4c9c0e5..e7f5996da 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4947,7 +4947,7 @@ int buildin_checkoption(struct script_state *st)
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
sd=script_rid2sd(st);
- if(sd->status.option & type){
+ if(sd->sc.option & type){
push_val(st->stack,C_INT,1);
} else {
push_val(st->stack,C_INT,0);
@@ -4967,7 +4967,7 @@ int buildin_checkoption1(struct script_state *st)
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
sd=script_rid2sd(st);
- if(sd->opt1 & type){
+ if(sd->sc.opt1 & type){
push_val(st->stack,C_INT,1);
} else {
push_val(st->stack,C_INT,0);
@@ -4987,7 +4987,7 @@ int buildin_checkoption2(struct script_state *st)
type=conv_num(st,& (st->stack->stack_data[st->start+2]));
sd=script_rid2sd(st);
- if(sd->opt2 & type){
+ if(sd->sc.opt2 & type){
push_val(st->stack,C_INT,1);
} else {
push_val(st->stack,C_INT,0);
diff --git a/src/map/skill.c b/src/map/skill.c
index 90c6a5f69..f1e29c5c3 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -778,11 +778,11 @@ struct skill_unit_layout *skill_get_unit_layout (int skillid, int skilllv, struc
int skill_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, unsigned int tick)
{
/* MOB追加?果スキル用 */
- const int sc[]={
+ const int scl[]={
SC_POISON, SC_BLIND, SC_SILENCE, SC_STAN,
SC_STONE, SC_CURSE, SC_SLEEP
};
- const int sc2[]={ //Note: We use Sonic Blow's stun duration for the confusion lasting time (dummy value): 12 secs at lv7
+ const int sc2l[]={ //Note: We use Sonic Blow's stun duration for the confusion lasting time (dummy value): 12 secs at lv7
MG_STONECURSE,MG_FROSTDIVER,NPC_STUNATTACK,
NPC_SLEEPATTACK,TF_POISON,NPC_CURSEATTACK,
NPC_SILENCEATTACK,AS_SONICBLOW,NPC_BLINDATTACK,
@@ -791,6 +791,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
struct map_session_data *sd=NULL;
struct map_session_data *dstsd=NULL;
+ struct status_change *sc;
+ struct status_change *tsc;
struct mob_data *md=NULL;
struct mob_data *dstmd=NULL;
struct pet_data *pd=NULL;
@@ -830,21 +832,23 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case BL_MOB:
dstmd=(struct mob_data *)bl;
break;
- default:
- return 0;
}
+ sc = status_get_sc(src);
+ tsc = status_get_sc(bl);
+ if (!tsc) //skill additional effect is about adding effects to the target...
+ //So if the target can't be inflicted with statuses, this is pointless.
+ return 0;
//??ロの耐?ォ
sc_def_mdef = status_get_sc_def_mdef(bl);
sc_def_vit = status_get_sc_def_vit(bl);
sc_def_int = status_get_sc_def_int(bl);
sc_def_luk = status_get_sc_def_luk(bl);
+
switch(skillid){
case 0: // Normal attacks (no skill used)
{
- struct status_change *sc_data;
- struct status_change *tsc_data;
if(sd) {
// Automatic trigger of Blitz Beat
if (pc_isfalcon(sd) && sd->status.weapon == 11 && (skill=pc_checkskill(sd,HT_BLITZBEAT))>0 &&
@@ -861,48 +865,49 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
clif_skill_fail(sd,skillid,0,0);
}
// Chance to trigger Taekwon kicks [Dralnu]
- if(sd->sc_data[SC_READYSTORM].timer != -1 && sd->sc_data[SC_COMBO].timer == -1 && rand()%100 < 15) {
- rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
- status_change_start(src,SC_COMBO, TK_STORMKICK,0,0,0,rate,0);
- } else if(sd->sc_data[SC_READYDOWN].timer != -1 && sd->sc_data[SC_COMBO].timer == -1 && rand()%100 < 15) {
- rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
- status_change_start(src,SC_COMBO, TK_DOWNKICK,0,0,0,rate,0);
- } else if(sd->sc_data[SC_READYTURN].timer != -1 && sd->sc_data[SC_COMBO].timer == -1 && rand()%100 < 15) {
- rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
- status_change_start(src,SC_COMBO, TK_TURNKICK,0,0,0,rate,0);
- } else if(sd->sc_data[SC_READYCOUNTER].timer != -1 && sd->sc_data[SC_COMBO].timer == -1) //additional chance from SG_FRIEND [Komurka]
- {
- rate = 20;
- if (sd->sc_data[SC_SKILLRATE_UP].timer != -1 && sd->sc_data[SC_SKILLRATE_UP].val1 == TK_COUNTER) {
- rate += rate*sd->sc_data[SC_SKILLRATE_UP].val2/100;
- status_change_end(src,SC_SKILLRATE_UP,-1);
- }
- if (rand()%100 < rate) {
+ if(sd->sc.count) {
+ if(sd->sc.data[SC_READYSTORM].timer != -1 && sd->sc.data[SC_COMBO].timer == -1 && rand()%100 < 15) {
+ rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
+ status_change_start(src,SC_COMBO, TK_STORMKICK,0,0,0,rate,0);
+ } else if(sd->sc.data[SC_READYDOWN].timer != -1 && sd->sc.data[SC_COMBO].timer == -1 && rand()%100 < 15) {
rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
- status_change_start(src,SC_COMBO, TK_COUNTER,bl->id,0,0,rate,0);
+ status_change_start(src,SC_COMBO, TK_DOWNKICK,0,0,0,rate,0);
+ } else if(sd->sc.data[SC_READYTURN].timer != -1 && sd->sc.data[SC_COMBO].timer == -1 && rand()%100 < 15) {
+ rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
+ status_change_start(src,SC_COMBO, TK_TURNKICK,0,0,0,rate,0);
+ } else if(sd->sc.data[SC_READYCOUNTER].timer != -1 && sd->sc.data[SC_COMBO].timer == -1) //additional chance from SG_FRIEND [Komurka]
+ {
+ rate = 20;
+ if (sd->sc.data[SC_SKILLRATE_UP].timer != -1 && sd->sc.data[SC_SKILLRATE_UP].val1 == TK_COUNTER) {
+ rate += rate*sd->sc.data[SC_SKILLRATE_UP].val2/100;
+ status_change_end(src,SC_SKILLRATE_UP,-1);
+ }
+ if (rand()%100 < rate) {
+ rate = 2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
+ status_change_start(src,SC_COMBO, TK_COUNTER,bl->id,0,0,rate,0);
+ }
}
}
}
- sc_data = status_get_sc_data(src);
- tsc_data = status_get_sc_data(bl);
-
+
+ if (sc && sc->count) {
// Enchant Poison gives a chance to poison attacked enemies
- if(sc_data && sc_data[SC_ENCPOISON].timer != -1 && tsc_data && tsc_data[SC_POISON].timer == -1 &&
- rand() % 100 < sc_data[SC_ENCPOISON].val1 * sc_def_vit / 100)
- status_change_start(bl,SC_POISON,sc_data[SC_ENCPOISON].val1,0,0,0,skill_get_time2(AS_ENCHANTPOISON,sc_data[SC_ENCPOISON].val1),0);
- // Enchant Deadly Poison gives a chance to deadly poison attacked enemies
- if(sc_data && sc_data[SC_EDP].timer != -1 && !(status_get_mode(bl)&MD_BOSS) && tsc_data && tsc_data[SC_DPOISON].timer == -1 &&
- rand() % 100 < tsc_data[SC_EDP].val2 * sc_def_vit / 100)
- status_change_start(bl,SC_DPOISON,sc_data[SC_EDP].val1,0,0,0,skill_get_time2(ASC_EDP,sc_data[SC_EDP].val1),0);
-
- if (tsc_data && tsc_data[SC_KAAHI].timer != -1) {
- if (dstsd && dstsd->status.sp < 5*tsc_data[SC_KAAHI].val1)
+ if(sc->data[SC_ENCPOISON].timer != -1 && tsc->data[SC_POISON].timer == -1 &&
+ rand() % 100 < sc->data[SC_ENCPOISON].val1 * sc_def_vit / 100)
+ status_change_start(bl,SC_POISON,sc->data[SC_ENCPOISON].val1,0,0,0,skill_get_time2(AS_ENCHANTPOISON,sc->data[SC_ENCPOISON].val1),0);
+ // Enchant Deadly Poison gives a chance to deadly poison attacked enemies
+ if(sc->data[SC_EDP].timer != -1 && !(status_get_mode(bl)&MD_BOSS) && tsc->data[SC_DPOISON].timer == -1 &&
+ rand() % 100 < tsc->data[SC_EDP].val2 * sc_def_vit / 100)
+ status_change_start(bl,SC_DPOISON,sc->data[SC_EDP].val1,0,0,0,skill_get_time2(ASC_EDP,sc->data[SC_EDP].val1),0);
+ }
+ if (tsc->count && tsc->data[SC_KAAHI].timer != -1) {
+ if (dstsd && dstsd->status.sp < 5*tsc->data[SC_KAAHI].val1)
; //Not enough SP to cast
else {
- battle_heal(bl, bl, 200*tsc_data[SC_KAAHI].val1, -5*tsc_data[SC_KAAHI].val1, 1);
+ battle_heal(bl, bl, 200*tsc->data[SC_KAAHI].val1, -5*tsc->data[SC_KAAHI].val1, 1);
if(dstsd && dstsd->fd)
- clif_heal(dstsd->fd,SP_HP,200*tsc_data[SC_KAAHI].val1);
+ clif_heal(dstsd->fd,SP_HP,200*tsc->data[SC_KAAHI].val1);
}
}
}
@@ -935,38 +940,26 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case AS_GRIMTOOTH:
{
- struct status_change *sc_data = status_get_sc_data(bl);
- if (sd)
- {
- if (sc_data && sc_data[SC_SLOWDOWN].timer == -1)
- status_change_start(bl,SC_SLOWDOWN,0,0,0,0,skill_get_time2(skillid, skilllv),0);
- }
- else
- if (sc_data && sc_data[SC_STOP].timer == -1)
- status_change_start(bl,SC_STOP,0,0,0,0,skill_get_time2(skillid, skilllv), 0);
+ int type = sd?SC_SLOWDOWN:SC_STOP;
+ if (tsc->data[type].timer == -1)
+ status_change_start(bl,type,0,0,0,0,skill_get_time2(skillid, skilllv),0);
break;
}
case MG_FROSTDIVER: /* フ?ストダイバ? */
case WZ_FROSTNOVA: /* フ?ストノヴァ */
{
- struct status_change *sc_data = status_get_sc_data(bl);
rate = (skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15;
if (rate <= 5)
rate = 5;
- if(sc_data && sc_data[SC_FREEZE].timer == -1 && rand()%100 < rate)
+ if(tsc->data[SC_FREEZE].timer == -1 && rand()%100 < rate)
status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv)*(1-sc_def_mdef/100),0);
}
break;
case WZ_STORMGUST: /* スト?ムガスト */
- {
- struct status_change *sc_data = status_get_sc_data(bl);
- if(sc_data) {
- sc_data[SC_FREEZE].val3++;
- if(sc_data[SC_FREEZE].val3 >= 3)
- status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
- }
- }
+ tsc->data[SC_FREEZE].val3++;
+ if(tsc->data[SC_FREEZE].val3 >= 3)
+ status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
break;
case WZ_METEOR:
@@ -1114,24 +1107,24 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case NPC_PETRIFYATTACK:
if(rand()%100 < sc_def_mdef)
- status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
+ status_change_start(bl,scl[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
break;
case NPC_POISON:
case NPC_SILENCEATTACK:
case NPC_STUNATTACK:
if(rand()%100 < sc_def_vit && src->type!=BL_PET)
- status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
+ status_change_start(bl,scl[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
if(src->type==BL_PET)
- status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skilllv*1000,0);
+ status_change_start(bl,scl[skillid-NPC_POISON],skilllv,0,0,0,skilllv*1000,0);
break;
case NPC_CURSEATTACK:
if(rand()%100 < sc_def_luk)
- status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
+ status_change_start(bl,scl[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
break;
case NPC_SLEEPATTACK:
case NPC_BLINDATTACK:
if(rand()%100 < sc_def_int)
- status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
+ status_change_start(bl,scl[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
break;
case NPC_MENTALBREAKER:
@@ -1165,8 +1158,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case PF_FOGWALL: /* ホ?リ?ク?ス */
if (src != bl) {
- struct status_change *sc_data = status_get_sc_data(bl);
- if (sc_data && sc_data[SC_DELUGE].timer == -1 && !(status_get_mode(bl)&MD_BOSS))
+ if (tsc->data[SC_DELUGE].timer == -1 && !(status_get_mode(bl)&MD_BOSS))
status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0);
}
break;
@@ -1238,27 +1230,25 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
break;
case TK_JUMPKICK:
- { //Cancel out Soul Linker status of the target. [Skotlex]
- struct status_change *sc_data = status_get_sc_data(bl);
- if (sc_data) {
- if (sc_data[SC_PRESERVE].timer != -1) //preserve blocks the cleaning
- break;
- //Remove pitched potions effect.
- if (sc_data[SC_ASPDPOTION0].timer != -1 && sc_data[SC_ASPDPOTION0].val4)
- status_change_end(bl, SC_ASPDPOTION0, -1);
- if (sc_data[SC_ASPDPOTION1].timer != -1 && sc_data[SC_ASPDPOTION1].val4)
- status_change_end(bl, SC_ASPDPOTION1, -1);
- if (sc_data[SC_ASPDPOTION2].timer != -1 && sc_data[SC_ASPDPOTION2].val4)
- status_change_end(bl, SC_ASPDPOTION2, -1);
- if (sc_data[SC_ASPDPOTION3].timer != -1 && sc_data[SC_ASPDPOTION3].val4)
- status_change_end(bl, SC_ASPDPOTION3, -1);
- if (sc_data[SC_SPIRIT].timer != -1)
- status_change_end(bl, SC_SPIRIT, -1);
- if (sc_data[SC_ONEHAND].timer != -1)
- status_change_end(bl, SC_ONEHAND, -1);
- if (sc_data[SC_ADRENALINE2].timer != -1)
- status_change_end(bl, SC_ADRENALINE2, -1);
- }
+ //Cancel out Soul Linker status of the target. [Skotlex]
+ if (tsc->count) {
+ if (tsc->data[SC_PRESERVE].timer != -1) //preserve blocks the cleaning
+ break;
+ //Remove pitched potions effect.
+ if (tsc->data[SC_ASPDPOTION0].timer != -1 && tsc->data[SC_ASPDPOTION0].val4)
+ status_change_end(bl, SC_ASPDPOTION0, -1);
+ if (tsc->data[SC_ASPDPOTION1].timer != -1 && tsc->data[SC_ASPDPOTION1].val4)
+ status_change_end(bl, SC_ASPDPOTION1, -1);
+ if (tsc->data[SC_ASPDPOTION2].timer != -1 && tsc->data[SC_ASPDPOTION2].val4)
+ status_change_end(bl, SC_ASPDPOTION2, -1);
+ if (tsc->data[SC_ASPDPOTION3].timer != -1 && tsc->data[SC_ASPDPOTION3].val4)
+ status_change_end(bl, SC_ASPDPOTION3, -1);
+ if (tsc->data[SC_SPIRIT].timer != -1)
+ status_change_end(bl, SC_SPIRIT, -1);
+ if (tsc->data[SC_ONEHAND].timer != -1)
+ status_change_end(bl, SC_ONEHAND, -1);
+ if (tsc->data[SC_ADRENALINE2].timer != -1)
+ status_change_end(bl, SC_ADRENALINE2, -1);
}
break;
case MO_BALKYOUNG: //Note: attack_type is passed as BF_WEAPON for the actual target, BF_MISC for the splash-affected mobs.
@@ -1306,7 +1296,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
{ //Inflicted status effect.
if(battle_config.battle_log)
ShowInfo("PC %d skill_additional_effect: caused status effect (pos %d): %d\n",sd->bl.id,i,sd->addeff[type]);
- status_change_start(bl,i,7,0,0,0,skill_get_time2(sc2[type],7),0);
+ status_change_start(bl,i,7,0,0,0,skill_get_time2(sc2l[type],7),0);
}
}
}
@@ -1535,7 +1525,7 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
struct mob_data *md=NULL;
struct pet_data *pd=NULL;
struct skill_unit *su=NULL;
- struct status_change* sc_data=NULL;
+ struct status_change* sc=NULL;
nullpo_retr(0, src);
nullpo_retr(0, target);
@@ -1560,7 +1550,7 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
return 0;
}
if (target->type != BL_SKILL)
- sc_data = status_get_sc_data(target);
+ sc = status_get_sc(target);
if (count&0xf00000)
dir = (count>>20)&0xf;
@@ -1589,16 +1579,16 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
else if(pd)
map_foreachinmovearea(clif_petoutsight,target->m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,pd);
- if (sc_data) {
- if (sc_data[SC_DANCING].timer != -1) { //Move the song/dance [Skotlex]
- if (sc_data[SC_DANCING].val1 == CG_MOONLIT) //Cancel Moonlight Petals if moved from casting position. [Skotlex]
+ if (sc && sc->count) {
+ if (sc->data[SC_DANCING].timer != -1) { //Move the song/dance [Skotlex]
+ if (sc->data[SC_DANCING].val1 == CG_MOONLIT) //Cancel Moonlight Petals if moved from casting position. [Skotlex]
skill_stop_dancing(target);
else
- skill_unit_move_unit_group((struct skill_unit_group *)sc_data[SC_DANCING].val2, target->m, dx, dy);
+ skill_unit_move_unit_group((struct skill_unit_group *)sc->data[SC_DANCING].val2, target->m, dx, dy);
}
- if (sc_data[SC_CLOSECONFINE].timer != -1)
+ if (sc->data[SC_CLOSECONFINE].timer != -1)
status_change_end(target, SC_CLOSECONFINE, -1);
- if (sc_data[SC_CLOSECONFINE2].timer != -1)
+ if (sc->data[SC_CLOSECONFINE2].timer != -1)
status_change_end(target, SC_CLOSECONFINE2, -1);
}
@@ -1637,7 +1627,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag )
{
struct Damage dmg;
- struct status_change *sc_data;
+ struct status_change *sc;
struct map_session_data *sd=NULL, *tsd=NULL;
int type,lv,damage,rdamage=0;
static int tmpdmg = 0;
@@ -1685,16 +1675,21 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
//何もしない判定ここまで
- sc_data = status_get_sc_data(bl);
- if (attack_type&BF_MAGIC && sc_data && sc_data[SC_KAITE].timer != -1 && src == dsrc
+ sc= status_get_sc(bl);
+ if (sc && !sc->count)
+ sc = NULL; //Don't need it.
+
+ if (attack_type&BF_MAGIC && sc && sc->data[SC_KAITE].timer != -1 && src == dsrc
&& !(status_get_mode(src)&MD_BOSS) && (sd || status_get_lv(dsrc) <= 80) //Works on players or mobs with level under 80.
) { //Bounce back the skill.
- if (--sc_data[SC_KAITE].val2 <= 0)
+ if (--sc->data[SC_KAITE].val2 <= 0)
status_change_end(bl, SC_KAITE, -1);
bl = src; //Just make the skill attack yourself @.@
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
tsd = (bl->type == BL_PC)?(struct map_session_data *)bl:NULL;
- if (sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_WIZARD)
+ if (sc && !sc->count)
+ sc = NULL; //Don't need it.
+ if (sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_WIZARD)
return 0; //Spirit of Wizard blocks bounced back spells.
}
@@ -1718,12 +1713,12 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
}
//マジックロッド?理ここから
- if(attack_type&BF_MAGIC && sc_data && sc_data[SC_MAGICROD].timer != -1 && src == dsrc) { //魔法攻?でマジックロッド?態でsrc=dsrcなら
+ if(attack_type&BF_MAGIC && sc && sc->data[SC_MAGICROD].timer != -1 && src == dsrc) { //魔法攻?でマジックロッド?態でsrc=dsrcなら
dmg.damage = dmg.damage2 = 0; //ダメ?ジ0
dmg.dmg_lv = ATK_FLEE; //This will prevent skill additional effect from taking effect. [Skotlex]
if(tsd) {
int sp = skill_get_sp(skillid,skilllv); //使用されたスキルのSPを吸?
- sp = sp * sc_data[SC_MAGICROD].val2 / 100; //吸?率計算
+ sp = sp * sc->data[SC_MAGICROD].val2 / 100; //吸?率計算
if(skillid == WZ_WATERBALL && skilllv > 1) //ウォ?タ?ボ?ルLv1以上
sp = sp/((skilllv|1)*(skilllv|1)); //さらに計算?
if(sp > 0x7fff) sp = 0x7fff; //SP多すぎの場合は理論最大値
@@ -1735,9 +1730,9 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
else //回復SP+現在のSPがMSPより小さい場合は回復SPを加算
tsd->status.sp += sp;
clif_heal(tsd->fd,SP_SP,sp); //SP回復エフェクトの表示
- tsd->canact_tick = tick + skill_delayfix(bl, SA_MAGICROD, sc_data[SC_MAGICROD].val1, 0);
+ tsd->canact_tick = tick + skill_delayfix(bl, SA_MAGICROD, sc->data[SC_MAGICROD].val1, 0);
}
- clif_skill_nodamage(bl,bl,SA_MAGICROD,sc_data[SC_MAGICROD].val1,1); //マジックロッドエフェクトを表示
+ clif_skill_nodamage(bl,bl,SA_MAGICROD,sc->data[SC_MAGICROD].val1,1); //マジックロッドエフェクトを表示
}
//マジックロッド?理ここまで
@@ -1762,7 +1757,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
if(sd) {
//Sorry for removing the Japanese comments, but they were actually distracting
//from the actual code and I couldn't understand a thing anyway >.< [Skotlex]
- if (skillid && sd->sc_data[SC_COMBO].timer != -1)
+ if (skillid && sd->sc.data[SC_COMBO].timer != -1)
status_change_end(src,SC_COMBO,-1); //Interrupt previous combo if you used a skill already. [Skotlex]
switch(skillid)
{
@@ -1796,7 +1791,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
int delay = 700 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
if(damage < status_get_hp(bl) &&
(
- (pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 4 && sd->sc_data[SC_EXPLOSIONSPIRITS].timer != -1) ||
+ (pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 4 && sd->sc.data[SC_EXPLOSIONSPIRITS].timer != -1) ||
(pc_checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0) ||
(pc_checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
))
@@ -1811,7 +1806,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
int delay = 1000 - 4 * status_get_agi(src) - 2 * status_get_dex(src);
if(damage < status_get_hp(bl) &&
(
- (pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 3 && sd->sc_data[SC_EXPLOSIONSPIRITS].timer != -1) ||
+ (pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 3 && sd->sc.data[SC_EXPLOSIONSPIRITS].timer != -1) ||
(pc_checkskill(sd, CH_CHAINCRUSH) > 0)
))
delay += 300 * battle_config.combo_delay_rate /100;
@@ -1854,7 +1849,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
break;
case SL_STIN:
case SL_STUN:
- if (skilllv >= 7 && sd->sc_data[SC_COMBO].timer == -1)
+ if (skilllv >= 7 && sd->sc.data[SC_COMBO].timer == -1)
status_change_start(src,SC_COMBO,SL_SMA,skilllv,0,0,skill_get_time2(skillid, skilllv),0);
break;
} //Switch End
@@ -1896,7 +1891,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
map_freeblock_lock();
if(damage > 0 && dmg.flag&BF_SKILL && tsd
- && pc_checkskill(tsd,RG_PLAGIARISM) && sc_data[SC_PRESERVE].timer == -1
+ && pc_checkskill(tsd,RG_PLAGIARISM) && sc && sc->data[SC_PRESERVE].timer == -1
&& damage < tsd->status.hp)
{ //Updated to not be able to copy skills if the blow will kill you. [Skotlex]
if ((!tsd->status.skill[skillid].id || tsd->status.skill[skillid].flag >= 13) &&
@@ -2009,9 +2004,9 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
(
skillid == MG_COLDBOLT || skillid == MG_FIREBOLT || skillid == MG_LIGHTNINGBOLT
) &&
- (sc_data = status_get_sc_data(src)) &&
- sc_data[SC_DOUBLECAST].timer != -1 &&
- rand() % 100 < 40+10*sc_data[SC_DOUBLECAST].val1)
+ (sc = status_get_sc(src)) &&
+ sc->count && sc->data[SC_DOUBLECAST].timer != -1 &&
+ rand() % 100 < 40+10*sc->data[SC_DOUBLECAST].val1)
{
skill_castend_delay (src, bl, skillid, skilllv, tick + dmg.div_*dmg.amotion, flag|1);
}
@@ -2209,9 +2204,9 @@ int skill_guildaura_sub (struct block_list *bl,va_list ap)
nullpo_retr(0, flag = va_arg(ap,int *));
if (flag && *flag > 0) {
- if (sd->sc_count && sd->sc_data[SC_GUILDAURA].timer != -1) {
- if (sd->sc_data[SC_GUILDAURA].val4 != *flag) {
- sd->sc_data[SC_GUILDAURA].val4 = *flag;
+ if (sd->sc.count && sd->sc.data[SC_GUILDAURA].timer != -1) {
+ if (sd->sc.data[SC_GUILDAURA].val4 != *flag) {
+ sd->sc.data[SC_GUILDAURA].val4 = *flag;
status_calc_pc (sd, 0);
}
return 0;
@@ -2383,8 +2378,8 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data )
if (skl->type <= 1) { // partial fix: it still doesn't end if the target dies
// should put outside of the switch, but since this is the only
// mage targetted spell for now,
- struct status_change *sc_data = status_get_sc_data(src);
- if(sc_data && sc_data[SC_MAGICPOWER].timer != -1) //マジックパ??の?果?I了
+ struct status_change *sc = status_get_sc(src);
+ if(sc && sc->data[SC_MAGICPOWER].timer != -1) //マジックパ??の?果?I了
status_change_end(src,SC_MAGICPOWER,-1);
}
break;
@@ -2582,7 +2577,7 @@ int skill_castend_delay (struct block_list* src, struct block_list *bl,int skill
int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag)
{
struct map_session_data *sd = NULL, *tsd = NULL;
- struct status_change *sc_data;
+ struct status_change *sc;
if(skillid < 0)
{ // remove the debug print when this case is finished
@@ -2613,8 +2608,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
if (status_isdead(src) || (src != bl && status_isdead(bl)))
return 1;
-
- sc_data = status_get_sc_data(src);
+
+ sc = status_get_sc(src);
+ if (sc && !sc->count)
+ sc = NULL; //Unneeded
map_freeblock_lock();
@@ -2699,7 +2696,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
break;
case MO_COMBOFINISH:
- if (!(flag&1) && sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_MONK)
+ if (!(flag&1) && sc && sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_MONK)
{ //Becomes a splash attack when Soul Linked.
map_foreachinarea(skill_area_sub,
bl->m,bl->x-2,bl->y-2,bl->x+2,bl->y+2,BL_CHAR,
@@ -2738,7 +2735,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
case MO_INVESTIGATE: /* ?勁 */
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag);
- if (sc_data && sc_data[SC_BLADESTOP].timer != -1)
+ if (sc && sc->data[SC_BLADESTOP].timer != -1)
status_change_end(src,SC_BLADESTOP,-1);
break;
@@ -2746,7 +2743,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
{
int dir = map_calc_dir(src, bl->x, bl->y), t_dir = status_get_dir(bl);
if ((!check_distance_bl(src, bl, 0) && !map_check_dir(dir, t_dir)) || bl->type == BL_SKILL) {
- if (sc_data && sc_data[SC_HIDING].timer != -1)
+ if (sc && sc->data[SC_HIDING].timer != -1)
status_change_end(src, SC_HIDING, -1); // ハイディング解?
skill_attack(BF_WEAPON, src, src, bl, skillid, skilllv, tick, flag);
dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest]
@@ -2772,7 +2769,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
skill_addtimerskill(src, tick + i * 200, bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag);
sd->canmove_tick = tick + (sd->spiritball_old - 1) * 200;
}
- if (sc_data && sc_data[SC_BLADESTOP].timer != -1)
+ if (sc && sc->data[SC_BLADESTOP].timer != -1)
status_change_end(src,SC_BLADESTOP,-1);
}
break;
@@ -2780,7 +2777,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
case MO_CHAINCOMBO: /* 連打?カ */
{
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag);
- if (sc_data && sc_data[SC_BLADESTOP].timer != -1)
+ if (sc && sc->data[SC_BLADESTOP].timer != -1)
status_change_end(src,SC_BLADESTOP,-1);
}
break;
@@ -2835,13 +2832,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
}
else //Assume minimum distance of 1 for Charge.
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,skillid == KN_CHARGEATK?1:flag);
- if (skillid == MO_EXTREMITYFIST && sc_data)
+ if (skillid == MO_EXTREMITYFIST && sc && sc->count)
{
- if (sc_data[SC_EXPLOSIONSPIRITS].timer != -1)
+ if (sc->data[SC_EXPLOSIONSPIRITS].timer != -1)
status_change_end(src, SC_EXPLOSIONSPIRITS, -1);
- if (sc_data[SC_BLADESTOP].timer != -1)
+ if (sc->data[SC_BLADESTOP].timer != -1)
status_change_end(src,SC_BLADESTOP,-1);
- if (sc_data[SC_COMBO].timer != -1) //This is one is here to make combo end even if skill failed.
+ if (sc->data[SC_COMBO].timer != -1) //This is one is here to make combo end even if skill failed.
status_change_end(src,SC_COMBO,-1);
}
}
@@ -3268,6 +3265,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
{
struct map_session_data *sd = NULL;
struct map_session_data *dstsd = NULL;
+ struct status_change *tsc;
struct mob_data *md = NULL;
struct mob_data *dstmd = NULL;
int i;
@@ -3334,6 +3332,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
}
+ tsc = status_get_sc(bl);
+
map_freeblock_lock();
switch(skillid)
{
@@ -3342,8 +3342,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
int heal = skill_calc_heal(src, skilllv);
int heal_get_jobexp;
int skill;
- struct status_change *sc_data = status_get_sc_data(bl);
-
if (skilllv > 10)
heal = 9999; //9999ヒ?[ル
@@ -3357,10 +3355,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
heal = heal*2; //スパノビの嫁が旦那にヒ?ルすると2倍になる
}
- if (sc_data && sc_data[SC_KAITE].timer != -1
+ if (tsc && tsc->count && tsc->data[SC_KAITE].timer != -1
&& !(status_get_mode(src)&MD_BOSS)
) { //Bounce back heal
- if (--sc_data[SC_KAITE].val2 <= 0)
+ if (--tsc->data[SC_KAITE].val2 <= 0)
status_change_end(bl, SC_KAITE, -1);
if (src == bl) heal=0; //When you try to heal yourself and you are under Kaite, the heal is voided.
clif_skill_nodamage (src, src, skillid, heal, 1);
@@ -3491,21 +3489,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case PR_LEXDIVINA: /* レックスディビ?ナ */
- {
- struct status_change *sc_data = status_get_sc_data(bl);
- if (status_isimmune(bl)) {
- clif_skill_nodamage(src,bl,skillid,skilllv,0);
- break;
- }
- if (sc_data && sc_data[SC_SILENCE].timer != -1) {
- status_change_end(bl,SC_SILENCE, -1);
- clif_skill_nodamage (src, bl, skillid, skilllv, 1);
- } else if (rand() % 100 < sc_def_vit) {
- status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
- clif_skill_nodamage (src, bl, skillid, skilllv, 1);
- } else
- clif_skill_nodamage (src, bl, skillid, skilllv, 0);
+ if (status_isimmune(bl)) {
+ clif_skill_nodamage(src,bl,skillid,skilllv,0);
+ break;
}
+ if (tsc && tsc->count && tsc->data[SC_SILENCE].timer != -1) {
+ status_change_end(bl,SC_SILENCE, -1);
+ clif_skill_nodamage (src, bl, skillid, skilllv, 1);
+ } else if (rand() % 100 < sc_def_vit) {
+ status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
+ clif_skill_nodamage (src, bl, skillid, skilllv, 1);
+ } else
+ clif_skill_nodamage (src, bl, skillid, skilllv, 0);
break;
case SA_ABRACADABRA:
@@ -3656,20 +3651,19 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case CG_MARIONETTE: /* マリオネットコント??ル */
{
- struct status_change *sc_data = status_get_sc_data(src);
- struct status_change *tsc_data = status_get_sc_data(bl);
- int sc = SkillStatusChangeTable[skillid];
+ struct status_change *sc= status_get_sc(src);
+ int sc1 = SkillStatusChangeTable[skillid];
int sc2 = SC_MARIONETTE2;
- if(sc_data && tsc_data){
- if (sc_data[sc].timer == -1 && tsc_data[sc2].timer == -1) {
- status_change_start (src,sc,skilllv,0,bl->id,0,skill_get_time(skillid,skilllv),0);
+ if(sc && tsc){
+ if (sc->data[sc1].timer == -1 && tsc->data[sc2].timer == -1) {
+ status_change_start (src,sc1,skilllv,0,bl->id,0,skill_get_time(skillid,skilllv),0);
status_change_start (bl,sc2,skilllv,0,src->id,0,skill_get_time(skillid,skilllv),0);
clif_marionette(src, bl);
}
- else if (sc_data[sc].timer != -1 && tsc_data[sc2].timer != -1 &&
- sc_data[sc].val3 == bl->id && tsc_data[sc2].val3 == src->id) {
- status_change_end(src, sc, -1);
+ else if (sc->data[sc1].timer != -1 && tsc->data[sc2].timer != -1 &&
+ sc->data[sc1].val3 == bl->id && tsc->data[sc2].val3 == src->id) {
+ status_change_end(src, sc1, -1);
status_change_end(bl, sc2, -1);
clif_marionette(src, 0);
}
@@ -3701,13 +3695,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
}
if(dstsd->status.weapon == 0 ||
- dstsd->sc_data[SC_FIREWEAPON].timer != -1 ||
- dstsd->sc_data[SC_WATERWEAPON].timer != -1 ||
- dstsd->sc_data[SC_WINDWEAPON].timer != -1 ||
- dstsd->sc_data[SC_EARTHWEAPON].timer != -1 ||
- dstsd->sc_data[SC_SHADOWWEAPON].timer != -1 ||
- dstsd->sc_data[SC_GHOSTWEAPON].timer != -1 ||
- dstsd->sc_data[SC_ENCPOISON].timer != -1) {
+ (dstsd->sc.count && (
+ dstsd->sc.data[SC_FIREWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_WATERWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_WINDWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_EARTHWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_SHADOWWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_GHOSTWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_ENCPOISON].timer != -1
+ ))
+ ) {
if (sd) clif_skill_fail(sd,skillid,0,0);
clif_skill_nodamage(src,bl,skillid,skilllv,0);
break;
@@ -3747,31 +3744,31 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case TK_SEVENWIND:
{
- int sc=-1;
+ int sci=-1;
switch(skilllv){
case 1:
- sc=SC_EARTHWEAPON;
+ sci=SC_EARTHWEAPON;
break;
case 2:
- sc=SC_WINDWEAPON;
+ sci=SC_WINDWEAPON;
break;
case 3:
- sc=SC_WATERWEAPON;
+ sci=SC_WATERWEAPON;
break;
case 4:
- sc=SC_FIREWEAPON;
+ sci=SC_FIREWEAPON;
break;
case 5:
- sc=SC_GHOSTWEAPON;
+ sci=SC_GHOSTWEAPON;
break;
case 6:
- sc=SC_SHADOWWEAPON;
+ sci=SC_SHADOWWEAPON;
break;
case 7:
- sc=SC_ASPERSIO;
+ sci=SC_ASPERSIO;
break;
}
- status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
+ status_change_start(bl,sci,skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
clif_skill_nodamage(src,bl,skillid,skilllv,1);
}
break;
@@ -3821,10 +3818,20 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case ASC_EDP: // [Celest]
case NPC_STOP:
case WZ_SIGHTBLASTER:
+ case SG_SUN_COMFORT:
+ case SG_MOON_COMFORT:
+ case SG_STAR_COMFORT:
status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
+ case SG_SUN_WARM:
+ case SG_MOON_WARM:
+ case SG_STAR_WARM:
+ status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,skillid,skill_get_range(skillid,skilllv),skill_get_time(skillid,skilllv),0);
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ break;
+
case CG_MOONLIT: /* 月明りの泉に落ちる花びら */
clif_skill_nodamage(src,bl,skillid,skilllv,1);
if (sd && battle_config.player_skill_partner_check) {
@@ -3855,14 +3862,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case AS_ENCHANTPOISON: // Prevent spamming [Valaris]
- if (dstsd) {
- if(dstsd->sc_data[SC_FIREWEAPON].timer != -1 ||
- dstsd->sc_data[SC_WATERWEAPON].timer != -1 ||
- dstsd->sc_data[SC_WINDWEAPON].timer != -1 ||
- dstsd->sc_data[SC_EARTHWEAPON].timer != -1 ||
- dstsd->sc_data[SC_SHADOWWEAPON].timer != -1 ||
- dstsd->sc_data[SC_GHOSTWEAPON].timer != -1 ||
- dstsd->sc_data[SC_ENCPOISON].timer != -1) {
+ if (dstsd && dstsd->sc.count) {
+ if(dstsd->sc.data[SC_FIREWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_WATERWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_WINDWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_EARTHWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_SHADOWWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_GHOSTWEAPON].timer != -1 ||
+ dstsd->sc.data[SC_ENCPOISON].timer != -1) {
clif_skill_nodamage(src,bl,skillid,skilllv,0);
clif_skill_fail(sd,skillid,0,0);
break;
@@ -3913,50 +3920,46 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
clif_skill_nodamage(src,bl,skillid,skilllv,1);
map_foreachinarea( status_change_timer_sub,
src->m, src->x-range, src->y-range, src->x+range,src->y+range,BL_CHAR,
- src,SkillStatusChangeTable[skillid],tick);
+ src,status_get_sc(src),SkillStatusChangeTable[skillid],tick);
}
break;
case SM_PROVOKE: /* プ?ボック */
- {
- struct status_change *sc_data = status_get_sc_data(bl);
+ /* MVPmobと不死には?かない */
+ if((status_get_mode(bl)&MD_BOSS) || battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) { //不死には?かない
+ map_freeblock_unlock();
+ return 1;
+ }
- /* MVPmobと不死には?かない */
- if((status_get_mode(bl)&MD_BOSS) || battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) { //不死には?かない
- map_freeblock_unlock();
- return 1;
- }
+ if (rand()%100 > 50 + 3*skilllv + status_get_lv(src) - status_get_lv(bl)) //TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex]
+ {
+ clif_skill_nodamage(src,bl,skillid,skilllv,0);
+ if (sd)
+ clif_skill_fail(sd,skillid,0,0);
+ map_freeblock_unlock();
+ return 0;
+ }
+ status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
- if (rand()%100 > 50 + 3*skilllv + status_get_lv(src) - status_get_lv(bl)) //TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex]
- {
- clif_skill_nodamage(src,bl,skillid,skilllv,0);
- if (sd)
- clif_skill_fail(sd,skillid,0,0);
- map_freeblock_unlock();
- return 0;
- }
- status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ if(dstmd && dstmd->skilltimer!=-1 && dstmd->state.skillcastcancel) // 詠?・妨害
+ skill_castcancel(bl,0);
+ if(dstsd && dstsd->skilltimer!=-1 && (!dstsd->special_state.no_castcancel || map_flag_gvg(bl->m))
+ && dstsd->state.skillcastcancel && !dstsd->special_state.no_castcancel2)
+ skill_castcancel(bl,0);
- if(dstmd && dstmd->skilltimer!=-1 && dstmd->state.skillcastcancel) // 詠?・妨害
- skill_castcancel(bl,0);
- if(dstsd && dstsd->skilltimer!=-1 && (!dstsd->special_state.no_castcancel || map_flag_gvg(bl->m))
- && dstsd->state.skillcastcancel && !dstsd->special_state.no_castcancel2)
- skill_castcancel(bl,0);
-
- if(sc_data){
- if(sc_data[SC_FREEZE].timer!=-1)
- status_change_end(bl,SC_FREEZE,-1);
- if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0)
- status_change_end(bl,SC_STONE,-1);
- if(sc_data[SC_SLEEP].timer!=-1)
- status_change_end(bl,SC_SLEEP,-1);
- }
+ if(tsc && tsc->count){
+ if(tsc->data[SC_FREEZE].timer!=-1)
+ status_change_end(bl,SC_FREEZE,-1);
+ if(tsc->data[SC_STONE].timer!=-1 && tsc->data[SC_STONE].val2==0)
+ status_change_end(bl,SC_STONE,-1);
+ if(tsc->data[SC_SLEEP].timer!=-1)
+ status_change_end(bl,SC_SLEEP,-1);
+ }
- if(dstmd) {
- dstmd->state.provoke_flag = src->id;
- mob_target(dstmd,src,skill_get_range2(src,skillid,skilllv));
- }
+ if(dstmd) {
+ dstmd->state.provoke_flag = src->id;
+ mob_target(dstmd,src,skill_get_range2(src,skillid,skilllv));
}
break;
@@ -3968,7 +3971,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
int lv = sd->status.base_level - dstsd->status.base_level;
if (lv < 0) lv = -lv;
if (lv > battle_config.devotion_level_difference ||
- (dstsd->sc_data[SC_DEVOTION].timer != -1 && dstsd->sc_data[SC_DEVOTION].val1 != src->id) || //Avoid overriding [Skotlex]
+ (dstsd->sc.data[SC_DEVOTION].timer != -1 && dstsd->sc.data[SC_DEVOTION].val1 != src->id) || //Avoid overriding [Skotlex]
(dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER) {
clif_skill_fail(sd,skillid,0,0);
map_freeblock_unlock();
@@ -4199,13 +4202,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case TK_READYCOUNTER:
case TK_DODGE:
case CR_SHRINK:
+ case ST_PRESERVE:
+ case SG_FUSION:
{
- struct status_change *tsc_data = status_get_sc_data(bl);
- int sc = SkillStatusChangeTable[skillid];
- if (tsc_data && tsc_data[sc].timer != -1)
- status_change_end(bl, sc, -1);
+ int sci = SkillStatusChangeTable[skillid];
+ if (tsc && tsc->data[sci].timer != -1)
+ status_change_end(bl, sci, -1);
else
- status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
+ status_change_start(bl,sci,skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
}
break;
@@ -4215,7 +4219,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case SL_KAUPE:
if (sd) {
if (!dstsd || !(
- (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_SOULLINKER) ||
+ (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_SOULLINKER) ||
dstsd->char_id == sd->char_id ||
dstsd->char_id == sd->status.partner_id ||
dstsd->char_id == sd->status.child
@@ -4230,9 +4234,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case SM_AUTOBERSERK: // Celest
{
- struct status_change *tsc_data = status_get_sc_data(bl);
int sc = SkillStatusChangeTable[skillid];
- if (tsc_data && tsc_data[sc].timer != -1)
+ if (tsc && tsc->data[sc].timer != -1)
status_change_end(bl, sc, -1);
else
status_change_start(bl,sc,skilllv,0,0,0,0,0);
@@ -4242,9 +4245,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case TF_HIDING: /* ハイディング */
case ST_CHASEWALK: /* ハイディング */
{
- struct status_change *tsc_data = status_get_sc_data(bl);
int sc = SkillStatusChangeTable[skillid];
- if (tsc_data && tsc_data[sc].timer != -1)
+ if (tsc && tsc->data[sc].timer != -1)
status_change_end(bl, sc, -1);
else
status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
@@ -4253,32 +4255,27 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case TK_RUN:
{
- struct status_change *sc_data = status_get_sc_data(bl);
- int type = SkillStatusChangeTable[skillid];
- if(!sc_data)
- break;
- if (sc_data[type].timer!=-1)
- status_change_end(bl,type,-1);
- else{
- status_change_start(bl,type,skilllv,status_get_dir(bl),0,0,0,0);
- }
+ int sci = SkillStatusChangeTable[skillid];
+ if (tsc && tsc->data[sci].timer != -1)
+ status_change_end(bl, sci, -1);
+ else
+ status_change_start(bl,sci,skilllv,status_get_dir(bl),0,0,0,0);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
}
break;
case AS_CLOAKING: /* ク??キング */
{
- struct status_change *tsc_data = status_get_sc_data(bl);
- int sc=SkillStatusChangeTable[skillid];
- if(tsc_data && tsc_data[sc].timer!=-1 )
+ int sci=SkillStatusChangeTable[skillid];
+ if(tsc && tsc->data[sci].timer!=-1 )
/* 解?怩キる */
- status_change_end(bl, sc, -1);
+ status_change_end(bl, sci, -1);
else
/* 付加する */
{ //Avoid cloaking with no wall and low skill level. [Skotlex]
if (sd && skilllv < 3 && skill_check_cloaking(bl))
clif_skill_fail(sd,skillid,0,0);
else
- status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
+ status_change_start(bl,sci,skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
}
clif_skill_nodamage(src,bl,skillid,-1,1);
}
@@ -4324,28 +4321,22 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case PA_GOSPEL: /* ゴスペル */
- {
- struct status_change *sc_data = status_get_sc_data(src);
- if (!sc_data) break;
- if (sc_data[SC_GOSPEL].timer != -1 && sc_data[SC_GOSPEL].val4 == BCT_SELF) {
- status_change_end(src,SC_GOSPEL,-1);
- } else {
- struct skill_unit_group *sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0);
- if (sc_data[SC_GOSPEL].timer != -1)
- status_change_end(src,SC_GOSPEL,-1); //Was under someone else's Gospel. [Skotlex]
- status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,(int)sg,BCT_SELF,skill_get_time(skillid,skilllv),0);
- }
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ if (!tsc) break;
+ if (tsc->data[SC_GOSPEL].timer != -1 && tsc->data[SC_GOSPEL].val4 == BCT_SELF) {
+ status_change_end(bl,SC_GOSPEL,-1);
+ } else {
+ struct skill_unit_group *sg = skill_unitsetting(src,skillid,skilllv,src->x,src->y,0);
+ if (tsc->data[SC_GOSPEL].timer != -1)
+ status_change_end(bl,SC_GOSPEL,-1); //Was under someone else's Gospel. [Skotlex]
+ status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,(int)sg,BCT_SELF,skill_get_time(skillid,skilllv),0);
}
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
case BD_ADAPTATION: /* アドリブ */
- {
- struct status_change *sc_data = status_get_sc_data(src);
- if(sc_data && sc_data[SC_DANCING].timer!=-1){
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
- skill_stop_dancing(src);
- }
+ if(tsc && tsc->data[SC_DANCING].timer!=-1){
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ skill_stop_dancing(bl);
}
break;
@@ -4426,16 +4417,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case MG_STONECURSE: /* スト?ンカ?ス */
{
- struct status_change *sc_data = status_get_sc_data(bl);
// Level 6-10 doesn't consume a red gem if it fails [celest]
int i, gem_flag = 1, fail_flag = 0;
if (status_get_mode(bl)&MD_BOSS) {
if (sd) clif_skill_fail(sd,skillid,0,0);
break;
}
- if(status_isimmune(bl) || !sc_data)
+ if(status_isimmune(bl) || !tsc)
break;
- if (sc_data[SC_STONE].timer != -1) {
+ if (tsc->data[SC_STONE].timer != -1) {
status_change_end(bl,SC_STONE,-1);
if (sd) {
fail_flag = 1;
@@ -4459,7 +4449,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
// if (!fail_flag) clif_skill_fail(sd,skillid,0,0); This is actually a bug! Altough the gem is checked in skill_check_condition...
break;
}
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_WIZARD)
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_WIZARD)
break; //Do not delete the gemstone.
pc_delitem(sd, i, skill_db[skillid].amount[0], 0);
}
@@ -4616,7 +4606,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case RG_STRIPHELM: /* ストリップヘルム */
case ST_FULLSTRIP: // Rewritten most of the code [DracoRPG]
{
- struct status_change *tsc_data = status_get_sc_data(bl);
int strip_fix, equip = 0;
int sclist[4] = {0,0,0,0};
@@ -4643,16 +4632,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (dstsd) {
for (i=0;i<11;i++) {
if (dstsd->equip_index[i]>=0 && dstsd->inventory_data[dstsd->equip_index[i]]) {
- if (equip &EQP_WEAPON && (i == 9 || (i == 8 && dstsd->inventory_data[dstsd->equip_index[8]]->type == 4)) && !(dstsd->unstripable_equip &EQP_WEAPON) && !(tsc_data && tsc_data[SC_CP_WEAPON].timer != -1)) {
+ if (equip &EQP_WEAPON && (i == 9 || (i == 8 && dstsd->inventory_data[dstsd->equip_index[8]]->type == 4)) && !(dstsd->unstripable_equip &EQP_WEAPON) && !(tsc && tsc->data[SC_CP_WEAPON].timer != -1)) {
sclist[0] = SC_STRIPWEAPON; // Okay, we found a weapon to strip - It can be a right-hand, left-hand or two-handed weapon
pc_unequipitem(dstsd,dstsd->equip_index[i],3);
- } else if (equip &EQP_SHIELD && i == 8 && dstsd->inventory_data[dstsd->equip_index[8]]->type == 5 && !(dstsd->unstripable_equip &EQP_SHIELD) && !(tsc_data && tsc_data[SC_CP_SHIELD].timer != -1)) {
+ } else if (equip &EQP_SHIELD && i == 8 && dstsd->inventory_data[dstsd->equip_index[8]]->type == 5 && !(dstsd->unstripable_equip &EQP_SHIELD) && !(tsc && tsc->data[SC_CP_SHIELD].timer != -1)) {
sclist[1] = SC_STRIPSHIELD; // Okay, we found a shield to strip - It is really a shield, not a two-handed weapon or a left-hand weapon
pc_unequipitem(dstsd,dstsd->equip_index[i],3);
- } else if (equip &EQP_ARMOR && i == 7 && !(dstsd->unstripable_equip &EQP_ARMOR) && !(tsc_data && tsc_data[SC_CP_ARMOR].timer != -1)) {
+ } else if (equip &EQP_ARMOR && i == 7 && !(dstsd->unstripable_equip &EQP_ARMOR) && !(tsc && tsc->data[SC_CP_ARMOR].timer != -1)) {
sclist[2] = SC_STRIPARMOR; // Okay, we found an armor to strip
pc_unequipitem(dstsd,dstsd->equip_index[i],3);
- } else if (equip &EQP_HELM && i == 6 && !(dstsd->unstripable_equip &EQP_HELM) && !(tsc_data && tsc_data[SC_CP_HELM].timer != -1)) {
+ } else if (equip &EQP_HELM && i == 6 && !(dstsd->unstripable_equip &EQP_HELM) && !(tsc && tsc->data[SC_CP_HELM].timer != -1)) {
sclist[3] = SC_STRIPHELM; // Okay, we found a helm to strip
pc_unequipitem(dstsd,dstsd->equip_index[i],3);
}
@@ -4709,7 +4698,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
run_script(sd->inventory_data[i]->script,0,sd->bl.id,0);
pc_delitem(sd,i,skill_db[skillid].amount[x],0);
potion_flag = potion_target = 0;
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_ALCHEMIST)
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_ALCHEMIST)
bonus += sd->status.base_level;
if(potion_per_hp > 0 || potion_per_sp > 0) {
hp = status_get_max_hp(bl) * potion_per_hp / 100;
@@ -4758,8 +4747,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case AM_CP_HELM:
{
int scid = SC_STRIPWEAPON + (skillid - AM_CP_WEAPON);
- struct status_change *tsc_data = status_get_sc_data(bl);
- if(tsc_data && tsc_data[scid].timer != -1)
+ if(tsc && tsc->data[scid].timer != -1)
status_change_end(bl, scid, -1 );
status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 );
clif_skill_nodamage(src,bl,skillid,skilllv,1);
@@ -4800,19 +4788,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case SA_DISPELL: /* ディスペル */
{
int i;
- struct status_change *tsc_data = status_get_sc_data(bl);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
if (rand()%100 >= (50+10*skilllv)*sc_def_mdef/100 // Fixed & changed to use a proportionnal reduction (no info, but seems far more logical) [DracoRPG]
- || tsc_data == NULL || (tsc_data[SC_SPIRIT].timer != -1 && tsc_data[SC_SPIRIT].val2 == SL_ROGUE)) //Rogue's spirit defends againt dispel.
+ || tsc == NULL || (tsc->data[SC_SPIRIT].timer != -1 && tsc->data[SC_SPIRIT].val2 == SL_ROGUE)) //Rogue's spirit defends againt dispel.
{
if (sd)
clif_skill_fail(sd,skillid,0,0);
break;
}
- if(status_isimmune(bl))
+ if(status_isimmune(bl) || !tsc->count)
break;
for(i=0;i<SC_MAX;i++){
- if (tsc_data[i].timer == -1)
+ if (tsc->data[i].timer == -1)
continue;
if(i==SC_HALLUCINATION || i==SC_WEIGHT50 || i==SC_WEIGHT90
|| i==SC_STRIPWEAPON || i==SC_STRIPSHIELD || i==SC_STRIPARMOR || i==SC_STRIPHELM
@@ -4821,7 +4808,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
|| i==SC_CARTBOOST || i==SC_MELTDOWN || i==SC_MOONLIT
)
continue;
- if(i==SC_BERSERK) tsc_data[i].val4=1; //Mark a dispelled berserk to avoid setting hp to 100.
+ if(i==SC_BERSERK) tsc->data[i].val4=1; //Mark a dispelled berserk to avoid setting hp to 100.
status_change_end(bl,i,-1);
}
}
@@ -4865,12 +4852,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case SA_SPELLBREAKER: // スペルブレイカ?
{
- struct status_change *sc_data = status_get_sc_data(bl);
int sp;
- if(sc_data && sc_data[SC_MAGICROD].timer != -1) {
+ if(tsc && tsc->data[SC_MAGICROD].timer != -1) {
if(dstsd) {
sp = skill_get_sp(skillid,skilllv);
- sp = sp * sc_data[SC_MAGICROD].val2 / 100;
+ sp = sp * tsc->data[SC_MAGICROD].val2 / 100;
if(sp > 0x7fff) sp = 0x7fff;
else if(sp < 1) sp = 1;
if(dstsd->status.sp + sp > dstsd->status.max_sp) {
@@ -4881,7 +4867,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
dstsd->status.sp += sp;
clif_heal(dstsd->fd,SP_SP,sp);
}
- clif_skill_nodamage(bl,bl,SA_MAGICROD,sc_data[SC_MAGICROD].val1,1);
+ clif_skill_nodamage(bl,bl,SA_MAGICROD,tsc->data[SC_MAGICROD].val1,1);
if(sd) {
sp = sd->status.max_sp/5;
if(sp < 1) sp = 1;
@@ -4965,7 +4951,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
static const int spellarray[3] = { MG_COLDBOLT,MG_FIREBOLT,MG_LIGHTNINGBOLT };
if(skilllv >= 10) {
spellid = MG_FROSTDIVER;
-// if (sc_data && sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SA_SAGE)
+// if (tsc && tsc->data[SC_SPIRIT].timer != -1 && tsc->data[SC_SPIRIT].val2 == SA_SAGE)
// maxlv = 10;
// else
maxlv = skilllv - 9;
@@ -5447,8 +5433,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case PF_MINDBREAKER: /* プ?ボック */
{
- struct status_change *sc_data = status_get_sc_data(bl);
-
/* MVPmobと不死には?かない */
if(status_get_mode(bl)&MD_BOSS || battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) //不死には?かない
{
@@ -5473,12 +5457,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
&& dstsd->state.skillcastcancel && !dstsd->special_state.no_castcancel2)
skill_castcancel(bl,0);
- if(sc_data){
- if(sc_data[SC_FREEZE].timer!=-1)
+ if(tsc && tsc->count){
+ if(tsc->data[SC_FREEZE].timer!=-1)
status_change_end(bl,SC_FREEZE,-1);
- if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0)
+ if(tsc->data[SC_STONE].timer!=-1 && tsc->data[SC_STONE].val2==0)
status_change_end(bl,SC_STONE,-1);
- if(sc_data[SC_SLEEP].timer!=-1)
+ if(tsc->data[SC_SLEEP].timer!=-1)
status_change_end(bl,SC_SLEEP,-1);
}
@@ -5542,10 +5526,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case CR_FULLPROTECTION:
{
int i, skilltime;
- struct status_change *tsc_data = status_get_sc_data(bl);
skilltime = skill_get_time(skillid,skilllv);
+ if (!tsc) {
+ clif_skill_nodamage(src,bl,skillid,skilllv,0);
+ break;
+ }
for (i=0; i<4; i++) {
- if(tsc_data && tsc_data[SC_STRIPWEAPON + i].timer != -1)
+ if(tsc->data[SC_STRIPWEAPON + i].timer != -1)
status_change_end(bl, SC_STRIPWEAPON + i, -1 );
status_change_start(bl,SC_CP_WEAPON + i,skilllv,0,0,0,skilltime,0 );
}
@@ -5557,19 +5544,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
clif_skill_nodamage(src,bl,skillid,skilllv,1);
break;
- case ST_PRESERVE:
- if (sd){
- if (sd->sc_count && sd->sc_data[SC_PRESERVE].timer != -1)
- status_change_end(src, SC_PRESERVE, -1 );
- else
- status_change_start(src,SC_PRESERVE,skilllv,0,0,0,skill_get_time(skillid, skilllv),0 );
- clif_skill_nodamage(src,src,skillid,skilllv,1);
- }
- break;
case PF_DOUBLECASTING:
if (rand() % 100 > 30 + skilllv * 10) {
- clif_skill_fail(sd,skillid,0,0);
+ if (sd) clif_skill_fail(sd,skillid,0,0);
map_freeblock_unlock();
return 0;
}
@@ -5579,11 +5557,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case CG_LONGINGFREEDOM:
{
- struct status_change *sc_data = status_get_sc_data(src);
- if (sc_data && sc_data[SC_LONGING].timer == -1 && sc_data[SC_DANCING].timer != -1 && sc_data[SC_DANCING].val4
- && sc_data[SC_DANCING].val1 != CG_MOONLIT) //Can't use Longing for Freedom while under Moonlight Petals. [Skotlex]
+ if (tsc && tsc->data[SC_LONGING].timer == -1 && tsc->data[SC_DANCING].timer != -1 && tsc->data[SC_DANCING].val4
+ && tsc->data[SC_DANCING].val1 != CG_MOONLIT) //Can't use Longing for Freedom while under Moonlight Petals. [Skotlex]
{
- status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
+ status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
clif_skill_nodamage(src,bl,skillid,skilllv,1);
}
}
@@ -5914,25 +5891,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
}
break;
- case SG_SUN_WARM:
- case SG_MOON_WARM:
- case SG_STAR_WARM:
- status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,skillid,skill_get_range(skillid,skilllv),skill_get_time(skillid,skilllv),0);
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
- break;
- case SG_SUN_COMFORT:
- case SG_MOON_COMFORT:
- case SG_STAR_COMFORT:
- status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
- break;
- case SG_FUSION:
- if (sd && sd->sc_data && sd->sc_data[SC_FUSION].timer != -1)
- status_change_end(&sd->bl,SkillStatusChangeTable[skillid],-1);
- else
- status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0);
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
- break;
default:
ShowWarning("Unknown skill used:%d\n",skillid);
@@ -5997,9 +5955,9 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data )
if (sd->skillid == PR_LEXDIVINA)
{
- struct status_change *sc_data = status_get_sc_data(bl);
+ struct status_change *sc = status_get_sc(bl);
if (battle_check_target(&sd->bl,bl, BCT_ENEMY)<=0 &&
- (!sc_data || sc_data[SC_SILENCE].timer == -1)) //If it's not an enemy, and not silenced, you can't use the skill on them. [Skotlex]
+ (!sc || sc->data[SC_SILENCE].timer == -1)) //If it's not an enemy, and not silenced, you can't use the skill on them. [Skotlex]
{
clif_skill_nodamage (&sd->bl, bl, sd->skillid, sd->skilllv, 0);
skill_failed(sd);
@@ -6080,7 +6038,7 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data )
break;
}
- if(sd->sc_data[SC_MAGICPOWER].timer != -1 && sd->skillid != HW_MAGICPOWER)
+ if(sd->sc.count && sd->sc.data[SC_MAGICPOWER].timer != -1 && sd->skillid != HW_MAGICPOWER)
status_change_end(&sd->bl,SC_MAGICPOWER,-1);
if (sd->skillid != AL_TELEPORT && sd->skillid != WS_WEAPONREFINE) {
@@ -6198,7 +6156,7 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data )
int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skilllv,unsigned int tick,int flag)
{
struct map_session_data *sd=NULL;
- struct status_change *sc_data;
+ struct status_change *sc;
int i,tmpx = 0,tmpy = 0, x1 = 0, y1 = 0;
//if(skilllv <= 0) return 0;
@@ -6209,7 +6167,9 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
if(src->type==BL_PC)
sd=(struct map_session_data *)src;
- sc_data = status_get_sc_data(src); //Needed for Magic Power checks.
+ sc = status_get_sc(src); //Needed for Magic Power checks.
+ if (sc && !sc->count)
+ sc = NULL; //Unneeded.
if( skillid != WZ_METEOR &&
skillid != AM_CANNIBALIZE &&
@@ -6266,7 +6226,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
case HT_DETECTING: /* ディテクティング */
map_foreachinarea( status_change_timer_sub,
src->m, x-1, y-1, x+1,y+1,BL_CHAR,
- src,SC_SIGHT,tick);
+ src,status_get_sc(src),SC_SIGHT,tick);
break;
case MG_SAFETYWALL: /* セイフティウォ?ル */
@@ -6318,7 +6278,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
case WZ_METEOR: //?テオスト?ム
{
int flag=0;
- if (sc_data && sc_data[SC_MAGICPOWER].timer != -1)
+ if (sc && sc->data[SC_MAGICPOWER].timer != -1)
flag = flag|2; //Store the magic power flag for future use. [Skotlex]
for(i=0;i<2+(skilllv>>1);i++) {
int j=0;
@@ -6480,7 +6440,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
break;
}
- if (sc_data && sc_data[SC_MAGICPOWER].timer != -1)
+ if (sc && sc->data[SC_MAGICPOWER].timer != -1)
status_change_end(&sd->bl,SC_MAGICPOWER,-1);
return 0;
@@ -6507,21 +6467,21 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma
// if(skillnotok(skill_num, sd))
// return 0;
- if( sd->opt1>0 || sd->status.option&2 ) {
+ if(sd->sc.opt1 || sd->sc.option&OPTION_HIDE ) {
skill_failed(sd);
return 0;
}
//スキルが使えない?態異?中
- if(sd->sc_count){
- if( sd->sc_data[SC_SILENCE].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 ||
- sd->sc_data[SC_MARIONETTE].timer != -1)
- return 0;
- }
+ if(sd->sc.count && (
+ sd->sc.data[SC_SILENCE].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 ||
+ sd->sc.data[SC_MARIONETTE].timer != -1
+ ))
+ return 0;
if( skill_num != sd->skillid) /* 不?ウパケットらしい */
return 0;
@@ -6639,7 +6599,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
int count=0;
int target,interval,range,unit_flag;
struct skill_unit_layout *layout;
- struct status_change *sc_data;
+ struct status_change *sc;
int active_flag=1;
nullpo_retr(0, src);
@@ -6651,7 +6611,9 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
unit_flag = skill_get_unit_flag(skillid);
layout = skill_get_unit_layout(skillid,skilllv,src,x,y);
- sc_data = status_get_sc_data(src); // for traps, firewall and fogwall - celest
+ sc= status_get_sc(src); // for traps, firewall and fogwall - celest
+ if (sc && !sc->count)
+ sc = NULL;
switch(skillid){ /* ?ン定 */
@@ -6659,7 +6621,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
val2=skilllv+1;
break;
case MG_FIREWALL: /* ファイヤ?ウォ?ル */
- if(sc_data && sc_data[SC_VIOLENTGALE].timer!=-1)
+ if(sc && sc->data[SC_VIOLENTGALE].timer!=-1)
limit = limit*3/2;
val2=4+skilllv;
break;
@@ -6706,7 +6668,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
case HT_FLASHER: /* フラッシャ? */
case HT_FREEZINGTRAP: /* フリ?ジングトラップ */
case HT_BLASTMINE: /* ブラストマイン */
- if (sc_data && sc_data[SC_INTOABYSS].timer != -1)
+ if (sc && sc->data[SC_INTOABYSS].timer != -1)
val3 = BD_INTOABYSS; //Store into abyss state, to know it shouldn't give traps back. [Skotlex]
if (map_flag_gvg(src->m))
limit *= 4; // longer trap times in WOE [celest]
@@ -6816,7 +6778,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
case BD_ETERNALCHAOS:
break;
case PF_FOGWALL: /* フォグウォ?ル */
- if(sc_data && sc_data[SC_DELUGE].timer!=-1) limit *= 2;
+ if(sc && sc->data[SC_DELUGE].timer!=-1) limit *= 2;
break;
case RG_GRAFFITI: /* Graffiti */
@@ -6824,7 +6786,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
break;
}
- if (val3==0 && (flag&2 || (sc_data && sc_data[SC_MAGICPOWER].timer != -1)))
+ if (val3==0 && (flag&2 || (sc && sc->data[SC_MAGICPOWER].timer != -1)))
val3 = HW_MAGICPOWER; //Store the magic power flag. [Skotlex]
nullpo_retr(NULL, group=skill_initunitgroup(src,(count > 0 ? count : layout->count),
@@ -6920,9 +6882,8 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
{
struct skill_unit_group *sg;
struct block_list *ss;
- struct status_change *sc_data;
+ struct status_change *sc;
int type;
- short *opt;
nullpo_retr(0, src);
nullpo_retr(0, bl);
@@ -6939,21 +6900,22 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
if (battle_check_target(&src->bl,bl,sg->target_flag)<=0)
return 0;
- if ((opt = status_get_option(bl)) && ((*opt)&OPTION_HIDE) && sg->skill_id != WZ_HEAVENDRIVE)
+ sc = status_get_sc(bl);
+
+ 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]
- sc_data = status_get_sc_data(bl);
type = SkillStatusChangeTable[sg->skill_id];
switch (sg->unit_id) {
case UNT_SAFETYWALL:
//TODO: Find a more reliable way to handle the link to sg, this could cause dangling pointers. [Skotlex]
- if (sc_data && sc_data[type].timer == -1)
+ if (sc && sc->data[type].timer == -1)
status_change_start(bl,type,sg->skill_lv,sg->group_id,(int)sg,0,sg->limit,0);
break;
case UNT_PNEUMA:
- if (sc_data && sc_data[type].timer == -1)
+ if (sc && sc->data[type].timer == -1)
status_change_start(bl,type,sg->skill_lv,sg->group_id,0,0,sg->limit,0);
break;
@@ -6976,14 +6938,14 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
case UNT_QUAGMIRE:
if(status_isimmune(bl))
break;
- if(sc_data && sc_data[type].timer==-1)
+ if(sc && sc->data[type].timer==-1)
status_change_start(bl,type,sg->skill_lv,sg->group_id,0,0,sg->limit,0);
break;
case UNT_VOLCANO:
case UNT_DELUGE:
case UNT_VIOLENTGALE:
- if(sc_data && sc_data[type].timer==-1)
+ if(sc && sc->data[type].timer==-1)
status_change_start(bl,type,sg->skill_lv,sg->group_id,0,0,
skill_get_time2(sg->skill_id,sg->skill_lv),0);
break;
@@ -6996,9 +6958,9 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
case UNT_INTOABYSS:
case UNT_SIEGFRIED:
//Needed to check when a dancer/bard leaves their ensemble area.
- if (sg->src_id==bl->id && (!sc_data || sc_data[SC_SPIRIT].timer == -1 || sc_data[SC_SPIRIT].val2 != SL_BARDDANCER))
+ if (sg->src_id==bl->id && (!sc || sc->data[SC_SPIRIT].timer == -1 || sc->data[SC_SPIRIT].val2 != SL_BARDDANCER))
return sg->skill_id;
- if (sc_data && sc_data[type].timer==-1)
+ if (sc && sc->data[type].timer==-1)
status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,0,sg->limit,0);
break;
@@ -7011,9 +6973,9 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
case UNT_FORTUNEKISS:
case UNT_SERVICEFORYOU:
case UNT_HERMODE:
- if (sg->src_id==bl->id && (!sc_data || sc_data[SC_SPIRIT].timer == -1 || sc_data[SC_SPIRIT].val2 != SL_BARDDANCER))
+ if (sg->src_id==bl->id && (!sc || sc->data[SC_SPIRIT].timer == -1 || sc->data[SC_SPIRIT].val2 != SL_BARDDANCER))
return 0;
- if (sc_data && sc_data[type].timer==-1)
+ if (sc && sc->data[type].timer==-1)
status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,0,sg->limit,0);
break;
@@ -7023,7 +6985,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
break;
case UNT_FOGWALL:
- if (sc_data && sc_data[type].timer==-1)
+ if (sc && sc->data[type].timer==-1)
{
status_change_start (bl, type, sg->skill_lv, sg->val1, sg->val2, sg->group_id, sg->limit, 0);
if (battle_check_target(&src->bl,bl,BCT_ENEMY)>0)
@@ -7032,7 +6994,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
break;
case UNT_GRAVITATION:
- if (sc_data && sc_data[type].timer==-1 && !status_get_mode(bl)&MD_BOSS)
+ if (sc && sc->data[type].timer==-1 && !status_get_mode(bl)&MD_BOSS)
status_change_start(bl,type,sg->skill_lv,5*sg->skill_lv,BCT_ENEMY,sg->group_id,sg->limit,0);
break;
@@ -7042,8 +7004,9 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
src->limit = DIFF_TICK(tick+700,sg->tick);
break;
case UNT_GOSPEL:
- if (sg->src_id != bl->id && battle_check_target(ss,bl,BCT_PARTY)>0 &&
- sc_data && sc_data[type].timer==-1) //Start Gospel Effect to prevent item usage affects party only. [Skotlex]
+ if (sg->src_id != bl->id && sc && sc->data[type].timer==-1
+ && battle_check_target(ss,bl,BCT_PARTY)>0)
+ //Start Gospel Effect to prevent item usage affects party only. [Skotlex]
status_change_start(bl,type,sg->skill_lv,0,0,BCT_ALL,sg->limit,0);
break;
}
@@ -7061,7 +7024,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
struct block_list *ss;
struct map_session_data *sd = NULL;
int splash_count=0;
- struct status_change *sc_data, *ssc_data;
+ struct status_change *tsc, *sc;
struct skill_unit_group_tickset *ts;
int type;
int diff=0;
@@ -7075,8 +7038,8 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
nullpo_retr(0, sg=src->group);
nullpo_retr(0, ss=map_id2bl(sg->src_id));
if (ss->type == BL_PC) sd = (struct map_session_data*)ss;
- ssc_data = status_get_sc_data(ss); //For magic power.
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(ss); //For magic power.
+ tsc = status_get_sc(bl);
type = SkillStatusChangeTable[sg->skill_id];
if (sg->interval == -1 && (sg->unit_id == UNT_ANKLESNARE || sg->unit_id == UNT_SPIDERWEB || sg->unit_id == UNT_FIREPILLAR_ACTIVE))
@@ -7097,14 +7060,14 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,0)-1);
}
//Temporarily set magic power to have it take effect. [Skotlex]
- if (sg->val3 == HW_MAGICPOWER && ssc_data && ssc_data[SC_MAGICPOWER].timer == -1 && ssc_data[SC_MAGICPOWER].val1 > 0)
+ if (sg->val3 == HW_MAGICPOWER && sc && sc->data[SC_MAGICPOWER].timer == -1 && sc->data[SC_MAGICPOWER].val1 > 0)
{
if (sd)
{ //This is needed since we are not going to recall status_calc_pc...
- sd->matk1 += sd->matk1 * 5*ssc_data[SC_MAGICPOWER].val1/100;
- sd->matk2 += sd->matk2 * 5*ssc_data[SC_MAGICPOWER].val1/100;
+ sd->matk1 += sd->matk1 * 5*sc->data[SC_MAGICPOWER].val1/100;
+ sd->matk2 += sd->matk2 * 5*sc->data[SC_MAGICPOWER].val1/100;
} else
- ssc_data[SC_MAGICPOWER].timer = -2; //Note to NOT return from the function until this is unset!
+ sc->data[SC_MAGICPOWER].timer = -2; //Note to NOT return from the function until this is unset!
}
switch (sg->unit_id) {
@@ -7182,7 +7145,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
break;
case UNT_ANKLESNARE:
- if(sg->val2==0 && sc_data && sc_data[SC_ANKLE].timer==-1){
+ if(sg->val2==0 && tsc && tsc->data[SC_ANKLE].timer==-1){
int sec = skill_get_time2(sg->skill_id,sg->skill_lv) - status_get_agi(bl)*100;
if(status_get_mode(bl)&MD_BOSS) // Lasts 5 times less on bosses
sec = sec/5;
@@ -7204,7 +7167,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
break;
case UNT_VENOMDUST:
- if(sc_data && sc_data[type].timer==-1 )
+ if(tsc && tsc->data[type].timer==-1 )
status_change_start(bl,type,sg->skill_lv,sg->group_id,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0);
break;
@@ -7374,7 +7337,7 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
break;
case UNT_SPIDERWEB:
- if(sg->val2==0 && (!sc_data || sc_data[type].timer==-1 )){
+ if(sg->val2==0 && (!tsc || tsc->data[type].timer==-1 )){
skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick);
map_moveblock(bl, src->bl.x, src->bl.y, tick);
clif_fixpos(bl);
@@ -7390,14 +7353,14 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MAGIC,tick);
break;
}
- if (sg->val3 == HW_MAGICPOWER && ssc_data && ssc_data[SC_MAGICPOWER].timer < 0 && ssc_data[SC_MAGICPOWER].val1 > 0)
+ if (sg->val3 == HW_MAGICPOWER && sc && sc->data[SC_MAGICPOWER].timer < 0 && sc->data[SC_MAGICPOWER].val1 > 0)
{ //Unset Magic Power.
if (sd)
{
- sd->matk1 = 100*sd->matk1/(100 + 5*ssc_data[SC_MAGICPOWER].val1);
- sd->matk2 = 100*sd->matk2/(100 + 5*ssc_data[SC_MAGICPOWER].val1);
+ sd->matk1 = 100*sd->matk1/(100 + 5*sc->data[SC_MAGICPOWER].val1);
+ sd->matk2 = 100*sd->matk2/(100 + 5*sc->data[SC_MAGICPOWER].val1);
} else
- ssc_data[SC_MAGICPOWER].timer = -1;
+ sc->data[SC_MAGICPOWER].timer = -1;
}
if (bl->type == BL_MOB && ss != bl) { /* スキル使用??のMOBスキル */
@@ -7422,13 +7385,16 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int tick)
{
struct skill_unit_group *sg;
- struct status_change *sc_data;
+ struct status_change *sc;
int type;
nullpo_retr(0, src);
nullpo_retr(0, bl);
nullpo_retr(0, sg=src->group);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
+ if (sc && !sc->count)
+ sc = NULL;
+
type = SkillStatusChangeTable[sg->skill_id];
if (bl->prev==NULL || !src->alive || //Need to delete the trap if the source died.
@@ -7437,7 +7403,7 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t
switch(sg->unit_id){
case UNT_SAFETYWALL:
- if (sc_data && sc_data[type].timer!=-1)
+ if (sc && sc->data[type].timer!=-1)
status_change_end(bl,type,-1);
break;
case UNT_ANKLESNARE:
@@ -7454,7 +7420,7 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t
}
case UNT_BASILICA: //Clear basilica if the owner moved [Skotlex]
case UNT_HERMODE: //Clear Hermode if the owner moved.
- if (sc_data && sc_data[type].timer!=-1 && sc_data[type].val3 == BCT_SELF && sc_data[type].val4 == sg->group_id)
+ if (sc && sc->data[type].timer!=-1 && sc->data[type].val3 == BCT_SELF && sc->data[type].val4 == sg->group_id)
status_change_end(bl,type,-1);
break;
@@ -7478,10 +7444,13 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t
*/
static int skill_unit_onleft(int skill_id, struct block_list *bl,unsigned int tick)
{
- struct status_change *sc_data;
+ struct status_change *sc;
int type;
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
+ if (sc && !sc->count)
+ sc = NULL;
+
type = SkillStatusChangeTable[skill_id];
switch (skill_id)
@@ -7489,7 +7458,7 @@ static int skill_unit_onleft(int skill_id, struct block_list *bl,unsigned int ti
case WZ_QUAGMIRE:
if (bl->type==BL_MOB)
break;
- if (sc_data && sc_data[type].timer != -1)
+ if (sc && sc->data[type].timer != -1)
status_change_end(bl, type, -1);
break;
@@ -7500,7 +7469,7 @@ static int skill_unit_onleft(int skill_id, struct block_list *bl,unsigned int ti
case BD_ROKISWEIL:
case BD_INTOABYSS:
case BD_SIEGFRIED:
- if(sc_data && sc_data[SC_DANCING].timer != -1 && sc_data[SC_DANCING].val1 == skill_id)
+ if(sc && sc->data[SC_DANCING].timer != -1 && sc->data[SC_DANCING].val1 == skill_id)
{ //Check if you just stepped out of your ensemble skill to cancel dancing. [Skotlex]
//We don't check for SC_LONGING because someone could always have knocked you back and out of the song/dance.
//FIXME: This code is not perfect, it doesn't checks for the real ensemble's owner,
@@ -7516,7 +7485,7 @@ static int skill_unit_onleft(int skill_id, struct block_list *bl,unsigned int ti
case SA_VIOLENTGALE:
case CG_HERMODE:
case HW_GRAVITATION:
- if (sc_data && sc_data[type].timer != -1)
+ if (sc && sc->data[type].timer != -1)
status_change_end(bl, type, -1);
break;
@@ -7528,31 +7497,31 @@ static int skill_unit_onleft(int skill_id, struct block_list *bl,unsigned int ti
case DC_DONTFORGETME:
case DC_FORTUNEKISS:
case DC_SERVICEFORYOU:
- if (sc_data && sc_data[type].timer != -1)
+ if (sc && sc->data[type].timer != -1)
{
- delete_timer(sc_data[type].timer, status_change_timer);
+ delete_timer(sc->data[type].timer, status_change_timer);
//NOTE: It'd be nice if we could get the skill_lv for a more accurate extra time, but alas...
//not possible on our current implementation.
- sc_data[type].timer = add_timer(tick+skill_get_time2(skill_id,1), status_change_timer, bl->id, type);
+ sc->data[type].timer = add_timer(tick+skill_get_time2(skill_id,1), status_change_timer, bl->id, type);
}
break;
case PF_FOGWALL:
- if (sc_data && sc_data[type].timer != -1)
+ if (sc && sc->data[type].timer != -1)
{
status_change_end(bl,type,-1);
- if (sc_data[SC_BLIND].timer!=-1)
+ if (sc->data[SC_BLIND].timer!=-1)
{
if (bl->type == BL_PC) //Players get blind ended inmediately, others have it still for 30 secs. [Skotlex]
status_change_end(bl, SC_BLIND, -1);
else {
- delete_timer(sc_data[SC_BLIND].timer, status_change_timer);
- sc_data[SC_BLIND].timer = add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND);
+ delete_timer(sc->data[SC_BLIND].timer, status_change_timer);
+ sc->data[SC_BLIND].timer = add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND);
}
}
}
break;
case UNT_GOSPEL:
- if (sc_data && sc_data[type].timer != -1 && sc_data[type].val4 == BCT_ALL) //End item-no-use Gospel Effect. [Skotlex]
+ if (sc && sc->data[type].timer != -1 && sc->data[type].val4 == BCT_ALL) //End item-no-use Gospel Effect. [Skotlex]
status_change_end(bl, type, -1);
break;
@@ -7733,7 +7702,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
if(pc_isdead(tsd))
return 0;
- if (tsd->sc_count && (tsd->sc_data[SC_SILENCE].timer != -1 || tsd->sc_data[SC_STAN].timer != -1))
+ if (tsd->sc.count && (tsd->sc.data[SC_SILENCE].timer != -1 || tsd->sc.data[SC_STAN].timer != -1))
return 0;
switch(skillid)
@@ -7758,7 +7727,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
(tsd->weapontype1==13 || tsd->weapontype1==14) &&
sd->status.party_id && tsd->status.party_id &&
sd->status.party_id == tsd->status.party_id &&
- tsd->sc_data[SC_DANCING].timer == -1)
+ tsd->sc.data[SC_DANCING].timer == -1)
{
p_sd[(*c)++]=tsd->bl.id;
return skilllv;
@@ -7809,8 +7778,8 @@ static int skill_check_pc_partner(struct map_session_data *sd, int skill_id, int
default: //Warning: Assuming Ensemble skills here (for speed)
if (c > 0 && (tsd = map_id2sd(p_sd[0])) != NULL)
{
- sd->sc_data[SC_DANCING].val4= tsd->bl.id;
- status_change_start(&tsd->bl,SC_DANCING,skill_id,sd->sc_data[SC_DANCING].val2,0,sd->bl.id,skill_get_time(skill_id,*skill_lv)+1000,0);
+ sd->sc.data[SC_DANCING].val4= tsd->bl.id;
+ status_change_start(&tsd->bl,SC_DANCING,skill_id,sd->sc.data[SC_DANCING].val2,0,sd->bl.id,skill_get_time(skill_id,*skill_lv)+1000,0);
clif_skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1);
tsd->skillid_dance = tsd->skillid = skill_id;
tsd->skilllv_dance = tsd->skilllv = *skill_lv;
@@ -7889,7 +7858,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
return 1;
}
- if( sd->opt1>0) {
+ if( sd->sc.opt1 ) {
clif_skill_fail(sd,sd->skillid,0,0);
sd->skillitem = sd->skillitemlv = -1;
return 0;
@@ -7931,7 +7900,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
//Consume
sd->itemid = sd->itemindex = -1;
if(sd->skillid == WZ_EARTHSPIKE
- && sd->sc_data[SC_TKDORI].timer != -1 && rand()%100 > sd->sc_data[SC_TKDORI].val2) // [marquis007]
+ && sd->sc.data[SC_TKDORI].timer != -1 && rand()%100 > sd->sc.data[SC_TKDORI].val2) // [marquis007]
; //Do not consume item.
else
pc_delitem(sd,i,1,0);
@@ -7940,17 +7909,17 @@ int skill_check_condition(struct map_session_data *sd,int type)
sd->skillitem = sd->skillitemlv = -1;
return 1;
}
- if( sd->opt1>0 ){
+ if( sd->sc.opt1 ){
clif_skill_fail(sd,sd->skillid,0,0);
return 0;
}
- if(sd->sc_count){
- if( sd->sc_data[SC_SILENCE].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 ||
- (sd->sc_data[SC_MARIONETTE].timer != -1 && sd->skillid != CG_MARIONETTE)){
+ if(sd->sc.count){
+ if( sd->sc.data[SC_SILENCE].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 ||
+ (sd->sc.data[SC_MARIONETTE].timer != -1 && sd->skillid != CG_MARIONETTE)){
clif_skill_fail(sd,sd->skillid,0,0);
return 0; /* ?態異?や沈?など */
}
@@ -7993,7 +7962,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
zeny -= zeny*10/100;
break;
case AL_HOLYLIGHT:
- if(sd->sc_data[SC_SPIRIT].timer!=-1 && sd->sc_data[SC_SPIRIT].val2 == SL_PRIEST)
+ if(sd->sc.data[SC_SPIRIT].timer!=-1 && sd->sc.data[SC_SPIRIT].val2 == SL_PRIEST)
sp *= 5;
break;
case SL_SMA:
@@ -8017,7 +7986,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
case MO_COMBOFINISH:
case CH_TIGERFIST:
case CH_CHAINCRUSH:
- if(sd->sc_data[SC_SPIRIT].timer!=-1 && sd->sc_data[SC_SPIRIT].val2 == SL_MONK)
+ if(sd->sc.data[SC_SPIRIT].timer!=-1 && sd->sc.data[SC_SPIRIT].val2 == SL_MONK)
sp -= sp*25/100; //FIXME: Need real data. this is a custom value.
break;
}
@@ -8041,19 +8010,11 @@ int skill_check_condition(struct map_session_data *sd,int type)
case ST_CHASEWALK:
case PA_GOSPEL:
case CR_SHRINK:
- if(sd->sc_data[SkillStatusChangeTable[skill]].timer!=-1)
+ case TK_RUN:
+ if(sd->sc.data[SkillStatusChangeTable[skill]].timer!=-1)
return 1; /* 解?怩キる??はSP?チ費しない */
break;
- case TK_RUN:
- if(sd->sc_data[SC_RUN].timer!=-1){
- status_change_end(&sd->bl,SC_RUN,-1);
- if(sd->sc_data[SC_SPURT].timer!=-1)
- status_change_end(&sd->bl,SC_SPURT,-1);
- return 0;
- }
- break;
-
case AL_WARP:
if(!(type&2)) //Delete the item when the portal has been selected (type&2). [Skotlex]
delitem_flag = 0;
@@ -8092,40 +8053,40 @@ int skill_check_condition(struct map_session_data *sd,int type)
else sd->spiritball_old = lv;
break;
case MO_BODYRELOCATION:
- if (sd->sc_data[SC_EXPLOSIONSPIRITS].timer!=-1)
+ if (sd->sc.data[SC_EXPLOSIONSPIRITS].timer!=-1)
spiritball = 0;
break;
case MO_CHAINCOMBO: //連打?カ
- if(sd->sc_data[SC_BLADESTOP].timer==-1){
- if(sd->sc_data[SC_COMBO].timer == -1 || sd->sc_data[SC_COMBO].val1 != MO_TRIPLEATTACK)
+ if(sd->sc.data[SC_BLADESTOP].timer==-1){
+ if(sd->sc.data[SC_COMBO].timer == -1 || 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)
+ if(sd->sc.data[SC_COMBO].timer == -1 || 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)
+ if(sd->sc.data[SC_COMBO].timer == -1 || sd->sc.data[SC_COMBO].val1 != MO_COMBOFINISH)
return 0;
break;
case CH_CHAINCRUSH: //連柱崩?
- if(sd->sc_data[SC_COMBO].timer == -1)
+ 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(sd->sc.data[SC_COMBO].val1 != MO_COMBOFINISH && sd->sc.data[SC_COMBO].val1 != CH_TIGERFIST)
return 0;
break;
case MO_EXTREMITYFIST: // 阿?C羅覇鳳?
-// if(sd->sc_data[SC_EXTREMITYFIST].timer != -1) //To disable Asura during the 5 min skill block uncomment this...
+// if(sd->sc.data[SC_EXTREMITYFIST].timer != -1) //To disable Asura during the 5 min skill block uncomment this...
// return 0;
- if(sd->sc_data[SC_BLADESTOP].timer!=-1)
+ if(sd->sc.data[SC_BLADESTOP].timer!=-1)
spiritball--;
- else if (sd->sc_data[SC_COMBO].timer != -1) {
- if (sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH)
+ else if (sd->sc.data[SC_COMBO].timer != -1) {
+ if (sd->sc.data[SC_COMBO].val1 == MO_COMBOFINISH)
spiritball = 4;
- else if (sd->sc_data[SC_COMBO].val1 == CH_TIGERFIST)
+ else if (sd->sc.data[SC_COMBO].val1 == CH_TIGERFIST)
spiritball = 3;
- else if (sd->sc_data[SC_COMBO].val1 == CH_CHAINCRUSH)
+ else if (sd->sc.data[SC_COMBO].val1 == CH_CHAINCRUSH)
spiritball = sd->spiritball?sd->spiritball:1;
//It should consume whatever is left as long as it's at least 1.
}
@@ -8154,7 +8115,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
case TK_STORMKICK:
case TK_DOWNKICK:
case TK_COUNTER:
- if(sd->sc_data[SC_COMBO].timer != -1 && sd->sc_data[SC_COMBO].val1 == skill)
+ if(sd->sc.data[SC_COMBO].timer != -1 && sd->sc.data[SC_COMBO].val1 == skill)
break; //Combo ready.
if (pc_istop10fame(sd->char_id,MAPID_TAEKWON))
break; //Unlimited Combo
@@ -8162,7 +8123,8 @@ int skill_check_condition(struct map_session_data *sd,int type)
case BD_ADAPTATION: /* アドリブ */
{
struct skill_unit_group *group=NULL;
- if(sd->sc_data[SC_DANCING].timer==-1 || ((group=(struct skill_unit_group*)sd->sc_data[SC_DANCING].val2) && (skill_get_time(sd->sc_data[SC_DANCING].val1,group->skill_lv) - sd->sc_data[SC_DANCING].val3*1000) <= skill_get_time2(skill,lv))){ //ダンス中で使用後5秒以?繧フみ?H
+ if(sd->sc.data[SC_DANCING].timer==-1 ||
+ ((group=(struct skill_unit_group*)sd->sc.data[SC_DANCING].val2) && (skill_get_time(sd->sc.data[SC_DANCING].val1,group->skill_lv) - sd->sc.data[SC_DANCING].val3*1000) <= skill_get_time2(skill,lv))){ //ダンス中で使用後5秒以?繧フみ?H
clif_skill_fail(sd,skill,0,0);
return 0;
}
@@ -8248,12 +8210,12 @@ int skill_check_condition(struct map_session_data *sd,int type)
break;
case SL_SMA:
if(type) break; //Only do the combo check when the target is selected (type == 0)
- if(sd->sc_data[SC_COMBO].timer == -1 || sd->sc_data[SC_COMBO].val1 != skill)
+ if(sd->sc.data[SC_COMBO].timer == -1 || sd->sc.data[SC_COMBO].val1 != skill)
return 0;
break;
// skills require arrows as of 12/07 [celest]
case HT_POWER:
- if(sd->sc_data[SC_COMBO].timer == -1 || sd->sc_data[SC_COMBO].val1 != skill)
+ if(sd->sc.data[SC_COMBO].timer == -1 || sd->sc.data[SC_COMBO].val1 != skill)
return 0;
case AC_DOUBLE:
case AC_SHOWER:
@@ -8382,7 +8344,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
clif_skill_fail(sd,skill,0,0);
return 0;
case SG_FUSION:
- if ((sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_STAR) || sd->sc_data[SC_FUSION].timer != -1)
+ if ((sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_STAR) || sd->sc.data[SC_FUSION].timer != -1)
break;
return 0;
}
@@ -8412,7 +8374,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
switch(state) {
case ST_HIDING:
- if(!(sd->status.option&OPTION_HIDE)) {
+ if(!(sd->sc.option&OPTION_HIDE)) {
clif_skill_fail(sd,skill,0,0);
return 0;
}
@@ -8454,19 +8416,19 @@ int skill_check_condition(struct map_session_data *sd,int type)
}
break;
case ST_SIGHT:
- if(sd->sc_data[SC_SIGHT].timer == -1 && type&1) {
+ if(sd->sc.data[SC_SIGHT].timer == -1 && type&1) {
clif_skill_fail(sd,skill,0,0);
return 0;
}
break;
case ST_EXPLOSIONSPIRITS:
- if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer == -1) {
+ if(sd->sc.data[SC_EXPLOSIONSPIRITS].timer == -1) {
clif_skill_fail(sd,skill,0,0);
return 0;
}
break;
case ST_CARTBOOST:
- if(!pc_iscarton(sd) || sd->sc_data[SC_CARTBOOST].timer == -1) {
+ if(!pc_iscarton(sd) || sd->sc.data[SC_CARTBOOST].timer == -1) {
clif_skill_fail(sd,skill,0,0);
return 0;
}
@@ -8489,7 +8451,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
case ST_WATER:
//??齡サ定
//(!map[sd->bl.m].flag.rain) && //they have removed RAIN effect. [Lupus]
- if ( (sd->sc_data[SC_DELUGE].timer == -1) &&
+ if ( (sd->sc.data[SC_DELUGE].timer == -1) &&
(!map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER)))
{
clif_skill_fail(sd,skill,0,0);
@@ -8508,7 +8470,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
if(itemid[i] >= 715 && itemid[i] <= 717 && sd->special_state.no_gemstone && !force_gem_flag)
continue;
if(((itemid[i] >= 715 && itemid[i] <= 717) || itemid[i] == 1065)
- && sd->sc_data[SC_INTOABYSS].timer != -1 && !force_gem_flag)
+ && sd->sc.data[SC_INTOABYSS].timer != -1 && !force_gem_flag)
continue;
if((skill == AM_POTIONPITCHER ||
skill == CR_SLIMPITCHER ||
@@ -8523,7 +8485,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
clif_skill_fail(sd,skill,0,0);
return 0;
}
- if((itemid[i] >= 715 && itemid[i] <= 717) && sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_WIZARD)
+ if((itemid[i] >= 715 && itemid[i] <= 717) && sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_WIZARD)
index[i] = -1; //Gemstones are checked, but not substracted from inventory.
}
@@ -8567,7 +8529,7 @@ int skill_check_condition(struct map_session_data *sd,int type)
*/
int skill_castfix( struct block_list *bl, int skill_id, int skill_lv, int time)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, bl);
@@ -8604,16 +8566,16 @@ int skill_castfix( struct block_list *bl, int skill_id, int skill_lv, int time)
}
// calculate cast time reduced by skill bonuses
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
/* サフラギウム */
- if (sc_data) {
- if (sc_data[SC_SUFFRAGIUM].timer != -1) {
- time -= time * (sc_data[SC_SUFFRAGIUM].val1 * 15) / 100;
+ if (sc && sc->count) {
+ if (sc->data[SC_SUFFRAGIUM].timer != -1) {
+ time -= time * (sc->data[SC_SUFFRAGIUM].val1 * 15) / 100;
status_change_end(bl, SC_SUFFRAGIUM, -1);
}
/* ブラギの? */
- if (sc_data[SC_POEMBRAGI].timer != -1)
- time -= time * sc_data[SC_POEMBRAGI].val2 / 100;
+ if (sc->data[SC_POEMBRAGI].timer != -1)
+ time -= time * sc->data[SC_POEMBRAGI].val2 / 100;
}
// return final cast time
@@ -8625,7 +8587,7 @@ int skill_castfix( struct block_list *bl, int skill_id, int skill_lv, int time)
*/
int skill_delayfix( struct block_list *bl, int skill_id, int skill_lv, int time )
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, bl);
@@ -8665,18 +8627,18 @@ int skill_delayfix( struct block_list *bl, int skill_id, int skill_lv, int time
}
/* ブラギの? */
- sc_data = status_get_sc_data(bl);
- if (sc_data) {
- if (sc_data[SC_POEMBRAGI].timer != -1)
- time -= time * sc_data[SC_POEMBRAGI].val3 / 100;
- if (sc_data[SC_SPIRIT].timer != -1)
+ sc= status_get_sc(bl);
+ if (sc && sc->count) {
+ if (sc->data[SC_POEMBRAGI].timer != -1)
+ time -= time * sc->data[SC_POEMBRAGI].val3 / 100;
+ if (sc->data[SC_SPIRIT].timer != -1)
switch (skill_id) {
case CR_SHIELDBOOMERANG:
- if (sc_data[SC_SPIRIT].val2 == SL_CRUSADER)
+ if (sc->data[SC_SPIRIT].val2 == SL_CRUSADER)
time /=2;
break;
case AS_SONICBLOW:
- if (!map_flag_gvg(bl->m) && sc_data[SC_SPIRIT].val2 == SL_ASSASIN)
+ if (!map_flag_gvg(bl->m) && sc->data[SC_SPIRIT].val2 == SL_ASSASIN)
time /= 2;
break;
}
@@ -8693,7 +8655,7 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
{
struct map_session_data* tsd = NULL;
struct block_list *bl = NULL;
- struct status_change *sc_data;
+ struct status_change *sc;
int casttime, forcecast = 0;
unsigned int tick = gettick();
@@ -8702,13 +8664,14 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
if (skill_lv <= 0)
return 0;
- sc_data = sd->sc_data;
+ sc = sd->sc.count?&sd->sc:NULL;
+
switch(skill_num)
{ //Check for skills that auto-select target
case MO_CHAINCOMBO:
target_id = sd->attacktarget;
- if (sc_data[SC_BLADESTOP].timer != -1){
- if ((bl=(struct block_list *)sc_data[SC_BLADESTOP].val4) == NULL) //タ?ゲットがいない?
+ if (sc && sc->data[SC_BLADESTOP].timer != -1){
+ if ((bl=(struct block_list *)sc->data[SC_BLADESTOP].val4) == NULL) //タ?ゲットがいない?
return 0;
target_id = bl->id;
}
@@ -8725,8 +8688,8 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
case TK_JUMPKICK:
case TK_COUNTER:
case HT_POWER:
- if (sc_data[SC_COMBO].timer != -1 && sc_data[SC_COMBO].val1 == skill_num)
- target_id = sc_data[SC_COMBO].val2;
+ if (sc && sc->data[SC_COMBO].timer != -1 && sc->data[SC_COMBO].val1 == skill_num)
+ target_id = sc->data[SC_COMBO].val2;
else if (skill_num == TK_COUNTER) //This one is for Ranking TKers
target_id = sd->attacktarget;
else if (skill_num == HT_POWER)
@@ -8735,10 +8698,10 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
// -- moonsoul (altered to allow proper usage of extremity from new champion combos)
//
case MO_EXTREMITYFIST: /*阿修羅覇鳳拳*/
- if (sc_data[SC_COMBO].timer != -1 &&
- (sc_data[SC_COMBO].val1 == MO_COMBOFINISH ||
- sc_data[SC_COMBO].val1 == CH_TIGERFIST ||
- sc_data[SC_COMBO].val1 == CH_CHAINCRUSH))
+ if (sc && sc->data[SC_COMBO].timer != -1 &&
+ (sc->data[SC_COMBO].val1 == MO_COMBOFINISH ||
+ sc->data[SC_COMBO].val1 == CH_TIGERFIST ||
+ sc->data[SC_COMBO].val1 == CH_CHAINCRUSH))
target_id = sd->attacktarget;
break;
case WE_MALE:
@@ -8886,10 +8849,10 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
// -- moonsoul (altered to allow proper usage of extremity from new champion combos)
//
case MO_EXTREMITYFIST: /*阿?C羅覇鳳?*/
- if (sc_data && sc_data[SC_COMBO].timer != -1 &&
- (sc_data[SC_COMBO].val1 == MO_COMBOFINISH ||
- sc_data[SC_COMBO].val1 == CH_TIGERFIST ||
- sc_data[SC_COMBO].val1 == CH_CHAINCRUSH))
+ if (sc && sc->data[SC_COMBO].timer != -1 &&
+ (sc->data[SC_COMBO].val1 == MO_COMBOFINISH ||
+ sc->data[SC_COMBO].val1 == CH_TIGERFIST ||
+ sc->data[SC_COMBO].val1 == CH_CHAINCRUSH))
casttime = 0;
forcecast = 1;
break;
@@ -8919,7 +8882,7 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
case HP_BASILICA: /* バジリカ */
{
// cancel Basilica if already in effect
- if (sc_data && sc_data[SC_BASILICA].timer != -1 && sc_data[SC_BASILICA].val3 == BCT_SELF) {
+ if (sc && sc->data[SC_BASILICA].timer != -1 && sc->data[SC_BASILICA].val3 == BCT_SELF) {
status_change_end(&sd->bl,SC_BASILICA,-1);
return 0;
}
@@ -8928,9 +8891,9 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
}
//?モライズ?態ならキャストタイムが1/3
- if (sc_data && sc_data[SC_MEMORIZE].timer != -1 && casttime > 0) {
+ if (sc && sc->data[SC_MEMORIZE].timer != -1 && casttime > 0) {
casttime = casttime/2;
- if ((--sc_data[SC_MEMORIZE].val2) <= 0)
+ if ((--sc->data[SC_MEMORIZE].val2) <= 0)
status_change_end(&sd->bl, SC_MEMORIZE, -1);
}
@@ -8968,7 +8931,7 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
}
if (!(battle_config.pc_cloak_check_type&2) &&
- sc_data && sc_data[SC_CLOAKING].timer != -1 &&
+ sc && sc->data[SC_CLOAKING].timer != -1 &&
sd->skillid != AS_CLOAKING)
status_change_end(&sd->bl,SC_CLOAKING,-1);
@@ -9002,7 +8965,7 @@ int skill_use_id (struct map_session_data *sd, int target_id, int skill_num, int
int skill_use_pos (struct map_session_data *sd, int skill_x, int skill_y, int skill_num, int skill_lv)
{
struct block_list bl;
- struct status_change *sc_data;
+ struct status_change *sc;
int casttime, skill = 0;
unsigned int tick = gettick();
@@ -9027,7 +8990,7 @@ int skill_use_pos (struct map_session_data *sd, int skill_x, int skill_y, int sk
return 0;
}
- sc_data = sd->sc_data;
+ sc = sd->sc.count?&sd->sc:NULL;
if (!status_check_skilluse(&sd->bl, NULL, skill_num, 0))
return 0;
@@ -9078,9 +9041,9 @@ int skill_use_pos (struct map_session_data *sd, int skill_x, int skill_y, int sk
sd->bl.id, skill_x, skill_y, skill_num, skill_lv, casttime);
//?モライズ?態ならキャストタイムが1/3
- if (sc_data && sc_data[SC_MEMORIZE].timer != -1 && casttime > 0){
+ if (sc && sc->data[SC_MEMORIZE].timer != -1 && casttime > 0){
casttime = casttime/3;
- if ((--sc_data[SC_MEMORIZE].val2)<=0)
+ if ((--sc->data[SC_MEMORIZE].val2)<=0)
status_change_end(&sd->bl, SC_MEMORIZE, -1);
}
@@ -9094,7 +9057,7 @@ int skill_use_pos (struct map_session_data *sd, int skill_x, int skill_y, int sk
}
if (!(battle_config.pc_cloak_check_type&2) &&
- sc_data && sc_data[SC_CLOAKING].timer != -1)
+ sc && sc->data[SC_CLOAKING].timer != -1)
status_change_end(&sd->bl,SC_CLOAKING,-1);
sd->skilltarget = 0;
@@ -9477,7 +9440,7 @@ int skill_autospell(struct map_session_data *sd,int skillid)
if(skillid==MG_NAPALMBEAT) maxlv=3;
else if(skillid==MG_COLDBOLT || skillid==MG_FIREBOLT || skillid==MG_LIGHTNINGBOLT){
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_SAGE)
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_SAGE)
maxlv =10; //Soul Linker bonus. [Skotlex]
else if(skilllv==2) maxlv=1;
else if(skilllv==3) maxlv=2;
@@ -9688,7 +9651,7 @@ int skill_frostjoke_scream(struct block_list *bl,va_list ap)
return 0;
if (bl->type == BL_PC) {
struct map_session_data *sd = (struct map_session_data *)bl;
- if (sd && sd->status.option & OPTION_INVISIBLE && pc_isGM(sd) > 0)
+ if (sd && sd->sc.option & OPTION_INVISIBLE && pc_isGM(sd) > 0)
return 0;
}
//It has been reported that Scream/Joke works the same regardless of woe-setting. [Skotlex]
@@ -10002,26 +9965,28 @@ int skill_trap_splash (struct block_list *bl, va_list ap)
*/
int skill_enchant_elemental_end (struct block_list *bl, int type)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, bl);
- nullpo_retr(0, sc_data = status_get_sc_data(bl));
+ nullpo_retr(0, sc= status_get_sc(bl));
- if (type != SC_ENCPOISON && sc_data[SC_ENCPOISON].timer != -1) /* エンチャントポイズン解? */
+ if (!sc->count) return 0;
+
+ if (type != SC_ENCPOISON && sc->data[SC_ENCPOISON].timer != -1) /* エンチャントポイズン解? */
status_change_end(bl, SC_ENCPOISON, -1);
- if (type != SC_ASPERSIO && sc_data[SC_ASPERSIO].timer != -1) /* アスペルシオ解? */
+ if (type != SC_ASPERSIO && sc->data[SC_ASPERSIO].timer != -1) /* アスペルシオ解? */
status_change_end(bl, SC_ASPERSIO, -1);
- if (type != SC_FIREWEAPON && sc_data[SC_FIREWEAPON].timer != -1) /* フレイムランチャ解? */
+ if (type != SC_FIREWEAPON && sc->data[SC_FIREWEAPON].timer != -1) /* フレイムランチャ解? */
status_change_end(bl, SC_FIREWEAPON, -1);
- if (type != SC_WATERWEAPON && sc_data[SC_WATERWEAPON].timer != -1) /* フ?ストウェポン解? */
+ if (type != SC_WATERWEAPON && sc->data[SC_WATERWEAPON].timer != -1) /* フ?ストウェポン解? */
status_change_end(bl, SC_WATERWEAPON, -1);
- if (type != SC_WINDWEAPON && sc_data[SC_WINDWEAPON].timer != -1) /* ライトニング??ダ?解? */
+ if (type != SC_WINDWEAPON && sc->data[SC_WINDWEAPON].timer != -1) /* ライトニング??ダ?解? */
status_change_end(bl, SC_WINDWEAPON, -1);
- if (type != SC_EARTHWEAPON && sc_data[SC_EARTHWEAPON].timer != -1) /* サイスミックウェポン解? */
+ if (type != SC_EARTHWEAPON && sc->data[SC_EARTHWEAPON].timer != -1) /* サイスミックウェポン解? */
status_change_end(bl, SC_EARTHWEAPON, -1);
- if (type != SC_SHADOWWEAPON && sc_data[SC_SHADOWWEAPON].timer != -1)
+ if (type != SC_SHADOWWEAPON && sc->data[SC_SHADOWWEAPON].timer != -1)
status_change_end(bl, SC_SHADOWWEAPON, -1);
- if (type != SC_GHOSTWEAPON && sc_data[SC_GHOSTWEAPON].timer != -1)
+ if (type != SC_GHOSTWEAPON && sc->data[SC_GHOSTWEAPON].timer != -1)
status_change_end(bl, SC_GHOSTWEAPON, -1);
return 0;
}
@@ -10030,7 +9995,7 @@ int skill_enchant_elemental_end (struct block_list *bl, int type)
int skill_check_cloaking(struct block_list *bl)
{
struct map_session_data *sd = NULL;
- struct status_change *sc_data;
+ struct status_change *sc;
static int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1}; //optimized by Lupus
static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int end = 1,i;
@@ -10053,15 +10018,15 @@ int skill_check_cloaking(struct block_list *bl)
end = 0; //No wall check.
if(end){
- sc_data = status_get_sc_data(bl);
- if (sc_data && sc_data[SC_CLOAKING].timer != -1 && sc_data[SC_CLOAKING].val1 < 3) {
+ sc = status_get_sc(bl);
+ if (sc && sc->data[SC_CLOAKING].timer != -1 && sc->data[SC_CLOAKING].val1 < 3) {
status_change_end(bl, SC_CLOAKING, -1);
- } else if (sd && sd->sc_data[SC_CLOAKING].val3 != 130) {
+ } else if (sd && sd->sc.data[SC_CLOAKING].val3 != 130) {
status_quick_recalc_speed (sd, AS_CLOAKING, 130, 1);
}
}
else {
- if (sd && sd->sc_data[SC_CLOAKING].val3 != 103) {
+ if (sd && sd->sc.data[SC_CLOAKING].val3 != 103) {
status_quick_recalc_speed (sd, AS_CLOAKING, 103, 1);
}
}
@@ -10083,24 +10048,24 @@ int skill_check_cloaking(struct block_list *bl)
*/
void skill_stop_dancing(struct block_list *src)
{
- struct status_change* sc_data;
+ struct status_change* sc;
struct skill_unit_group* group;
struct map_session_data* dsd = NULL;
nullpo_retv(src);
- nullpo_retv(sc_data = status_get_sc_data(src));
+ nullpo_retv(sc = status_get_sc(src));
- if(sc_data[SC_DANCING].timer == -1)
+ if(!sc->count || sc->data[SC_DANCING].timer == -1)
return;
- group = (struct skill_unit_group *)sc_data[SC_DANCING].val2;
- sc_data[SC_DANCING].val2 = 0;
+ group = (struct skill_unit_group *)sc->data[SC_DANCING].val2;
+ sc->data[SC_DANCING].val2 = 0;
- if (sc_data[SC_DANCING].val4)
+ if (sc->data[SC_DANCING].val4)
{
- if (sc_data[SC_DANCING].val4 != BCT_SELF)
- dsd = map_id2sd(sc_data[SC_DANCING].val4);
- sc_data[SC_DANCING].val4 = 0;
+ if (sc->data[SC_DANCING].val4 != BCT_SELF)
+ dsd = map_id2sd(sc->data[SC_DANCING].val4);
+ sc->data[SC_DANCING].val4 = 0;
}
if (group)
@@ -10108,7 +10073,7 @@ void skill_stop_dancing(struct block_list *src)
if (dsd)
{
- dsd->sc_data[SC_DANCING].val4 = dsd->sc_data[SC_DANCING].val2 = 0;
+ dsd->sc.data[SC_DANCING].val4 = dsd->sc.data[SC_DANCING].val2 = 0;
status_change_end(&dsd->bl, SC_DANCING, -1);
}
status_change_end(src, SC_DANCING, -1);
@@ -10316,18 +10281,18 @@ int skill_delunitgroup(struct skill_unit_group *group)
if(src) {
if (skill_get_unit_flag(group->skill_id)&UF_DANCE)
{
- struct status_change* sc_data = status_get_sc_data(src);
- if (sc_data && sc_data[SC_DANCING].timer != -1)
+ struct status_change* sc = status_get_sc(src);
+ if (sc && sc->data[SC_DANCING].timer != -1)
{
- sc_data[SC_DANCING].val2 = 0 ; //This prevents status_change_end attempting to redelete the group. [Skotlex]
+ sc->data[SC_DANCING].val2 = 0 ; //This prevents status_change_end attempting to redelete the group. [Skotlex]
status_change_end(src,SC_DANCING,-1);
}
}
if (group->unit_id == UNT_GOSPEL) { //Clear Gospel [Skotlex]
- struct status_change *sc_data = status_get_sc_data(src);
- if(sc_data && sc_data[SC_GOSPEL].timer != -1) {
- sc_data[SC_GOSPEL].val3 = 0; //Remove reference to this group. [Skotlex]
+ struct status_change *sc = status_get_sc(src);
+ if(sc && sc->data[SC_GOSPEL].timer != -1) {
+ sc->data[SC_GOSPEL].val3 = 0; //Remove reference to this group. [Skotlex]
status_change_end(src,SC_GOSPEL,-1);
}
}
diff --git a/src/map/status.c b/src/map/status.c
index a407f86f8..b6e604979 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -626,12 +626,11 @@ int status_getrefinebonus(int lv,int type)
int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag)
{
int mode, race, hide_flag;
- struct status_change *sc_data=NULL, *tsc_data;
- short *option=NULL, *opt1=NULL;
+ struct status_change *sc=NULL, *tsc;
if (src && status_isdead(src))
return 0;
- if (target && status_isdead(target) && skill_num != ALL_RESURRECTION)
+ if (target && status_isdead(target) && skill_num != ALL_RESURRECTION && skill_num != PR_REDEMPTIO)
return 0;
if (skill_num == PA_PRESSURE && flag)
@@ -653,27 +652,23 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
if (race&INF_GROUND_SKILL && skill_get_unit_target(skill_num)&BCT_ENEMY)
return 0;
}
- if (src) {
- option = status_get_option(src);
- opt1 = status_get_opt1(src);
- sc_data = status_get_sc_data(src);
- }
+ if (src) sc = status_get_sc(src);
- if (opt1 && (*opt1) >0)
+ if(sc && sc->opt1 >0)
return 0;
- if(sc_data)
+ if(sc && sc->count)
{
if (
- (sc_data[SC_TRICKDEAD].timer != -1 && skill_num != NV_TRICKDEAD)
- || (sc_data[SC_AUTOCOUNTER].timer != -1 && skill_num != KN_AUTOCOUNTER)
- || (sc_data[SC_GOSPEL].timer != -1 && sc_data[SC_GOSPEL].val4 == BCT_SELF && skill_num != PA_GOSPEL)
- || sc_data[SC_GRAVITATION].timer != -1
+ (sc->data[SC_TRICKDEAD].timer != -1 && skill_num != NV_TRICKDEAD)
+ || (sc->data[SC_AUTOCOUNTER].timer != -1 && skill_num != KN_AUTOCOUNTER)
+ || (sc->data[SC_GOSPEL].timer != -1 && sc->data[SC_GOSPEL].val4 == BCT_SELF && skill_num != PA_GOSPEL)
+ || sc->data[SC_GRAVITATION].timer != -1
)
return 0;
- if (sc_data[SC_BLADESTOP].timer != -1) {
- switch (sc_data[SC_BLADESTOP].val1)
+ if (sc->data[SC_BLADESTOP].timer != -1) {
+ switch (sc->data[SC_BLADESTOP].val1)
{
case 1: return 0;
case 2: if (skill_num != MO_FINGEROFFENSIVE) return 0; break;
@@ -685,48 +680,49 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
}
if (skill_num)
{ //Skills blocked through status changes...
- if ((sc_data[SC_VOLCANO].timer != -1 && skill_num == WZ_ICEWALL) ||
- (sc_data[SC_ROKISWEIL].timer != -1 && skill_num != BD_ADAPTATION) ||
- (sc_data[SC_MARIONETTE].timer != -1 && skill_num != CG_MARIONETTE) ||
- (sc_data[SC_MARIONETTE2].timer != -1 && skill_num == CG_MARIONETTE) ||
- (sc_data[SC_HERMODE].timer != -1 && skill_get_inf(skill_num) & INF_SUPPORT_SKILL) ||
- sc_data[SC_SILENCE].timer != -1 || sc_data[SC_STEELBODY].timer != -1 ||
- sc_data[SC_BERSERK].timer != -1 || sc_data[SC_SKA].timer != -1
+ if ((sc->data[SC_VOLCANO].timer != -1 && skill_num == WZ_ICEWALL) ||
+ (sc->data[SC_ROKISWEIL].timer != -1 && skill_num != BD_ADAPTATION) ||
+ (sc->data[SC_MARIONETTE].timer != -1 && skill_num != CG_MARIONETTE) ||
+ (sc->data[SC_MARIONETTE2].timer != -1 && skill_num == CG_MARIONETTE) ||
+ (sc->data[SC_HERMODE].timer != -1 && skill_get_inf(skill_num) & INF_SUPPORT_SKILL) ||
+ sc->data[SC_SILENCE].timer != -1 || sc->data[SC_STEELBODY].timer != -1 ||
+ sc->data[SC_BERSERK].timer != -1 || sc->data[SC_SKA].timer != -1 ||
+ sc->data[SC_NOCHAT].timer != -1
)
return 0;
- if (sc_data[SC_DANCING].timer != -1)
+ if (sc->data[SC_DANCING].timer != -1)
{
if (skill_num != BD_ADAPTATION && skill_num != CG_LONGINGFREEDOM
&& skill_num != BA_MUSICALSTRIKE && skill_num != DC_THROWARROW)
return 0;
- if (sc_data[SC_DANCING].val1 == CG_HERMODE && skill_num == BD_ADAPTATION)
+ if (sc->data[SC_DANCING].val1 == CG_HERMODE && skill_num == BD_ADAPTATION)
return 0; //Can't amp out of Wand of Hermode :/ [Skotlex]
}
}
}
- if (option)
+ if (sc && sc->option)
{
- if ((*option)&OPTION_HIDE && skill_num != TF_HIDING && skill_num != AS_GRIMTOOTH
+ if (sc->option&OPTION_HIDE && skill_num != TF_HIDING && skill_num != AS_GRIMTOOTH
&& skill_num != RG_BACKSTAP && skill_num != RG_RAID)
return 0;
- if ((*option)&OPTION_CLOAK && skill_num == TF_HIDING)
+ if (sc->option&OPTION_CLOAK && skill_num == TF_HIDING)
return 0;
- if ((*option)&OPTION_CHASEWALK && skill_num != ST_CHASEWALK)
+ if (sc->option&OPTION_CHASEWALK && skill_num != ST_CHASEWALK)
return 0;
}
if (target == NULL || target == src) //No further checking needed.
return 1;
- tsc_data = status_get_sc_data(target);
- if(tsc_data)
+ tsc = status_get_sc(target);
+ if(tsc && tsc->count)
{
- if (!(mode & MD_BOSS) && tsc_data[SC_TRICKDEAD].timer != -1)
+ if (!(mode & MD_BOSS) && tsc->data[SC_TRICKDEAD].timer != -1)
return 0;
- if(skill_num == WZ_STORMGUST && tsc_data[SC_FREEZE].timer != -1)
+ if(skill_num == WZ_STORMGUST && tsc->data[SC_FREEZE].timer != -1)
return 0;
- if(skill_num == PR_LEXAETERNA && (tsc_data[SC_FREEZE].timer != -1 || (tsc_data[SC_STONE].timer != -1 && tsc_data[SC_STONE].val2 == 0)))
+ if(skill_num == PR_LEXAETERNA && (tsc->data[SC_FREEZE].timer != -1 || (tsc->data[SC_STONE].timer != -1 && tsc->data[SC_STONE].val2 == 0)))
return 0;
}
@@ -737,7 +733,6 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
if(skill_get_pl(skill_num) == 2)
mode|= MD_DETECTOR;
}
- option = status_get_option(target);
hide_flag = flag?OPTION_HIDE:(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK); //If targetting, cloak+hide protect you, otherwise only hiding does.
switch (target->type)
@@ -747,7 +742,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
struct map_session_data *sd = (struct map_session_data*) target;
if (pc_isinvisible(sd))
return 0;
- if (((*option)&hide_flag || sd->state.gangsterparadise)
+ if ((tsc->option&hide_flag || sd->state.gangsterparadise)
&& (sd->state.perfect_hiding || !(race == 4 || race == 6 || mode&MD_DETECTOR))
&& !(mode&MD_BOSS))
return 0;
@@ -763,9 +758,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int
return 0;
default:
//Check for chase-walk/hiding/cloaking opponents.
- if (option && !(mode&MD_BOSS))
+ if (tsc && !(mode&MD_BOSS))
{
- if ((*option)&hide_flag && !(race == 4 || race == 6 || mode&MD_DETECTOR))
+ if (tsc->option&hide_flag && !(race == 4 || race == 6 || mode&MD_DETECTOR))
return 0;
}
}
@@ -1258,20 +1253,20 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->paramb[4] += skill;
// Improve Concentration adds a percentage of base stat + job bonus + equipment bonus, but not from card bonus nor status change bonus
- if(sd->sc_count && sd->sc_data[SC_CONCENTRATE].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1){
- sd->paramb[1] += (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100;
- sd->paramb[4] += (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100;
+ if(sd->sc.count && sd->sc.data[SC_CONCENTRATE].timer!=-1 && sd->sc.data[SC_QUAGMIRE].timer == -1){
+ sd->paramb[1] += (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc.data[SC_CONCENTRATE].val1)/100;
+ sd->paramb[4] += (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc.data[SC_CONCENTRATE].val1)/100;
}
// Absolute modifiers from status changes (only for PC)
- if(sd->sc_count){
- if (sd->sc_data[SC_BATTLEORDERS].timer != -1) {
+ if(sd->sc.count){
+ if (sd->sc.data[SC_BATTLEORDERS].timer != -1) {
sd->paramb[0] += 5;
sd->paramb[3] += 5;
sd->paramb[4] += 5;
}
- if (sd->sc_data[SC_GUILDAURA].timer != -1) {
- int guildflag = sd->sc_data[SC_GUILDAURA].val4;
+ if (sd->sc.data[SC_GUILDAURA].timer != -1) {
+ int guildflag = sd->sc.data[SC_GUILDAURA].val4;
for (i = 12; i >= 0; i -= 4) {
skill = guildflag >> i;
switch (i) {
@@ -1294,8 +1289,8 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->paramb[5] = status_calc_luk(&sd->bl,sd->paramb[5]);
// Relative modifiers from status changes (only for PC)
- if(sd->sc_count){
- if(sd->sc_data[SC_MARIONETTE].timer!=-1){
+ if(sd->sc.count){
+ if(sd->sc.data[SC_MARIONETTE].timer!=-1){
sd->paramb[0]-= sd->status.str/2;
sd->paramb[1]-= sd->status.agi/2;
sd->paramb[2]-= sd->status.vit/2;
@@ -1303,8 +1298,8 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->paramb[4]-= sd->status.dex/2;
sd->paramb[5]-= sd->status.luk/2;
}
- else if(sd->sc_data[SC_MARIONETTE2].timer!=-1){
- struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3);
+ else if(sd->sc.data[SC_MARIONETTE2].timer!=-1){
+ struct map_session_data *psd = map_id2sd(sd->sc.data[SC_MARIONETTE2].val3);
if (psd) { // if partner is found
sd->paramb[0] += sd->status.str+psd->status.str/2 > 99 ? 99-sd->status.str : psd->status.str/2;
sd->paramb[1] += sd->status.agi+psd->status.agi/2 > 99 ? 99-sd->status.agi : psd->status.agi/2;
@@ -1324,8 +1319,8 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->paramc[4]=sd->status.dex+sd->paramb[4]+sd->parame[4];
sd->paramc[5]=sd->status.luk+sd->paramb[5]+sd->parame[5];
- if(sd->sc_count){
- if(sd->sc_data[SC_SPIRIT].timer!=-1 && sd->sc_data[SC_SPIRIT].val2 == SL_HIGH)
+ if(sd->sc.count){
+ if(sd->sc.data[SC_SPIRIT].timer!=-1 && sd->sc.data[SC_SPIRIT].val2 == SL_HIGH)
{ //Ups any status under 50 to 50.
if (sd->paramc[0] < 50) {
sd->paramb[0] += 50-sd->paramc[0];
@@ -1356,7 +1351,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
for(i=0;i<6;i++)
if(sd->paramc[i] < 0) sd->paramc[i] = 0;
- if (sd->sc_count && sd->sc_data[SC_CURSE].timer!=-1)
+ if (sd->sc.count && sd->sc.data[SC_CURSE].timer!=-1)
sd->paramc[5] = 0;
// ------ BASE ATTACK CALCULATION ------
@@ -1397,14 +1392,14 @@ int status_calc_pc(struct map_session_data* sd,int first)
// ----- WEAPON UPGRADE ATK CALCULATION -----
// Absolute modifiers from status changes (only for PC)
- if(sd->sc_count){
- if(sd->sc_data[SC_NIBELUNGEN].timer!=-1){
+ if(sd->sc.count){
+ if(sd->sc.data[SC_NIBELUNGEN].timer!=-1){
index = sd->equip_index[9];
if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4)
- sd->right_weapon.watk2 += sd->sc_data[SC_NIBELUNGEN].val2;
+ sd->right_weapon.watk2 += sd->sc.data[SC_NIBELUNGEN].val2;
index = sd->equip_index[8];
if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4)
- sd->left_weapon.watk2 += sd->sc_data[SC_NIBELUNGEN].val2;
+ sd->left_weapon.watk2 += sd->sc.data[SC_NIBELUNGEN].val2;
}
}
@@ -1503,9 +1498,9 @@ int status_calc_pc(struct map_session_data* sd,int first)
// ----- VIT-DEF CALCULATION -----
// Special fixed values from status changes
- if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1)
+ if(sd->sc.count && sd->sc.data[SC_BERSERK].timer!=-1)
sd->def2 = 0;
- else if(sd->sc_count && sd->sc_data[SC_ETERNALCHAOS].timer!=-1)
+ else if(sd->sc.count && sd->sc.data[SC_ETERNALCHAOS].timer!=-1)
sd->def2 = 0;
else {
// Basic VIT-DEF value
@@ -1541,7 +1536,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
// ----- INT-MDEF CALCULATION -----
// Special fixed values from status changes
- if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1)
+ if(sd->sc.count && sd->sc.data[SC_BERSERK].timer!=-1)
sd->mdef2 = 0;
else {
// Basic INT-MDEF value
@@ -1579,7 +1574,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->speed = status_calc_speed(&sd->bl,sd->speed);
// Relative modifiers from passive skills
- if((skill=pc_checkskill(sd,TF_MISS))>0 && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && sd->sc_data[SC_CLOAKING].timer==-1)
+ if((skill=pc_checkskill(sd,TF_MISS))>0 && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && sd->sc.data[SC_CLOAKING].timer==-1)
sd->speed -= sd->speed * skill/100;
if(pc_isriding(sd) && pc_checkskill(sd,KN_RIDING)>0)
sd->speed -= sd->speed * 25/100;
@@ -1591,15 +1586,15 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->prev_speed = sd->speed; //Store previous speed to correctly restore it. [Skotlex]
sd->speed += sd->speed * (75-5*skill)/100;
}
- if(sd->sc_count && sd->sc_data[SC_DANCING].timer!=-1){
+ if(sd->sc.count && sd->sc.data[SC_DANCING].timer!=-1){
int s_rate = 500-40*pc_checkskill(sd,(sd->status.sex?BA_MUSICALLESSON:DC_DANCINGLESSON));
- if (sd->sc_data[SC_SPIRIT].timer != -1 && sd->sc_data[SC_SPIRIT].val2 == SL_BARDDANCER)
+ if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_BARDDANCER)
s_rate -= 40; //TODO: Figure out real bonus rate.
- if (sd->sc_data[SC_LONGING].timer!=-1)
- s_rate -= 20 * sd->sc_data[SC_LONGING].val1;
+ if (sd->sc.data[SC_LONGING].timer!=-1)
+ s_rate -= 20 * sd->sc.data[SC_LONGING].val1;
sd->speed += sd->speed * s_rate/100;
}
- if(sd->sc_data[SC_FUSION].timer != -1) //Additional movement speed from SG_FUSION [Komurka]
+ if(sd->sc.data[SC_FUSION].timer != -1) //Additional movement speed from SG_FUSION [Komurka]
sd->speed -= sd->speed * 25/100;
// Apply relative modifiers from equipment
@@ -1734,7 +1729,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->status.sp=sd->status.max_sp;
if(sd->status.max_sp <= 0) sd->status.max_sp = 1;
- if(sd->sc_data[SC_DANCING].timer==-1){
+ if(sd->sc.data[SC_DANCING].timer==-1){
// Basic natural SP regeneration value
sd->nhealsp = 1 + (sd->paramc[3]/6) + (sd->status.max_sp/100);
if(sd->paramc[3] >= 120)
@@ -1785,9 +1780,9 @@ int status_calc_pc(struct map_session_data* sd,int first)
if((skill=pc_checkskill(sd,HP_MANARECHARGE))>0 )
sd->dsprate -= 4*skill;
- if(sd->sc_count){
- if(sd->sc_data[SC_SERVICE4U].timer!=-1)
- sd->dsprate -= sd->sc_data[SC_SERVICE4U].val3;
+ if(sd->sc.count){
+ if(sd->sc.data[SC_SERVICE4U].timer!=-1)
+ sd->dsprate -= sd->sc.data[SC_SERVICE4U].val3;
}
if(sd->dsprate < 0) sd->dsprate = 0;
@@ -1807,29 +1802,29 @@ int status_calc_pc(struct map_session_data* sd,int first)
sd->subrace[9]+=skill;
}
- if(sd->sc_count){
- if(sd->sc_data[SC_SIEGFRIED].timer!=-1){
- sd->subele[1] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[2] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[3] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[4] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[5] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[6] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[7] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[8] += sd->sc_data[SC_SIEGFRIED].val2;
- sd->subele[9] += sd->sc_data[SC_SIEGFRIED].val2;
+ if(sd->sc.count){
+ if(sd->sc.data[SC_SIEGFRIED].timer!=-1){
+ sd->subele[1] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[2] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[3] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[4] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[5] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[6] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[7] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[8] += sd->sc.data[SC_SIEGFRIED].val2;
+ sd->subele[9] += sd->sc.data[SC_SIEGFRIED].val2;
}
- if(sd->sc_data[SC_PROVIDENCE].timer!=-1){
- sd->subele[6] += sd->sc_data[SC_PROVIDENCE].val2;
- sd->subrace[6] += sd->sc_data[SC_PROVIDENCE].val2;
+ if(sd->sc.data[SC_PROVIDENCE].timer!=-1){
+ sd->subele[6] += sd->sc.data[SC_PROVIDENCE].val2;
+ sd->subrace[6] += sd->sc.data[SC_PROVIDENCE].val2;
}
}
// ----- CLIENT-SIDE REFRESH -----
if(first&1) { //Since this is the initial loading, the Falcon and Peco icons must be loaded. [Skotlex]
- if (sd->status.option&OPTION_FALCON)
+ if (sd->sc.option&OPTION_FALCON)
clif_status_load(&sd->bl, SI_FALCON, 1);
- if (sd->status.option&OPTION_RIDING)
+ if (sd->sc.option&OPTION_RIDING)
clif_status_load(&sd->bl, SI_RIDING, 1);
}
if(first&4) {
@@ -1849,10 +1844,10 @@ int status_calc_pc(struct map_session_data* sd,int first)
}
- if(sd->sc_data[SC_WEDDING].timer != -1 && sd->view_class != JOB_WEDDING)
+ if(sd->sc.data[SC_WEDDING].timer != -1 && sd->view_class != JOB_WEDDING)
sd->view_class=JOB_WEDDING;
- if(sd->sc_data[SC_XMAS].timer != -1 && sd->view_class != JOB_XMAS)
+ if(sd->sc.data[SC_XMAS].timer != -1 && sd->view_class != JOB_XMAS)
sd->view_class=JOB_XMAS;
if(b_class != sd->view_class) {
@@ -1923,8 +1918,8 @@ int status_calc_pc(struct map_session_data* sd,int first)
clif_updatestatus(sd,SP_SP);
/* I don't think there's a need for this here. It should be handled in pc_damage and pc_heal. [Skotlex]
- if(sd->status.hp<sd->status.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer!=-1 &&
- (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0) && !pc_isdead(sd))
+ if(sd->status.hp<sd->status.max_hp>>2 && sd->sc.data[SC_AUTOBERSERK].timer!=-1 &&
+ (sd->sc.data[SC_PROVOKE].timer==-1 || sd->sc.data[SC_PROVOKE].val2==0) && !pc_isdead(sd))
status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0);
*/
calculating = 0;
@@ -1937,28 +1932,28 @@ int status_calc_pc(struct map_session_data* sd,int first)
*/
int status_calc_str(struct block_list *bl, int str)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(str,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCALLSTATUS].timer!=-1)
- str += sc_data[SC_INCALLSTATUS].val1;
- if(sc_data[SC_INCSTR].timer!=-1)
- str += sc_data[SC_INCSTR].val1;
- if(sc_data[SC_STRFOOD].timer!=-1)
- str += sc_data[SC_STRFOOD].val1;
- if(sc_data[SC_LOUD].timer!=-1)
+ sc= status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCALLSTATUS].timer!=-1)
+ str += sc->data[SC_INCALLSTATUS].val1;
+ if(sc->data[SC_INCSTR].timer!=-1)
+ str += sc->data[SC_INCSTR].val1;
+ if(sc->data[SC_STRFOOD].timer!=-1)
+ str += sc->data[SC_STRFOOD].val1;
+ if(sc->data[SC_LOUD].timer!=-1)
str += 4;
- if(sc_data[SC_TRUESIGHT].timer!=-1)
+ if(sc->data[SC_TRUESIGHT].timer!=-1)
str += 5;
- if(sc_data[SC_SPURT].timer!=-1)
+ if(sc->data[SC_SPURT].timer!=-1)
str += 10; //Bonus is +!0 regardless of skill level
- if(sc_data[SC_BLESSING].timer != -1){
+ if(sc->data[SC_BLESSING].timer != -1){
int race = status_get_race(bl);
if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6)
str >>= 1;
- else str += sc_data[SC_BLESSING].val1;
+ else str += sc->data[SC_BLESSING].val1;
}
}
@@ -1967,25 +1962,25 @@ int status_calc_str(struct block_list *bl, int str)
int status_calc_agi(struct block_list *bl, int agi)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(agi,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCALLSTATUS].timer!=-1)
- agi += sc_data[SC_INCALLSTATUS].val1;
- if(sc_data[SC_INCAGI].timer!=-1)
- agi += sc_data[SC_INCAGI].val1;
- if(sc_data[SC_AGIFOOD].timer!=-1)
- agi += sc_data[SC_AGIFOOD].val1;
- if(sc_data[SC_TRUESIGHT].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCALLSTATUS].timer!=-1)
+ agi += sc->data[SC_INCALLSTATUS].val1;
+ if(sc->data[SC_INCAGI].timer!=-1)
+ agi += sc->data[SC_INCAGI].val1;
+ if(sc->data[SC_AGIFOOD].timer!=-1)
+ agi += sc->data[SC_AGIFOOD].val1;
+ if(sc->data[SC_TRUESIGHT].timer!=-1)
agi += 5;
- if(sc_data[SC_INCREASEAGI].timer!=-1)
- agi += 2 + sc_data[SC_INCREASEAGI].val1;
- if(sc_data[SC_DECREASEAGI].timer!=-1)
- agi -= 2 + sc_data[SC_DECREASEAGI].val1;
- if(sc_data[SC_QUAGMIRE].timer!=-1)
- agi -= sc_data[SC_QUAGMIRE].val1*(bl->type==BL_PC?5:10);
+ if(sc->data[SC_INCREASEAGI].timer!=-1)
+ agi += 2 + sc->data[SC_INCREASEAGI].val1;
+ if(sc->data[SC_DECREASEAGI].timer!=-1)
+ agi -= 2 + sc->data[SC_DECREASEAGI].val1;
+ if(sc->data[SC_QUAGMIRE].timer!=-1)
+ agi -= sc->data[SC_QUAGMIRE].val1*(bl->type==BL_PC?5:10);
}
return agi;
@@ -1993,21 +1988,21 @@ int status_calc_agi(struct block_list *bl, int agi)
int status_calc_vit(struct block_list *bl, int vit)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(vit,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCALLSTATUS].timer!=-1)
- vit += sc_data[SC_INCALLSTATUS].val1;
- if(sc_data[SC_INCVIT].timer!=-1)
- vit += sc_data[SC_INCVIT].val1;
- if(sc_data[SC_VITFOOD].timer!=-1)
- vit += sc_data[SC_VITFOOD].val1;
- if(sc_data[SC_TRUESIGHT].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCALLSTATUS].timer!=-1)
+ vit += sc->data[SC_INCALLSTATUS].val1;
+ if(sc->data[SC_INCVIT].timer!=-1)
+ vit += sc->data[SC_INCVIT].val1;
+ if(sc->data[SC_VITFOOD].timer!=-1)
+ vit += sc->data[SC_VITFOOD].val1;
+ if(sc->data[SC_TRUESIGHT].timer!=-1)
vit += 5;
- if(sc_data[SC_STRIPARMOR].timer!=-1 && bl->type != BL_PC)
- vit -= vit * 8*sc_data[SC_STRIPARMOR].val1/100;
+ if(sc->data[SC_STRIPARMOR].timer!=-1 && bl->type != BL_PC)
+ vit -= vit * 8*sc->data[SC_STRIPARMOR].val1/100;
}
return vit;
@@ -2015,27 +2010,27 @@ int status_calc_vit(struct block_list *bl, int vit)
int status_calc_int(struct block_list *bl, int int_)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(int_,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCALLSTATUS].timer!=-1)
- int_ += sc_data[SC_INCALLSTATUS].val1;
- if(sc_data[SC_INCINT].timer!=-1)
- int_ += sc_data[SC_INCINT].val1;
- if(sc_data[SC_INTFOOD].timer!=-1)
- int_ += sc_data[SC_INTFOOD].val1;
- if(sc_data[SC_TRUESIGHT].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCALLSTATUS].timer!=-1)
+ int_ += sc->data[SC_INCALLSTATUS].val1;
+ if(sc->data[SC_INCINT].timer!=-1)
+ int_ += sc->data[SC_INCINT].val1;
+ if(sc->data[SC_INTFOOD].timer!=-1)
+ int_ += sc->data[SC_INTFOOD].val1;
+ if(sc->data[SC_TRUESIGHT].timer!=-1)
int_ += 5;
- if(sc_data[SC_BLESSING].timer != -1){
+ if(sc->data[SC_BLESSING].timer != -1){
int race = status_get_race(bl);
if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6)
int_ >>= 1;
- else int_ += sc_data[SC_BLESSING].val1;
+ else int_ += sc->data[SC_BLESSING].val1;
}
- if(sc_data[SC_STRIPHELM].timer!=-1 && bl->type != BL_PC)
- int_ -= int_ * 8*sc_data[SC_STRIPHELM].val1/100;
+ if(sc->data[SC_STRIPHELM].timer!=-1 && bl->type != BL_PC)
+ int_ -= int_ * 8*sc->data[SC_STRIPHELM].val1/100;
}
return int_;
@@ -2043,26 +2038,26 @@ int status_calc_int(struct block_list *bl, int int_)
int status_calc_dex(struct block_list *bl, int dex)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(dex,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCALLSTATUS].timer!=-1)
- dex += sc_data[SC_INCALLSTATUS].val1;
- if(sc_data[SC_INCDEX].timer!=-1)
- dex += sc_data[SC_INCDEX].val1;
- if(sc_data[SC_DEXFOOD].timer!=-1)
- dex += sc_data[SC_DEXFOOD].val1;
- if(sc_data[SC_TRUESIGHT].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCALLSTATUS].timer!=-1)
+ dex += sc->data[SC_INCALLSTATUS].val1;
+ if(sc->data[SC_INCDEX].timer!=-1)
+ dex += sc->data[SC_INCDEX].val1;
+ if(sc->data[SC_DEXFOOD].timer!=-1)
+ dex += sc->data[SC_DEXFOOD].val1;
+ if(sc->data[SC_TRUESIGHT].timer!=-1)
dex += 5;
- if(sc_data[SC_QUAGMIRE].timer!=-1)
- dex -= sc_data[SC_QUAGMIRE].val1*(bl->type==BL_PC?5:10);
- if(sc_data[SC_BLESSING].timer != -1){
+ if(sc->data[SC_QUAGMIRE].timer!=-1)
+ dex -= sc->data[SC_QUAGMIRE].val1*(bl->type==BL_PC?5:10);
+ if(sc->data[SC_BLESSING].timer != -1){
int race = status_get_race(bl);
if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6)
dex >>= 1;
- else dex += sc_data[SC_BLESSING].val1;
+ else dex += sc->data[SC_BLESSING].val1;
}
}
@@ -2071,20 +2066,20 @@ int status_calc_dex(struct block_list *bl, int dex)
int status_calc_luk(struct block_list *bl, int luk)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(luk,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCALLSTATUS].timer!=-1)
- luk += sc_data[SC_INCALLSTATUS].val1;
- if(sc_data[SC_INCLUK].timer!=-1)
- luk += sc_data[SC_INCLUK].val1;
- if(sc_data[SC_LUKFOOD].timer!=-1)
- luk += sc_data[SC_LUKFOOD].val1;
- if(sc_data[SC_TRUESIGHT].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCALLSTATUS].timer!=-1)
+ luk += sc->data[SC_INCALLSTATUS].val1;
+ if(sc->data[SC_INCLUK].timer!=-1)
+ luk += sc->data[SC_INCLUK].val1;
+ if(sc->data[SC_LUKFOOD].timer!=-1)
+ luk += sc->data[SC_LUKFOOD].val1;
+ if(sc->data[SC_TRUESIGHT].timer!=-1)
luk += 5;
- if(sc_data[SC_GLORIA].timer!=-1)
+ if(sc->data[SC_GLORIA].timer!=-1)
luk += 30;
}
@@ -2093,28 +2088,28 @@ int status_calc_luk(struct block_list *bl, int luk)
int status_calc_batk(struct block_list *bl, int batk)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(batk,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_ATKPOTION].timer!=-1)
- batk += sc_data[SC_ATKPOTION].val1;
- if(sc_data[SC_BATKFOOD].timer!=-1)
- batk += sc_data[SC_BATKFOOD].val1;
- if(sc_data[SC_INCATKRATE].timer!=-1)
- batk += batk * sc_data[SC_INCATKRATE].val1/100;
- if(sc_data[SC_PROVOKE].timer!=-1)
- batk += batk * (2+3*sc_data[SC_PROVOKE].val1)/100;
- if(sc_data[SC_CONCENTRATION].timer!=-1)
- batk += batk * 5*sc_data[SC_CONCENTRATION].val1/100;
- if(sc_data[SC_SKE].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_ATKPOTION].timer!=-1)
+ batk += sc->data[SC_ATKPOTION].val1;
+ if(sc->data[SC_BATKFOOD].timer!=-1)
+ batk += sc->data[SC_BATKFOOD].val1;
+ if(sc->data[SC_INCATKRATE].timer!=-1)
+ batk += batk * sc->data[SC_INCATKRATE].val1/100;
+ if(sc->data[SC_PROVOKE].timer!=-1)
+ batk += batk * (2+3*sc->data[SC_PROVOKE].val1)/100;
+ if(sc->data[SC_CONCENTRATION].timer!=-1)
+ batk += batk * 5*sc->data[SC_CONCENTRATION].val1/100;
+ if(sc->data[SC_SKE].timer!=-1)
batk += batk * 3;
- if(sc_data[SC_JOINTBEAT].timer!=-1 && sc_data[SC_JOINTBEAT].val2==4)
+ if(sc->data[SC_JOINTBEAT].timer!=-1 && sc->data[SC_JOINTBEAT].val2==4)
batk -= batk * 25/100;
- if(sc_data[SC_CURSE].timer!=-1)
+ if(sc->data[SC_CURSE].timer!=-1)
batk -= batk * 25/100;
- if(sc_data[SC_BLEEDING].timer != -1)
+ if(sc->data[SC_BLEEDING].timer != -1)
batk -= batk * 25/100;
}
@@ -2123,56 +2118,56 @@ int status_calc_batk(struct block_list *bl, int batk)
int status_calc_watk(struct block_list *bl, int watk)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(watk,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_IMPOSITIO].timer!=-1)
- watk += 5*sc_data[SC_IMPOSITIO].val1;
- if(sc_data[SC_WATKFOOD].timer!=-1)
- watk += sc_data[SC_WATKFOOD].val1;
- if(sc_data[SC_DRUMBATTLE].timer!=-1)
- watk += sc_data[SC_DRUMBATTLE].val2;
- if(sc_data[SC_VOLCANO].timer!=-1 && status_get_elem_type(bl)==3)
- watk += sc_data[SC_VOLCANO].val3;
- if(sc_data[SC_INCATKRATE].timer!=-1)
- watk += watk * sc_data[SC_INCATKRATE].val1/100;
- if(sc_data[SC_PROVOKE].timer!=-1)
- watk += watk * (2+3*sc_data[SC_PROVOKE].val1)/100;
- if(sc_data[SC_CONCENTRATION].timer!=-1)
- watk += watk * 5*sc_data[SC_CONCENTRATION].val1/100;
- if(sc_data[SC_SKE].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_IMPOSITIO].timer!=-1)
+ watk += 5*sc->data[SC_IMPOSITIO].val1;
+ if(sc->data[SC_WATKFOOD].timer!=-1)
+ watk += sc->data[SC_WATKFOOD].val1;
+ if(sc->data[SC_DRUMBATTLE].timer!=-1)
+ watk += sc->data[SC_DRUMBATTLE].val2;
+ if(sc->data[SC_VOLCANO].timer!=-1 && status_get_elem_type(bl)==3)
+ watk += sc->data[SC_VOLCANO].val3;
+ if(sc->data[SC_INCATKRATE].timer!=-1)
+ watk += watk * sc->data[SC_INCATKRATE].val1/100;
+ if(sc->data[SC_PROVOKE].timer!=-1)
+ watk += watk * (2+3*sc->data[SC_PROVOKE].val1)/100;
+ if(sc->data[SC_CONCENTRATION].timer!=-1)
+ watk += watk * 5*sc->data[SC_CONCENTRATION].val1/100;
+ if(sc->data[SC_SKE].timer!=-1)
watk += watk * 3;
- if(sc_data[SC_NIBELUNGEN].timer!=-1 && bl->type != BL_PC && (status_get_element(bl)/10)>=8)
- watk += sc_data[SC_NIBELUNGEN].val2;
- if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1 && bl->type != BL_PC)
- watk += (1000*sc_data[SC_EXPLOSIONSPIRITS].val1);
- if(sc_data[SC_CURSE].timer!=-1)
+ if(sc->data[SC_NIBELUNGEN].timer!=-1 && bl->type != BL_PC && (status_get_element(bl)/10)>=8)
+ watk += sc->data[SC_NIBELUNGEN].val2;
+ if(sc->data[SC_EXPLOSIONSPIRITS].timer!=-1 && bl->type != BL_PC)
+ watk += (1000*sc->data[SC_EXPLOSIONSPIRITS].val1);
+ if(sc->data[SC_CURSE].timer!=-1)
watk -= watk * 25/100;
- if(sc_data[SC_STRIPWEAPON].timer!=-1 && bl->type != BL_PC)
- watk -= watk * 5*sc_data[SC_STRIPWEAPON].val1/100;
+ if(sc->data[SC_STRIPWEAPON].timer!=-1 && bl->type != BL_PC)
+ watk -= watk * 5*sc->data[SC_STRIPWEAPON].val1/100;
}
return watk;
}
int status_calc_matk(struct block_list *bl, int matk)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(matk,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_MATKPOTION].timer!=-1)
- matk += sc_data[SC_MATKPOTION].val1;
- if(sc_data[SC_MATKFOOD].timer!=-1)
- matk += sc_data[SC_MATKFOOD].val1;
- if(sc_data[SC_MAGICPOWER].timer!=-1)
- matk += matk * 5*sc_data[SC_MAGICPOWER].val1/100;
- if(sc_data[SC_MINDBREAKER].timer!=-1)
- matk += matk * 20*sc_data[SC_MINDBREAKER].val1/100;
- if(sc_data[SC_INCMATKRATE].timer!=-1)
- matk += matk * sc_data[SC_INCMATKRATE].val1/100;
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_MATKPOTION].timer!=-1)
+ matk += sc->data[SC_MATKPOTION].val1;
+ if(sc->data[SC_MATKFOOD].timer!=-1)
+ matk += sc->data[SC_MATKFOOD].val1;
+ if(sc->data[SC_MAGICPOWER].timer!=-1)
+ matk += matk * 5*sc->data[SC_MAGICPOWER].val1/100;
+ if(sc->data[SC_MINDBREAKER].timer!=-1)
+ matk += matk * 20*sc->data[SC_MINDBREAKER].val1/100;
+ if(sc->data[SC_INCMATKRATE].timer!=-1)
+ matk += matk * sc->data[SC_INCMATKRATE].val1/100;
}
return matk;
@@ -2180,18 +2175,18 @@ int status_calc_matk(struct block_list *bl, int matk)
int status_calc_critical(struct block_list *bl, int critical)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(critical,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if (sc_data[SC_EXPLOSIONSPIRITS].timer!=-1)
- critical += sc_data[SC_EXPLOSIONSPIRITS].val2;
- if (sc_data[SC_FORTUNE].timer!=-1)
- critical += sc_data[SC_FORTUNE].val2*10;
- if (sc_data[SC_TRUESIGHT].timer!=-1)
- critical += sc_data[SC_TRUESIGHT].val1*10;
- if(sc_data[SC_CLOAKING].timer!=-1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if (sc->data[SC_EXPLOSIONSPIRITS].timer!=-1)
+ critical += sc->data[SC_EXPLOSIONSPIRITS].val2;
+ if (sc->data[SC_FORTUNE].timer!=-1)
+ critical += sc->data[SC_FORTUNE].val2*10;
+ if (sc->data[SC_TRUESIGHT].timer!=-1)
+ critical += sc->data[SC_TRUESIGHT].val1*10;
+ if(sc->data[SC_CLOAKING].timer!=-1)
critical += critical;
}
@@ -2200,24 +2195,24 @@ int status_calc_critical(struct block_list *bl, int critical)
int status_calc_hit(struct block_list *bl, int hit)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(hit,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCHIT].timer != -1)
- hit += sc_data[SC_INCHIT].val1;
- if(sc_data[SC_HITFOOD].timer!=-1)
- hit += sc_data[SC_HITFOOD].val1;
- if(sc_data[SC_TRUESIGHT].timer != -1)
- hit += 3*sc_data[SC_TRUESIGHT].val1;
- if(sc_data[SC_HUMMING].timer!=-1)
- hit += sc_data[SC_HUMMING].val2;
- if(sc_data[SC_CONCENTRATION].timer != -1)
- hit += 10*sc_data[SC_CONCENTRATION].val1;
- if(sc_data[SC_INCHITRATE].timer != -1)
- hit += hit * sc_data[SC_INCHITRATE].val1/100;
- if(sc_data[SC_BLIND].timer != -1)
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCHIT].timer != -1)
+ hit += sc->data[SC_INCHIT].val1;
+ if(sc->data[SC_HITFOOD].timer!=-1)
+ hit += sc->data[SC_HITFOOD].val1;
+ if(sc->data[SC_TRUESIGHT].timer != -1)
+ hit += 3*sc->data[SC_TRUESIGHT].val1;
+ if(sc->data[SC_HUMMING].timer!=-1)
+ hit += sc->data[SC_HUMMING].val2;
+ if(sc->data[SC_CONCENTRATION].timer != -1)
+ hit += 10*sc->data[SC_CONCENTRATION].val1;
+ if(sc->data[SC_INCHITRATE].timer != -1)
+ hit += hit * sc->data[SC_INCHITRATE].val1/100;
+ if(sc->data[SC_BLIND].timer != -1)
hit -= hit * 25 / 100;
}
@@ -2226,32 +2221,32 @@ int status_calc_hit(struct block_list *bl, int hit)
int status_calc_flee(struct block_list *bl, int flee)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(flee,bl);
- sc_data = status_get_sc_data(bl);
-
- if(sc_data){
- if(sc_data[SC_INCFLEE].timer!=-1)
- flee += sc_data[SC_INCFLEE].val1;
- if(sc_data[SC_FLEEFOOD].timer!=-1)
- flee += sc_data[SC_FLEEFOOD].val1;
- if(sc_data[SC_WHISTLE].timer!=-1)
- flee += sc_data[SC_WHISTLE].val2;
- if(sc_data[SC_WINDWALK].timer!=-1)
- flee += flee * sc_data[SC_WINDWALK].val2/100;
- if(sc_data[SC_INCFLEERATE].timer!=-1)
- flee += flee * sc_data[SC_INCFLEERATE].val1/100;
- if(sc_data[SC_VIOLENTGALE].timer!=-1 && status_get_elem_type(bl)==4)
- flee += flee * sc_data[SC_VIOLENTGALE].val3/100;
- if(sc_data[SC_MOON_COMFORT].timer!=-1) //SG skill [Komurka]
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count){
+ if(sc->data[SC_INCFLEE].timer!=-1)
+ flee += sc->data[SC_INCFLEE].val1;
+ if(sc->data[SC_FLEEFOOD].timer!=-1)
+ flee += sc->data[SC_FLEEFOOD].val1;
+ if(sc->data[SC_WHISTLE].timer!=-1)
+ flee += sc->data[SC_WHISTLE].val2;
+ if(sc->data[SC_WINDWALK].timer!=-1)
+ flee += flee * sc->data[SC_WINDWALK].val2/100;
+ if(sc->data[SC_INCFLEERATE].timer!=-1)
+ flee += flee * sc->data[SC_INCFLEERATE].val1/100;
+ if(sc->data[SC_VIOLENTGALE].timer!=-1 && status_get_elem_type(bl)==4)
+ flee += flee * sc->data[SC_VIOLENTGALE].val3/100;
+ if(sc->data[SC_MOON_COMFORT].timer!=-1) //SG skill [Komurka]
flee += (status_get_lv(bl) + status_get_dex(bl) + status_get_luk(bl))/10;
- if(sc_data[SC_CLOSECONFINE].timer!=-1)
+ if(sc->data[SC_CLOSECONFINE].timer!=-1)
flee += 10;
- if(sc_data[SC_SPIDERWEB].timer!=-1)
+ if(sc->data[SC_SPIDERWEB].timer!=-1)
flee -= flee * 50/100;
- if(sc_data[SC_BERSERK].timer!=-1)
+ if(sc->data[SC_BERSERK].timer!=-1)
flee -= flee * 50/100;
- if(sc_data[SC_BLIND].timer!=-1)
+ if(sc->data[SC_BLIND].timer!=-1)
flee -= flee * 25/100;
}
@@ -2262,13 +2257,13 @@ int status_calc_flee(struct block_list *bl, int flee)
int status_calc_flee2(struct block_list *bl, int flee2)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(flee2,bl);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
- if(sc_data){
- if(sc_data[SC_WHISTLE].timer!=-1)
- flee2 += sc_data[SC_WHISTLE].val3*10;
+ if(sc && sc->count){
+ if(sc->data[SC_WHISTLE].timer!=-1)
+ flee2 += sc->data[SC_WHISTLE].val3*10;
}
return flee2;
@@ -2276,33 +2271,33 @@ int status_calc_flee2(struct block_list *bl, int flee2)
int status_calc_def(struct block_list *bl, int def)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(def,bl);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
- if(sc_data){
- if(sc_data[SC_BERSERK].timer!=-1)
+ if(sc && sc->count){
+ if(sc->data[SC_BERSERK].timer!=-1)
return 0;
- if(sc_data[SC_KEEPING].timer!=-1)
+ if(sc->data[SC_KEEPING].timer!=-1)
return 100;
- if(sc_data[SC_STEELBODY].timer!=-1)
+ if(sc->data[SC_STEELBODY].timer!=-1)
return 90;
- if(sc_data[SC_SKA].timer != -1) // [marquis007]
+ if(sc->data[SC_SKA].timer != -1) // [marquis007]
return 90;
- if(sc_data[SC_DRUMBATTLE].timer!=-1)
- def += sc_data[SC_DRUMBATTLE].val3;
- if(sc_data[SC_INCDEFRATE].timer!=-1)
- def += def * sc_data[SC_INCDEFRATE].val1/100;
- if(sc_data[SC_SIGNUMCRUCIS].timer!=-1)
- def -= def * sc_data[SC_SIGNUMCRUCIS].val2/100;
- if(sc_data[SC_CONCENTRATION].timer!=-1)
- def -= def * 5*sc_data[SC_CONCENTRATION].val1/100;
- if(sc_data[SC_SKE].timer!=-1)
+ if(sc->data[SC_DRUMBATTLE].timer!=-1)
+ def += sc->data[SC_DRUMBATTLE].val3;
+ if(sc->data[SC_INCDEFRATE].timer!=-1)
+ def += def * sc->data[SC_INCDEFRATE].val1/100;
+ if(sc->data[SC_SIGNUMCRUCIS].timer!=-1)
+ def -= def * sc->data[SC_SIGNUMCRUCIS].val2/100;
+ if(sc->data[SC_CONCENTRATION].timer!=-1)
+ def -= def * 5*sc->data[SC_CONCENTRATION].val1/100;
+ if(sc->data[SC_SKE].timer!=-1)
def -= def * 50/100;
- if(sc_data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) // Provoke doesn't alter player defense.
- def -= def * (5+5*sc_data[SC_PROVOKE].val1)/100;
- if(sc_data[SC_STRIPSHIELD].timer!=-1 && bl->type != BL_PC)
- def -= def * 3*sc_data[SC_STRIPSHIELD].val1/100;
+ if(sc->data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) // Provoke doesn't alter player defense.
+ def -= def * (5+5*sc->data[SC_PROVOKE].val1)/100;
+ if(sc->data[SC_STRIPSHIELD].timer!=-1 && bl->type != BL_PC)
+ def -= def * 3*sc->data[SC_STRIPSHIELD].val1/100;
}
return def;
@@ -2310,33 +2305,33 @@ int status_calc_def(struct block_list *bl, int def)
int status_calc_def2(struct block_list *bl, int def2)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(def2,bl);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
- if(sc_data){
- if(sc_data[SC_BERSERK].timer!=-1)
+ if(sc && sc->count){
+ if(sc->data[SC_BERSERK].timer!=-1)
return 0;
- if(sc_data[SC_ETERNALCHAOS].timer!=-1)
+ if(sc->data[SC_ETERNALCHAOS].timer!=-1)
return 0;
- if(sc_data[SC_SUN_COMFORT].timer!=-1)
+ if(sc->data[SC_SUN_COMFORT].timer!=-1)
def2 += (status_get_lv(bl) + status_get_dex(bl) + status_get_luk(bl))/2;
- if(sc_data[SC_ANGELUS].timer!=-1)
- def2 += def2 * (10+5*sc_data[SC_ANGELUS].val1)/100;
- if(sc_data[SC_CONCENTRATION].timer!=-1)
- def2 -= def2 * 5*sc_data[SC_CONCENTRATION].val1/100;
- if(sc_data[SC_POISON].timer!=-1)
+ if(sc->data[SC_ANGELUS].timer!=-1)
+ def2 += def2 * (10+5*sc->data[SC_ANGELUS].val1)/100;
+ if(sc->data[SC_CONCENTRATION].timer!=-1)
+ def2 -= def2 * 5*sc->data[SC_CONCENTRATION].val1/100;
+ if(sc->data[SC_POISON].timer!=-1)
def2 -= def2 * 25/100;
- if(sc_data[SC_SKE].timer!=-1)
+ if(sc->data[SC_SKE].timer!=-1)
def2 -= def2 * 50/100;
- if(sc_data[SC_PROVOKE].timer!=-1)
- def2 -= def2 * (5+5*sc_data[SC_PROVOKE].val1)/100;
- if(sc_data[SC_SKE].timer!=-1)
+ if(sc->data[SC_PROVOKE].timer!=-1)
+ def2 -= def2 * (5+5*sc->data[SC_PROVOKE].val1)/100;
+ if(sc->data[SC_SKE].timer!=-1)
def2 /= 2;
- if(sc_data[SC_JOINTBEAT].timer!=-1){
- if(sc_data[SC_JOINTBEAT].val2==3)
+ if(sc->data[SC_JOINTBEAT].timer!=-1){
+ if(sc->data[SC_JOINTBEAT].val2==3)
def2 -= def2 * 50/100;
- else if(sc_data[SC_JOINTBEAT].val2==4)
+ else if(sc->data[SC_JOINTBEAT].val2==4)
def2 -= def2 * 25/100;
}
}
@@ -2346,21 +2341,21 @@ int status_calc_def2(struct block_list *bl, int def2)
int status_calc_mdef(struct block_list *bl, int mdef)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(mdef,bl);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
- if(sc_data){
- if(sc_data[SC_BERSERK].timer!=-1)
+ if(sc && sc->count){
+ if(sc->data[SC_BERSERK].timer!=-1)
return 0;
- if(sc_data[SC_BARRIER].timer!=-1)
+ if(sc->data[SC_BARRIER].timer!=-1)
return 100;
- if(sc_data[SC_STEELBODY].timer!=-1)
+ if(sc->data[SC_STEELBODY].timer!=-1)
return 90;
- if(sc_data[SC_SKA].timer != -1) // [marquis007]
+ if(sc->data[SC_SKA].timer != -1) // [marquis007]
return 90; // should it up mdef too?
- if(sc_data[SC_ENDURE].timer!=-1)
- mdef += sc_data[SC_ENDURE].val1;
+ if(sc->data[SC_ENDURE].timer!=-1)
+ mdef += sc->data[SC_ENDURE].val1;
}
return mdef;
@@ -2368,15 +2363,15 @@ int status_calc_mdef(struct block_list *bl, int mdef)
int status_calc_mdef2(struct block_list *bl, int mdef2)
{
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(mdef2,bl);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
- if(sc_data){
- if(sc_data[SC_BERSERK].timer!=-1)
+ if(sc && sc->count){
+ if(sc->data[SC_BERSERK].timer!=-1)
return 0;
- if(sc_data[SC_MINDBREAKER].timer!=-1)
- mdef2 -= mdef2 * 12*sc_data[SC_MINDBREAKER].val1/100;
+ if(sc->data[SC_MINDBREAKER].timer!=-1)
+ mdef2 -= mdef2 * 12*sc->data[SC_MINDBREAKER].val1/100;
}
return mdef2;
@@ -2384,145 +2379,143 @@ int status_calc_mdef2(struct block_list *bl, int mdef2)
int status_calc_speed(struct block_list *bl, int speed)
{
- struct status_change *sc_data;
- sc_data = status_get_sc_data(bl);
-
- if(sc_data) {
- if(sc_data[SC_CURSE].timer!=-1)
- speed += 450;
- if(sc_data[SC_SWOO].timer != -1) // [marquis007]
- speed += 450; //Let's use Curse's slow down momentarily (exact value unknown)
- if(sc_data[SC_SPEEDUP1].timer!=-1)
- speed -= speed*50/100;
- else if(sc_data[SC_SPEEDUP0].timer!=-1)
- speed -= speed*25/100;
- else if(sc_data[SC_INCREASEAGI].timer!=-1)
- speed -= speed * 25/100;
- else if(sc_data[SC_CARTBOOST].timer!=-1)
- speed -= speed * 20/100;
- else if(sc_data[SC_BERSERK].timer!=-1)
- speed -= speed * 20/100;
- else if(sc_data[SC_WINDWALK].timer!=-1)
- speed -= speed * 4*sc_data[SC_WINDWALK].val2/100;
- if(sc_data[SC_WEDDING].timer!=-1)
- speed += speed * 50/100;
- if(sc_data[SC_SLOWDOWN].timer!=-1)
- speed += speed * 50/100;
- if(sc_data[SC_DECREASEAGI].timer!=-1)
- speed += speed * 25/100;
- if(sc_data[SC_STEELBODY].timer!=-1)
- speed += speed * 25/100;
- if(sc_data[SC_SKA].timer!=-1)
- speed += speed * 25/100;
- if(sc_data[SC_QUAGMIRE].timer!=-1)
+ struct status_change *sc;
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count) {
+ if(sc->data[SC_CURSE].timer!=-1)
+ speed += 450;
+ if(sc->data[SC_SWOO].timer != -1) // [marquis007]
+ speed += 450; //Let's use Curse's slow down momentarily (exact value unknown)
+ if(sc->data[SC_SPEEDUP1].timer!=-1)
+ speed -= speed*50/100;
+ else if(sc->data[SC_SPEEDUP0].timer!=-1)
+ speed -= speed*25/100;
+ else if(sc->data[SC_INCREASEAGI].timer!=-1)
+ speed -= speed * 25/100;
+ else if(sc->data[SC_CARTBOOST].timer!=-1)
+ speed -= speed * 20/100;
+ else if(sc->data[SC_BERSERK].timer!=-1)
+ speed -= speed * 20/100;
+ else if(sc->data[SC_WINDWALK].timer!=-1)
+ speed -= speed * 4*sc->data[SC_WINDWALK].val2/100;
+ if(sc->data[SC_WEDDING].timer!=-1)
+ speed += speed * 50/100;
+ if(sc->data[SC_SLOWDOWN].timer!=-1)
+ speed += speed * 50/100;
+ if(sc->data[SC_DECREASEAGI].timer!=-1)
+ speed += speed * 25/100;
+ if(sc->data[SC_STEELBODY].timer!=-1)
+ speed += speed * 25/100;
+ if(sc->data[SC_SKA].timer!=-1)
+ speed += speed * 25/100;
+ if(sc->data[SC_QUAGMIRE].timer!=-1)
+ speed += speed * 50/100;
+ if(sc->data[SC_DONTFORGETME].timer!=-1)
+ speed += speed * sc->data[SC_DONTFORGETME].val3/100;
+ if(sc->data[SC_DEFENDER].timer!=-1)
+ speed += speed * (55-5*sc->data[SC_DEFENDER].val1)/100;
+ if(sc->data[SC_GOSPEL].timer!=-1 && sc->data[SC_GOSPEL].val4 == BCT_ENEMY)
+ speed += speed * 25/100;
+ if(sc->data[SC_JOINTBEAT].timer!=-1) {
+ if (sc->data[SC_JOINTBEAT].val2 == 0)
speed += speed * 50/100;
- if(sc_data[SC_DONTFORGETME].timer!=-1)
- speed += speed * sc_data[SC_DONTFORGETME].val3/100;
- if(sc_data[SC_DEFENDER].timer!=-1)
- speed += speed * (55-5*sc_data[SC_DEFENDER].val1)/100;
- if(sc_data[SC_GOSPEL].timer!=-1 && sc_data[SC_GOSPEL].val4 == BCT_ENEMY)
- speed += speed * 25/100;
- if(sc_data[SC_JOINTBEAT].timer!=-1) {
- if (sc_data[SC_JOINTBEAT].val2 == 0)
- speed += speed * 50/100;
- else if (sc_data[SC_JOINTBEAT].val2 == 2)
- speed += speed * 30/100;
- }
- if(sc_data[SC_CLOAKING].timer!=-1)
- speed = speed * (sc_data[SC_CLOAKING].val3-3*sc_data[SC_CLOAKING].val1) /100;
- if(sc_data[SC_CHASEWALK].timer!=-1)
- speed = speed * sc_data[SC_CHASEWALK].val3/100;
- if(sc_data[SC_RUN].timer!=-1)/*駆け足による速度変化*/
- speed -= speed * 25/100;
-
+ else if (sc->data[SC_JOINTBEAT].val2 == 2)
+ speed += speed * 30/100;
}
+ if(sc->data[SC_CLOAKING].timer!=-1)
+ speed = speed * (sc->data[SC_CLOAKING].val3-3*sc->data[SC_CLOAKING].val1) /100;
+ if(sc->data[SC_CHASEWALK].timer!=-1)
+ speed = speed * sc->data[SC_CHASEWALK].val3/100;
+ if(sc->data[SC_RUN].timer!=-1)/*駆け足による速度変化*/
+ speed -= speed * 25/100;
+ }
return speed;
}
int status_calc_aspd_rate(struct block_list *bl, int aspd_rate)
{
- struct status_change *sc_data;
- sc_data = status_get_sc_data(bl);
-
- if(sc_data) {
- int i;
- if(sc_data[SC_QUAGMIRE].timer==-1 && sc_data[SC_DONTFORGETME].timer==-1){
- if(sc_data[SC_TWOHANDQUICKEN].timer!=-1)
- aspd_rate -= 30;
- else if(sc_data[SC_ONEHAND].timer!=-1)
- aspd_rate -= 30;
- else if(sc_data[SC_ADRENALINE2].timer!=-1)
- aspd_rate -= (sc_data[SC_ADRENALINE2].val2 || !battle_config.party_skill_penalty)?30:20;
- else if(sc_data[SC_ADRENALINE].timer!=-1)
- aspd_rate -= (sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)?30:20;
- else if(sc_data[SC_SPEARSQUICKEN].timer!=-1)
- aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2;
- else if(sc_data[SC_ASSNCROS].timer!=-1 && (bl->type!=BL_PC || ((struct map_session_data*)bl)->status.weapon != 11))
- aspd_rate -= sc_data[SC_ASSNCROS].val2;
- }
- if(sc_data[SC_BERSERK].timer!=-1)
+ struct status_change *sc;
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count) {
+ int i;
+ if(sc->data[SC_QUAGMIRE].timer==-1 && sc->data[SC_DONTFORGETME].timer==-1){
+ if(sc->data[SC_TWOHANDQUICKEN].timer!=-1)
aspd_rate -= 30;
- if(sc_data[i=SC_ASPDPOTION3].timer!=-1 || sc_data[i=SC_ASPDPOTION2].timer!=-1 || sc_data[i=SC_ASPDPOTION1].timer!=-1 || sc_data[i=SC_ASPDPOTION0].timer!=-1)
- aspd_rate -= sc_data[i].val2;
- if(sc_data[SC_DONTFORGETME].timer!=-1)
- aspd_rate += sc_data[SC_DONTFORGETME].val2;
- if(sc_data[SC_STEELBODY].timer!=-1)
- aspd_rate += 25;
- if(sc_data[SC_SKA].timer!=-1)
- aspd_rate += 25;
- if(sc_data[SC_DEFENDER].timer != -1)
- aspd_rate += 25 -sc_data[SC_DEFENDER].val1*5;
- if(sc_data[SC_GOSPEL].timer!=-1 && sc_data[SC_GOSPEL].val4 == BCT_ENEMY)
- aspd_rate += 25;
- if(sc_data[SC_GRAVITATION].timer!=-1)
- aspd_rate += sc_data[SC_GRAVITATION].val2;
- if(sc_data[SC_BLEEDING].timer != -1)
+ else if(sc->data[SC_ONEHAND].timer!=-1)
+ aspd_rate -= 30;
+ else if(sc->data[SC_ADRENALINE2].timer!=-1)
+ aspd_rate -= (sc->data[SC_ADRENALINE2].val2 || !battle_config.party_skill_penalty)?30:20;
+ else if(sc->data[SC_ADRENALINE].timer!=-1)
+ aspd_rate -= (sc->data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)?30:20;
+ else if(sc->data[SC_SPEARSQUICKEN].timer!=-1)
+ aspd_rate -= sc->data[SC_SPEARSQUICKEN].val2;
+ else if(sc->data[SC_ASSNCROS].timer!=-1 && (bl->type!=BL_PC || ((struct map_session_data*)bl)->status.weapon != 11))
+ aspd_rate -= sc->data[SC_ASSNCROS].val2;
+ }
+ if(sc->data[SC_BERSERK].timer!=-1)
+ aspd_rate -= 30;
+ if(sc->data[i=SC_ASPDPOTION3].timer!=-1 || sc->data[i=SC_ASPDPOTION2].timer!=-1 || sc->data[i=SC_ASPDPOTION1].timer!=-1 || sc->data[i=SC_ASPDPOTION0].timer!=-1)
+ aspd_rate -= sc->data[i].val2;
+ if(sc->data[SC_DONTFORGETME].timer!=-1)
+ aspd_rate += sc->data[SC_DONTFORGETME].val2;
+ if(sc->data[SC_STEELBODY].timer!=-1)
+ aspd_rate += 25;
+ if(sc->data[SC_SKA].timer!=-1)
+ aspd_rate += 25;
+ if(sc->data[SC_DEFENDER].timer != -1)
+ aspd_rate += 25 -sc->data[SC_DEFENDER].val1*5;
+ if(sc->data[SC_GOSPEL].timer!=-1 && sc->data[SC_GOSPEL].val4 == BCT_ENEMY)
+ aspd_rate += 25;
+ if(sc->data[SC_GRAVITATION].timer!=-1)
+ aspd_rate += sc->data[SC_GRAVITATION].val2;
+ if(sc->data[SC_BLEEDING].timer != -1)
+ aspd_rate += 25;
+ if(sc->data[SC_JOINTBEAT].timer!=-1) {
+ if (sc->data[SC_JOINTBEAT].val2 == 1)
aspd_rate += 25;
- if(sc_data[SC_JOINTBEAT].timer!=-1) {
- if (sc_data[SC_JOINTBEAT].val2 == 1)
- aspd_rate += 25;
- else if (sc_data[SC_JOINTBEAT].val2 == 2)
- aspd_rate += 10;
-
- if(sc_data[SC_STAR_COMFORT].timer!=-1 && bl->m == ((struct map_session_data *)bl)->feel_map[2].m) //SG skill [Komurka]
- aspd_rate -= (status_get_lv(bl) + status_get_dex(bl) + status_get_luk(bl))/10;
- }
+ else if (sc->data[SC_JOINTBEAT].val2 == 2)
+ aspd_rate += 10;
}
+ if(sc->data[SC_STAR_COMFORT].timer!=-1)
+ aspd_rate -= (status_get_lv(bl) + status_get_dex(bl) + status_get_luk(bl))/10;
+ }
return aspd_rate;
}
int status_calc_maxhp(struct block_list *bl, int maxhp)
{
- struct status_change *sc_data;
- sc_data = status_get_sc_data(bl);
-
- if(sc_data) {
- if(sc_data[SC_INCMHPRATE].timer!=-1)
- maxhp += maxhp * sc_data[SC_INCMHPRATE].val1/100;
- if(sc_data[SC_APPLEIDUN].timer!=-1)
- maxhp += maxhp * sc_data[SC_APPLEIDUN].val2/100;
- if(sc_data[SC_DELUGE].timer!=-1 && status_get_elem_type(bl)==1)
- maxhp += maxhp * deluge_eff[sc_data[SC_DELUGE].val1-1]/100;
- if(sc_data[SC_BERSERK].timer!=-1)
- maxhp += maxhp * 2;
- }
+ struct status_change *sc;
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count) {
+ if(sc->data[SC_INCMHPRATE].timer!=-1)
+ maxhp += maxhp * sc->data[SC_INCMHPRATE].val1/100;
+ if(sc->data[SC_APPLEIDUN].timer!=-1)
+ maxhp += maxhp * sc->data[SC_APPLEIDUN].val2/100;
+ if(sc->data[SC_DELUGE].timer!=-1 && status_get_elem_type(bl)==1)
+ maxhp += maxhp * deluge_eff[sc->data[SC_DELUGE].val1-1]/100;
+ if(sc->data[SC_BERSERK].timer!=-1)
+ maxhp += maxhp * 2;
+ }
return maxhp;
}
int status_calc_maxsp(struct block_list *bl, int maxsp)
{
- struct status_change *sc_data;
- sc_data = status_get_sc_data(bl);
-
- if(sc_data) {
- if(sc_data[SC_INCMSPRATE].timer!=-1)
- maxsp += maxsp * sc_data[SC_INCMSPRATE].val1/100;
- if(sc_data[SC_SERVICE4U].timer!=-1)
- maxsp += maxsp * sc_data[SC_SERVICE4U].val2/100;
- }
+ struct status_change *sc;
+ sc = status_get_sc(bl);
+
+ if(sc && sc->count) {
+ if(sc->data[SC_INCMSPRATE].timer!=-1)
+ maxsp += maxsp * sc->data[SC_INCMSPRATE].val1/100;
+ if(sc->data[SC_SERVICE4U].timer!=-1)
+ maxsp += maxsp * sc->data[SC_SERVICE4U].val2/100;
+ }
return maxsp;
}
@@ -2556,15 +2549,15 @@ int status_quick_recalc_speed(struct map_session_data *sd, int skill_num, int sk
sd->speed = sd->prev_speed;
break;
case AS_CLOAKING:
- if (start && sd->sc_data[SC_CLOAKING].timer != -1)
+ if (start && sd->sc.data[SC_CLOAKING].timer != -1)
{ //There shouldn't be an "stop" case here.
//If the previous upgrade was
- //SPEED_ADD_RATE(3*sd->sc_data[SC_CLOAKING].val1 -sd->sc_data[SC_CLOAKING].val3);
+ //SPEED_ADD_RATE(3*sd->sc.data[SC_CLOAKING].val1 -sd->sc.data[SC_CLOAKING].val3);
//Then just changing val3 should be a net difference of....
- if (3*sd->sc_data[SC_CLOAKING].val1 != sd->sc_data[SC_CLOAKING].val3) //This reverts the previous value.
- sd->speed = sd->speed * 100 /(sd->sc_data[SC_CLOAKING].val3-3*sd->sc_data[SC_CLOAKING].val1);
- sd->sc_data[SC_CLOAKING].val3 = skill_lv;
- sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100;
+ if (3*sd->sc.data[SC_CLOAKING].val1 != sd->sc.data[SC_CLOAKING].val3) //This reverts the previous value.
+ sd->speed = sd->speed * 100 /(sd->sc.data[SC_CLOAKING].val3-3*sd->sc.data[SC_CLOAKING].val1);
+ sd->sc.data[SC_CLOAKING].val3 = skill_lv;
+ sd->speed = sd->speed * (sd->sc.data[SC_CLOAKING].val3-sd->sc.data[SC_CLOAKING].val1*3) /100;
}
break;
}
@@ -3300,10 +3293,10 @@ int status_get_amotion(struct block_list *bl)
int status_get_dmotion(struct block_list *bl)
{
int ret;
- struct status_change *sc_data;
+ struct status_change *sc;
nullpo_retr(0, bl);
- sc_data = status_get_sc_data(bl);
+ sc = status_get_sc(bl);
if(bl->type==BL_MOB){
ret=((struct mob_data *)bl)->db->dmotion;
if(battle_config.monster_damage_delay_rate != 100)
@@ -3319,7 +3312,7 @@ int status_get_dmotion(struct block_list *bl)
else
return 2000;
- if(sc_data && (sc_data[SC_ENDURE].timer!=-1 || sc_data[SC_CONCENTRATION].timer!=-1 || sc_data[SC_BERSERK].timer!=-1))
+ if(sc && sc->count && (sc->data[SC_ENDURE].timer!=-1 || sc->data[SC_CONCENTRATION].timer!=-1 || sc->data[SC_BERSERK].timer!=-1))
if (!map_flag_gvg(bl->m)) //Only works on non-gvg grounds. [Skotlex]
return 0;
@@ -3328,16 +3321,16 @@ int status_get_dmotion(struct block_list *bl)
int status_get_element(struct block_list *bl)
{
// removed redundant variable ret [zzo]
- struct status_change *sc_data = status_get_sc_data(bl);
+ struct status_change *sc= status_get_sc(bl);
nullpo_retr(20, bl);
- if(sc_data) {
- if( sc_data[SC_BENEDICTIO].timer!=-1 ) // 聖体降福
+ if(sc && sc->count) {
+ if( sc->data[SC_BENEDICTIO].timer!=-1 ) // 聖体降福
return 26;
- if( sc_data[SC_FREEZE].timer!=-1 ) // 凍結
+ if( sc->data[SC_FREEZE].timer!=-1 ) // 凍結
return 21;
- if( sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0)
+ if( sc->data[SC_STONE].timer!=-1 && sc->data[SC_STONE].val2==0)
return 22;
}
if(bl->type==BL_MOB) // 10の位=Lv*2、1の位=属性
@@ -3352,23 +3345,23 @@ int status_get_element(struct block_list *bl)
//Retrieves the object's element acquired by status changes only.
int status_get_attack_sc_element(struct block_list *bl)
{
- struct status_change *sc_data=status_get_sc_data(bl);
- if(sc_data) {
- if( sc_data[SC_WATERWEAPON].timer!=-1) // フロストウェポン
+ struct status_change *sc =status_get_sc(bl);
+ if(sc && sc->count) {
+ if( sc->data[SC_WATERWEAPON].timer!=-1) // フロストウェポン
return 1;
- if( sc_data[SC_EARTHWEAPON].timer!=-1) // サイズミックウェポン
+ if( sc->data[SC_EARTHWEAPON].timer!=-1) // サイズミックウェポン
return 2;
- if( sc_data[SC_FIREWEAPON].timer!=-1) // フレームランチャー
+ if( sc->data[SC_FIREWEAPON].timer!=-1) // フレームランチャー
return 3;
- if( sc_data[SC_WINDWEAPON].timer!=-1) // ライトニングローダー
+ if( sc->data[SC_WINDWEAPON].timer!=-1) // ライトニングローダー
return 4;
- if( sc_data[SC_ENCPOISON].timer!=-1) // エンチャントポイズン
+ if( sc->data[SC_ENCPOISON].timer!=-1) // エンチャントポイズン
return 5;
- if( sc_data[SC_ASPERSIO].timer!=-1) // アスペルシオ
+ if( sc->data[SC_ASPERSIO].timer!=-1) // アスペルシオ
return 6;
- if( sc_data[SC_SHADOWWEAPON].timer!=-1)
+ if( sc->data[SC_SHADOWWEAPON].timer!=-1)
return 7;
- if( sc_data[SC_GHOSTWEAPON].timer!=-1)
+ if( sc->data[SC_GHOSTWEAPON].timer!=-1)
return 8;
}
return 0;
@@ -3464,7 +3457,7 @@ int status_get_size(struct block_list *bl)
nullpo_retr(1, bl);
switch (bl->type) {
case BL_MOB:
- if (((struct mob_data *)bl)->sc_data[SC_SWOO].timer != -1) // [marquis007]
+ if (((struct mob_data *)bl)->sc.data[SC_SWOO].timer != -1) // [marquis007]
return 0;
return ((struct mob_data *)bl)->db->size;
case BL_PET:
@@ -3472,7 +3465,7 @@ int status_get_size(struct block_list *bl)
case BL_PC:
{
struct map_session_data *sd = (struct map_session_data *)bl;
- if (sd->sc_data[SC_SWOO].timer != -1)
+ if (sd->sc.data[SC_SWOO].timer != -1)
return 0;
if (sd->class_&JOBL_BABY) //[Lupus]
return (pc_isriding(sd) && battle_config.character_size&2); //Baby Class Peco Rider + enabled option -> size = 1, else 0
@@ -3535,79 +3528,26 @@ int status_isimmune(struct block_list *bl)
if (bl->type == BL_PC) {
if (sd->special_state.no_magic_damage)
return 1;
- if (sd->sc_count && sd->sc_data[SC_HERMODE].timer != -1)
+ if (sd->sc.count && sd->sc.data[SC_HERMODE].timer != -1)
return 1;
}
return 0;
}
-// StatusChange系の所得
-struct status_change *status_get_sc_data(struct block_list *bl)
+struct status_change *status_get_sc(struct block_list *bl)
{
nullpo_retr(NULL, bl);
if(bl->type==BL_MOB)
- return ((struct mob_data*)bl)->sc_data;
+ return &((struct mob_data*)bl)->sc;
if(bl->type==BL_PC)
- return ((struct map_session_data*)bl)->sc_data;
+ return &((struct map_session_data*)bl)->sc;
return NULL;
}
-short *status_get_sc_count(struct block_list *bl)
-{
- nullpo_retr(NULL, bl);
- if(bl->type==BL_MOB)
- return &((struct mob_data*)bl)->sc_count;
- if(bl->type==BL_PC)
- return &((struct map_session_data*)bl)->sc_count;
- return NULL;
-}
-short *status_get_opt1(struct block_list *bl)
-{
- nullpo_retr(0, bl);
- if(bl->type==BL_MOB)
- return &((struct mob_data*)bl)->opt1;
- if(bl->type==BL_PC)
- return &((struct map_session_data*)bl)->opt1;
- if(bl->type==BL_NPC)
- return &((struct npc_data*)bl)->opt1;
- return 0;
-}
-short *status_get_opt2(struct block_list *bl)
-{
- nullpo_retr(0, bl);
- if(bl->type==BL_MOB)
- return &((struct mob_data*)bl)->opt2;
- if(bl->type==BL_PC)
- return &((struct map_session_data*)bl)->opt2;
- if(bl->type==BL_NPC)
- return &((struct npc_data*)bl)->opt2;
- return 0;
-}
-short *status_get_opt3(struct block_list *bl)
-{
- nullpo_retr(0, bl);
- if(bl->type==BL_MOB)
- return &((struct mob_data*)bl)->opt3;
- if(bl->type==BL_PC)
- return &((struct map_session_data*)bl)->opt3;
- if(bl->type==BL_NPC)
- return &((struct npc_data*)bl)->opt3;
- return 0;
-}
-short *status_get_option(struct block_list *bl)
-{
- nullpo_retr(0, bl);
- if(bl->type==BL_MOB)
- return &((struct mob_data*)bl)->option;
- if(bl->type==BL_PC)
- return &((struct map_session_data*)bl)->status.option;
- if(bl->type==BL_NPC)
- return &((struct npc_data*)bl)->option;
- return 0;
-}
int status_get_sc_def(struct block_list *bl, int type)
{
int sc_def;
+ struct status_change* sc;
nullpo_retr(0, bl);
switch (type)
@@ -3653,21 +3593,21 @@ int status_get_sc_def(struct block_list *bl, int type)
break;
}
+ sc = status_get_sc(bl);
+ if (sc && sc->count)
+ {
+ if (sc->data[SC_SCRESIST].timer != -1)
+ sc_def -= sc->data[SC_SCRESIST].val1; //Status resist
+ else if (sc->data[SC_SIEGFRIED].timer != -1)
+ sc_def -= sc->data[SC_SIEGFRIED].val2; //Status resistance.
+ }
+
if(bl->type == BL_MOB) {
struct mob_data *md = (struct mob_data *)bl;
if (md->class_ == MOBID_EMPERIUM)
return 0;
if (sc_def < 50)
sc_def = 50;
- } else if(bl->type == BL_PC) {
- struct status_change* sc_data = status_get_sc_data(bl);
- if (sc_data)
- {
- if (sc_data[SC_SCRESIST].timer != -1)
- sc_def -= sc_data[SC_SCRESIST].val1; //Status resist
- else if (sc_data[SC_SIEGFRIED].timer != -1)
- sc_def -= sc_data[SC_SIEGFRIED].val2; //Status resistance.
- }
}
return (sc_def < 0) ? 0 : sc_def;
}
@@ -3685,53 +3625,30 @@ int status_get_sc_def(struct block_list *bl, int type)
int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag)
{
struct map_session_data *sd = NULL;
- struct status_change* sc_data;
- short *sc_count, *option, *opt1, *opt2, *opt3;
+ struct status_change* sc;
int opt_flag = 0, calc_flag = 0,updateflag = 0, save_flag = 0, race, mode, elem, undead_flag;
int scdef = 0;
nullpo_retr(0, bl);
- switch (bl->type)
- {
- case BL_PC:
- sd=(struct map_session_data *)bl;
- if (status_isdead(bl))
- return 0;
- break;
- case BL_MOB:
- if (((struct mob_data*)bl)->class_ == MOBID_EMPERIUM && type != SC_SAFETYWALL)
- return 0; //Emperium can't be afflicted by status changes.
- if (status_isdead(bl))
- return 0;
- break;
- case BL_PET: //Because pets can't have status changes.
- case BL_SKILL: //These may happen by attacking traps or the like. [Skotlex]
- return 0;
- default:
- if(battle_config.error_log)
- ShowError("status_change_start: invalid source type (%d)!\n", bl->type);
- return 0;
- }
+ sc=status_get_sc(bl);
+
+ if (!sc || status_isdead(bl))
+ return 0;
+
if(type < 0 || type >= SC_MAX) {
if(battle_config.error_log)
ShowError("status_change_start: invalid status change (%d)!\n", type);
return 0;
}
- sc_data=status_get_sc_data(bl);
- sc_count=status_get_sc_count(bl);
- option=status_get_option(bl);
- opt1=status_get_opt1(bl);
- opt2=status_get_opt2(bl);
- opt3=status_get_opt3(bl);
race=status_get_race(bl);
mode=status_get_mode(bl);
elem=status_get_elem_type(bl);
undead_flag=battle_check_undead(race,elem);
- if(type == SC_AETERNA && (sc_data[SC_STONE].timer != -1 || sc_data[SC_FREEZE].timer != -1) )
+ if(type == SC_AETERNA && (sc->data[SC_STONE].timer != -1 || sc->data[SC_FREEZE].timer != -1) )
return 0;
- if(type == SC_OVERTHRUST && sc_data[SC_MAXOVERTHRUST].timer != -1)
+ if(type == SC_OVERTHRUST && sc->data[SC_MAXOVERTHRUST].timer != -1)
return 0; //Overthrust can't take effect if under Max Overthrust. [Skotlex]
switch(type){
case SC_STONE:
@@ -3756,10 +3673,11 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
}
if(scdef>=100)
return 0;
+
if(sd){
if(type == SC_ADRENALINE && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon)))
return 0;
- if( sd && type == SC_ADRENALINE2 && !(skill_get_weapontype(BS_ADRENALINE2)&(1<<sd->status.weapon)))
+ if(type == SC_ADRENALINE2 && !(skill_get_weapontype(BS_ADRENALINE2)&(1<<sd->status.weapon)))
return 0;
if(SC_COMMON_MIN<=type && type<=SC_COMMON_MAX && !(flag&1)){
@@ -3777,26 +3695,26 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
if (type==SC_BLESSING && (bl->type==BL_PC || (!undead_flag && race!=6))) {
- if (sc_data[SC_CURSE].timer!=-1)
+ if (sc->data[SC_CURSE].timer!=-1)
status_change_end(bl,SC_CURSE,-1);
- if (sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0)
+ if (sc->data[SC_STONE].timer!=-1 && sc->data[SC_STONE].val2==0)
status_change_end(bl,SC_STONE,-1);
}
if((type == SC_ADRENALINE || type==SC_ADRENALINE2 || type == SC_WEAPONPERFECTION || type == SC_OVERTHRUST) &&
- sc_data[type].timer != -1 && sc_data[type].val2 && !val2)
+ sc->data[type].timer != -1 && sc->data[type].val2 && !val2)
return 0;
if(mode & MD_BOSS && !(flag&1) && ( (type>=SC_COMMON_MIN && type <= SC_COMMON_MAX)
- || type==SC_QUAGMIRE || type==SC_DECREASEAGI || type==SC_SIGNUMCRUCIS || type==SC_PROVOKE || type==SC_ROKISWEIL
- || type==SC_COMA
+ || type==SC_QUAGMIRE || type==SC_DECREASEAGI || type==SC_SIGNUMCRUCIS
+ || type==SC_PROVOKE || type==SC_ROKISWEIL || type==SC_COMA
|| (type == SC_BLESSING && (undead_flag || race == 6)))){
/* ボスには?かない(ただしカ?ドによる?果は適用される) */
return 0;
}
- if(sc_data[type].timer != -1){ /* すでに同じ異常になっている場合タイマ解除 */
- if(sc_data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION &&
+ if(sc->data[type].timer != -1){ /* すでに同じ異常になっている場合タイマ解除 */
+ if(sc->data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION &&
type != SC_ASPDPOTION0 && type != SC_ASPDPOTION1 && type != SC_ASPDPOTION2 && type != SC_ASPDPOTION3
&& type != SC_ATKPOTION && type != SC_MATKPOTION // added atk and matk potions [Valaris]
)
@@ -3805,12 +3723,12 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
if ((type >=SC_STAN && type <= SC_BLIND) || type == SC_DPOISON)
return 0;/* ?ぎ足しができない?態異常である時は?態異常を行わない */
- if (type == SC_GOSPEL && sc_data[type].val4 == BCT_SELF) //Must not override a casting gospel char.
+ if (type == SC_GOSPEL && sc->data[type].val4 == BCT_SELF) //Must not override a casting gospel char.
return 0;
- (*sc_count)--;
- delete_timer(sc_data[type].timer, status_change_timer);
- sc_data[type].timer = -1;
+ (sc->count)--;
+ delete_timer(sc->data[type].timer, status_change_timer);
+ sc->data[type].timer = -1;
}
if(type==SC_FREEZE || type==SC_STAN || type==SC_SLEEP || type==SC_STOP || type == SC_CONFUSION ||
@@ -3818,7 +3736,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
battle_stopwalking(bl,1);
// クアグマイア/私を忘れないで中は無効なスキル
- if ((sc_data[SC_QUAGMIRE].timer!=-1 || sc_data[SC_DONTFORGETME].timer!=-1) &&
+ if ((sc->data[SC_QUAGMIRE].timer!=-1 || sc->data[SC_DONTFORGETME].timer!=-1) &&
(type==SC_CONCENTRATE || type==SC_INCREASEAGI ||
type==SC_TWOHANDQUICKEN || type==SC_SPEARSQUICKEN ||
type==SC_ADRENALINE || type==SC_ADRENALINE2 ||
@@ -3842,33 +3760,33 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
if (!(flag&4))
tick = 60*1000;
if (bl->type == BL_PC && sd->status.hp<sd->status.max_hp>>2 &&
- (sc_data[SC_PROVOKE].timer==-1 || sc_data[SC_PROVOKE].val2==0))
+ (sc->data[SC_PROVOKE].timer==-1 || sc->data[SC_PROVOKE].val2==0))
status_change_start(bl,SC_PROVOKE,10,1,0,0,0,0);
}
break;
case SC_INCREASEAGI: /* 速度上昇 */
calc_flag = 1;
- if(sc_data[SC_DECREASEAGI].timer!=-1 )
+ if(sc->data[SC_DECREASEAGI].timer!=-1 )
status_change_end(bl,SC_DECREASEAGI,-1);
break;
case SC_DECREASEAGI: /* 速度減少 */
if (bl->type == BL_PC && !(tick&2)) // Celest
tick>>=1;
calc_flag = 1;
- if(sc_data[SC_INCREASEAGI].timer!=-1 )
+ if(sc->data[SC_INCREASEAGI].timer!=-1 )
status_change_end(bl,SC_INCREASEAGI,-1);
- if(sc_data[SC_ADRENALINE].timer!=-1 )
+ if(sc->data[SC_ADRENALINE].timer!=-1 )
status_change_end(bl,SC_ADRENALINE,-1);
- if(sc_data[SC_ADRENALINE2].timer!=-1 )
+ if(sc->data[SC_ADRENALINE2].timer!=-1 )
status_change_end(bl,SC_ADRENALINE2,-1);
- if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
+ if(sc->data[SC_SPEARSQUICKEN].timer!=-1 )
status_change_end(bl,SC_SPEARSQUICKEN,-1);
- if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
+ if(sc->data[SC_TWOHANDQUICKEN].timer!=-1 )
status_change_end(bl,SC_TWOHANDQUICKEN,-1);
- if(sc_data[SC_CARTBOOST].timer!=-1 )
+ if(sc->data[SC_CARTBOOST].timer!=-1 )
status_change_end(bl,SC_CARTBOOST,-1);
- if(sc_data[SC_ONEHAND].timer!=-1 )
+ if(sc->data[SC_ONEHAND].timer!=-1 )
status_change_end(bl,SC_ONEHAND,-1);
break;
case SC_SIGNUMCRUCIS: /* シグナムクルシス */
@@ -3879,23 +3797,23 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
clif_emotion(bl,4);
break;
case SC_ONEHAND: //Removes the Aspd potion effect, as reported by Vicious. [Skotlex]
- if(sc_data[SC_ASPDPOTION0].timer!=-1)
+ if(sc->data[SC_ASPDPOTION0].timer!=-1)
status_change_end(bl,SC_ASPDPOTION0,-1);
- if(sc_data[SC_ASPDPOTION1].timer!=-1)
+ if(sc->data[SC_ASPDPOTION1].timer!=-1)
status_change_end(bl,SC_ASPDPOTION1,-1);
- if(sc_data[SC_ASPDPOTION2].timer!=-1)
+ if(sc->data[SC_ASPDPOTION2].timer!=-1)
status_change_end(bl,SC_ASPDPOTION2,-1);
- if(sc_data[SC_ASPDPOTION3].timer!=-1)
+ if(sc->data[SC_ASPDPOTION3].timer!=-1)
status_change_end(bl,SC_ASPDPOTION3,-1);
case SC_TWOHANDQUICKEN: /* 2HQ */
- if(sc_data[SC_DECREASEAGI].timer!=-1)
+ if(sc->data[SC_DECREASEAGI].timer!=-1)
return 0;
- *opt3 |= 1;
+ sc->opt3 |= 1;
calc_flag = 1;
break;
case SC_ADRENALINE2:
case SC_ADRENALINE: /* アドレナリンラッシュ */
- if(sc_data[SC_DECREASEAGI].timer!=-1)
+ if(sc->data[SC_DECREASEAGI].timer!=-1)
return 0;
if(bl->type == BL_PC && !(flag&2))
if(pc_checkskill(sd,BS_HILTBINDING)>0)
@@ -3911,10 +3829,10 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
if(bl->type == BL_PC && !(flag&2))
if(pc_checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
- *opt3 |= 2;
+ sc->opt3 |= 2;
break;
case SC_MAXOVERTHRUST: //Cancels Normal Overthrust. [Skotlex]
- if (sc_data[SC_OVERTHRUST].timer != -1)
+ if (sc->data[SC_OVERTHRUST].timer != -1)
status_change_end(bl, SC_OVERTHRUST, -1);
break;
case SC_MAXIMIZEPOWER: /* マキシマイズパワ?(SPが1減る時間,val2にも) */
@@ -3939,7 +3857,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
val2=val1/2 + val1%2; // [Celest]
break;
case SC_ENERGYCOAT: /* エナジ?コ?ト */
- *opt3 |= 4;
+ sc->opt3 |= 4;
break;
case SC_MAGICROD:
val2 = val1*20;
@@ -3951,7 +3869,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
val3 = (val1 / 2 + 5); /* 回? */
}
// -- moonsoul (added to undo assumptio status if target has it)
- if(sc_data[SC_ASSUMPTIO].timer!=-1 )
+ if(sc->data[SC_ASSUMPTIO].timer!=-1 )
status_change_end(bl,SC_ASSUMPTIO,-1);
break;
case SC_MINDBREAKER:
@@ -3964,25 +3882,25 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
break;
case SC_QUAGMIRE: /* クァグマイア */
calc_flag = 1;
- if(sc_data[SC_CONCENTRATE].timer!=-1 ) /* 集中力向上解除 */
+ if(sc->data[SC_CONCENTRATE].timer!=-1 ) /* 集中力向上解除 */
status_change_end(bl,SC_CONCENTRATE,-1);
- if(sc_data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */
+ if(sc->data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */
status_change_end(bl,SC_INCREASEAGI,-1);
- if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
+ if(sc->data[SC_TWOHANDQUICKEN].timer!=-1 )
status_change_end(bl,SC_TWOHANDQUICKEN,-1);
- if(sc_data[SC_ONEHAND].timer!=-1 )
+ if(sc->data[SC_ONEHAND].timer!=-1 )
status_change_end(bl,SC_ONEHAND,-1);
- if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
+ if(sc->data[SC_SPEARSQUICKEN].timer!=-1 )
status_change_end(bl,SC_SPEARSQUICKEN,-1);
- if(sc_data[SC_ADRENALINE].timer!=-1 )
+ if(sc->data[SC_ADRENALINE].timer!=-1 )
status_change_end(bl,SC_ADRENALINE,-1);
- if(sc_data[SC_ADRENALINE2].timer!=-1 )
+ if(sc->data[SC_ADRENALINE2].timer!=-1 )
status_change_end(bl,SC_ADRENALINE2,-1);
- if(sc_data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */
+ if(sc->data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */
status_change_end(bl,SC_TRUESIGHT,-1);
- if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */
+ if(sc->data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */
status_change_end(bl,SC_WINDWALK,-1);
- if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */
+ if(sc->data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */
status_change_end(bl,SC_CARTBOOST,-1);
break;
case SC_MAGICPOWER:
@@ -4038,7 +3956,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
break;
case SC_DELUGE:
calc_flag = 1;
- if (sc_data[SC_FOGWALL].timer != -1 && sc_data[SC_BLIND].timer != -1)
+ if (sc->data[SC_FOGWALL].timer != -1 && sc->data[SC_BLIND].timer != -1)
status_change_end(bl,SC_BLIND,-1);
break;
case SC_VIOLENTGALE:
@@ -4049,12 +3967,12 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
case SC_SPEARSQUICKEN: /* スピアクイッケン */
calc_flag = 1;
val2 = 20+val1;
- *opt3 |= 1;
+ sc->opt3 |= 1;
break;
case SC_BLADESTOP: /* 白刃取り */
if(val2==2) clif_bladestop((struct block_list *)val3,(struct block_list *)val4,1);
- *opt3 |= 32;
+ sc->opt3 |= 32;
break;
case SC_LULLABY: /* 子守唄 */
@@ -4080,25 +3998,25 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
break;
case SC_DONTFORGETME: /* 私を忘れないで */
calc_flag = 1;
- if(sc_data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */
+ if(sc->data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */
status_change_end(bl,SC_INCREASEAGI,-1);
- if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
+ if(sc->data[SC_TWOHANDQUICKEN].timer!=-1 )
status_change_end(bl,SC_TWOHANDQUICKEN,-1);
- if(sc_data[SC_ONEHAND].timer!=-1 )
+ if(sc->data[SC_ONEHAND].timer!=-1 )
status_change_end(bl,SC_ONEHAND,-1);
- if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
+ if(sc->data[SC_SPEARSQUICKEN].timer!=-1 )
status_change_end(bl,SC_SPEARSQUICKEN,-1);
- if(sc_data[SC_ADRENALINE].timer!=-1 )
+ if(sc->data[SC_ADRENALINE].timer!=-1 )
status_change_end(bl,SC_ADRENALINE,-1);
- if(sc_data[SC_ADRENALINE2].timer!=-1 )
+ if(sc->data[SC_ADRENALINE2].timer!=-1 )
status_change_end(bl,SC_ADRENALINE2,-1);
- if(sc_data[SC_ASSNCROS].timer!=-1 )
+ if(sc->data[SC_ASSNCROS].timer!=-1 )
status_change_end(bl,SC_ASSNCROS,-1);
- if(sc_data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */
+ if(sc->data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */
status_change_end(bl,SC_TRUESIGHT,-1);
- if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */
+ if(sc->data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */
status_change_end(bl,SC_WINDWALK,-1);
- if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */
+ if(sc->data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */
status_change_end(bl,SC_CARTBOOST,-1);
break;
case SC_MOONLIT:
@@ -4117,12 +4035,12 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
case SC_EXPLOSIONSPIRITS: // 爆裂波動
calc_flag = 1;
val2 = 75 + 25*val1;
- *opt3 |= 8;
+ sc->opt3 |= 8;
break;
case SC_STEELBODY: // 金剛
case SC_SKA:
calc_flag = 1;
- *opt3 |= 16;
+ sc->opt3 |= 16;
break;
case SC_AUTOCOUNTER:
val3 = val4 = 0;
@@ -4250,8 +4168,8 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
}
break;
case SC_SILENCE: /* 沈?(レックスデビ?ナ) */
- if (sc_data && sc_data[SC_GOSPEL].timer!=-1) {
- if (sc_data[SC_GOSPEL].val4 == BCT_SELF) { //Clear Gospel [Skotlex]
+ if (sc->data[SC_GOSPEL].timer!=-1) {
+ if (sc->data[SC_GOSPEL].val4 == BCT_SELF) { //Clear Gospel [Skotlex]
status_change_end(bl,SC_GOSPEL,-1);
}
break;
@@ -4374,7 +4292,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
break;
case SC_CONCENTRATION: /* コンセントレ?ション */
- *opt3 |= 1;
+ sc->opt3 |= 1;
calc_flag = 1;
break;
@@ -4409,15 +4327,15 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
clif_updatestatus(sd,SP_SP);
sd->canregen_tick = gettick() + 300000;
}
- *opt3 |= 128;
+ sc->opt3 |= 128;
if (!(flag&4))
tick = 10000;
calc_flag = 1;
break;
case SC_ASSUMPTIO: /* アスムプティオ */
- *opt3 |= 2048;
- if(sc_data[SC_KYRIE].timer!=-1)
+ sc->opt3 |= 2048;
+ if(sc->data[SC_KYRIE].timer!=-1)
status_change_end(bl,SC_KYRIE,-1);
break;
@@ -4426,7 +4344,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
val2 = tick/1000;
tick = 1000;
}
- *opt3 |= 4096;
+ sc->opt3 |= 4096;
opt_flag = 1;
break;
@@ -4451,7 +4369,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
return 0;
tick = 1000;
calc_flag = 1;
- *opt3 |= 1024;
+ sc->opt3 |= 1024;
break;
case SC_REJECTSWORD: /* リジェクトソ?ド */
@@ -4491,16 +4409,16 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
case SC_DEVOTION: /* ディボ?ション */
{
struct map_session_data *src;
- if ((src = map_id2sd(val1)) && src->sc_count)
+ if ((src = map_id2sd(val1)) && src->sc.count)
{ //Try to inherit the status from the Crusader [Skotlex]
//Ideally, we should calculate the remaining time and use that, but we'll trust that
//once the Crusader's status changes, it will reflect on the others.
- if (src->sc_data[SC_AUTOGUARD].timer != -1)
- status_change_start(bl,SC_AUTOGUARD,src->sc_data[SC_AUTOGUARD].val1,0,0,0,
- skill_get_time(CR_AUTOGUARD,src->sc_data[SC_AUTOGUARD].val1),0);
- if (src->sc_data[SC_DEFENDER].timer != -1)
- status_change_start(bl,SC_DEFENDER,src->sc_data[SC_DEFENDER].val1,0,0,0,
- skill_get_time(CR_DEFENDER,src->sc_data[SC_DEFENDER].val1),0);
+ if (src->sc.data[SC_AUTOGUARD].timer != -1)
+ status_change_start(bl,SC_AUTOGUARD,src->sc.data[SC_AUTOGUARD].val1,0,0,0,
+ skill_get_time(CR_AUTOGUARD,src->sc.data[SC_AUTOGUARD].val1),0);
+ if (src->sc.data[SC_DEFENDER].timer != -1)
+ status_change_start(bl,SC_DEFENDER,src->sc.data[SC_DEFENDER].val1,0,0,0,
+ skill_get_time(CR_DEFENDER,src->sc.data[SC_DEFENDER].val1),0);
}
break;
}
@@ -4511,7 +4429,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
return 0;
case SC_CARTBOOST: /* カ?トブ?スト */
- if(sc_data[SC_DECREASEAGI].timer!=-1 )
+ if(sc->data[SC_DECREASEAGI].timer!=-1 )
{ //Cancel Decrease Agi, but take no further effect [Skotlex]
status_change_end(bl,SC_DECREASEAGI,-1);
return 0;
@@ -4522,14 +4440,14 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
case SC_CLOSECONFINE2:
{
struct block_list *src = val2?map_id2bl(val2):NULL;
- struct status_change *sc_data2 = src?status_get_sc_data(src):NULL;
- if (src && sc_data2) {
- if (sc_data2[SC_CLOSECONFINE].timer == -1) //Start lock on caster.
+ struct status_change *sc2 = src?status_get_sc(src):NULL;
+ if (src && sc2 && sc2->count) {
+ if (sc2->data[SC_CLOSECONFINE].timer == -1) //Start lock on caster.
status_change_start(src,SC_CLOSECONFINE,1,0,0,0,tick+1000,0);
else { //Increase count of locked enemies and refresh time.
- sc_data2[SC_CLOSECONFINE].val1++;
- delete_timer(sc_data2[SC_CLOSECONFINE].timer, status_change_timer);
- sc_data2[SC_CLOSECONFINE].timer = add_timer(gettick()+tick+1000, status_change_timer, src->id, SC_CLOSECONFINE);
+ sc2->data[SC_CLOSECONFINE].val1++;
+ delete_timer(sc2->data[SC_CLOSECONFINE].timer, status_change_timer);
+ sc2->data[SC_CLOSECONFINE].timer = add_timer(gettick()+tick+1000, status_change_timer, src->id, SC_CLOSECONFINE);
}
}
}
@@ -4577,7 +4495,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
case SC_SWOO: // [marquis007]
if (!(flag&4) && status_get_mode(bl)&MD_BOSS)
tick /= 4; //Reduce skill's duration. But for how long?
-// *opt3 |= 8192; //We haven't figured out this value yet...
+// sc->opt3 |= 8192; //We haven't figured out this value yet...
opt_flag = 1;
calc_flag = 1;
break;
@@ -4713,67 +4631,67 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
{ /* 同時に掛からないステ?タス異常を解除 */
int i;
for(i = SC_STONE; i <= SC_SLEEP; i++){
- if(sc_data[i].timer != -1){
- (*sc_count)--;
- delete_timer(sc_data[i].timer, status_change_timer);
- sc_data[i].timer = -1;
+ if(sc->data[i].timer != -1){
+ (sc->count)--;
+ delete_timer(sc->data[i].timer, status_change_timer);
+ sc->data[i].timer = -1;
}
}
}
if(type == SC_STONE)
- *opt1 = OPT1_STONEWAIT;
+ sc->opt1 = OPT1_STONEWAIT;
else
- *opt1 = OPT1_STONE + (type - SC_STONE);
+ sc->opt1 = OPT1_STONE + (type - SC_STONE);
opt_flag = 1;
break;
case SC_POISON:
case SC_CURSE:
case SC_SILENCE:
case SC_BLIND:
- *opt2 |= 1<<(type-SC_POISON);
+ sc->opt2 |= 1<<(type-SC_POISON);
opt_flag = 1;
break;
case SC_DPOISON: // 暫定で毒のエフェクトを使用
- *opt2 |= OPT2_DPOISON;
+ sc->opt2 |= OPT2_DPOISON;
opt_flag = 1;
break;
case SC_SIGNUMCRUCIS:
- *opt2 |= OPT2_SIGNUMCRUCIS;
+ sc->opt2 |= OPT2_SIGNUMCRUCIS;
opt_flag = 1;
break;
case SC_HIDING:
case SC_CLOAKING:
battle_stopattack(bl); /* 攻?停止 */
- *option |= ((type==SC_HIDING)?OPTION_HIDE:OPTION_CLOAK);
+ sc->option |= ((type==SC_HIDING)?OPTION_HIDE:OPTION_CLOAK);
opt_flag =1 ;
break;
case SC_CHASEWALK:
battle_stopattack(bl); /* 攻?停止 */
- *option |= OPTION_CHASEWALK|OPTION_CLOAK;
+ sc->option |= OPTION_CHASEWALK|OPTION_CLOAK;
opt_flag =1 ;
break;
case SC_SIGHT:
- *option |= OPTION_SIGHT;
+ sc->option |= OPTION_SIGHT;
opt_flag = 1;
break;
case SC_RUWACH:
- *option |= OPTION_RUWACH;
+ sc->option |= OPTION_RUWACH;
opt_flag = 1;
break;
case SC_WEDDING:
- *option |= OPTION_WEDDING;
+ sc->option |= OPTION_WEDDING;
opt_flag = 1;
break;
case SC_ORCISH:
- *option |= OPTION_ORCISH;
+ sc->option |= OPTION_ORCISH;
opt_flag = 1;
break;
case SC_SIGHTTRASHER:
- *option |= OPTION_SIGHTTRASHER;
+ sc->option |= OPTION_SIGHTTRASHER;
opt_flag = 1;
break;
case SC_FUSION:
- *option |= OPTION_FLYING;
+ sc->option |= OPTION_FLYING;
opt_flag = 1;
break;
}
@@ -4781,14 +4699,14 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
if(opt_flag) /* optionの?更 */
clif_changeoption(bl);
- (*sc_count)++; /* ステ?タス異常の? */
+ (sc->count)++; /* ステ?タス異常の? */
- sc_data[type].val1 = val1;
- sc_data[type].val2 = val2;
- sc_data[type].val3 = val3;
- sc_data[type].val4 = val4;
+ sc->data[type].val1 = val1;
+ sc->data[type].val2 = val2;
+ sc->data[type].val3 = val3;
+ sc->data[type].val4 = val4;
/* タイマ?設定 */
- sc_data[type].timer = add_timer(
+ sc->data[type].timer = add_timer(
gettick() + tick, status_change_timer, bl->id, type);
if(bl->type==BL_PC && calc_flag)
@@ -4814,43 +4732,34 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val
*/
int status_change_clear(struct block_list *bl,int type)
{
- struct status_change* sc_data;
- short *sc_count, *option, *opt1, *opt2, *opt3;
+ struct status_change* sc;
int i;
- nullpo_retr(0, bl);
- nullpo_retr(0, sc_data = status_get_sc_data(bl));
- nullpo_retr(0, sc_count = status_get_sc_count(bl));
- nullpo_retr(0, option = status_get_option(bl));
- nullpo_retr(0, opt1 = status_get_opt1(bl));
- nullpo_retr(0, opt2 = status_get_opt2(bl));
- nullpo_retr(0, opt3 = status_get_opt3(bl));
-
- if (*sc_count == 0)
+ nullpo_retr(0, sc = status_get_sc(bl));
+
+ if (sc->count == 0)
return 0;
for(i = 0; i < SC_MAX; i++)
{
//Type 0: PC killed -> EDP and Meltdown must not be dispelled. [Skotlex]
// Do not reset Xmas status when killed. [Valaris]
- if(sc_data[i].timer == -1 ||
+ if(sc->data[i].timer == -1 ||
(type == 0 && (i == SC_EDP || i == SC_MELTDOWN || i == SC_XMAS)))
continue;
status_change_end(bl, i, -1);
- if (type == 1 && sc_data[i].timer != -1)
+ if (type == 1 && sc->data[i].timer != -1)
{ //If for some reason status_change_end decides to still keep the status when quitting. [Skotlex]
- (*sc_count)--;
- delete_timer(sc_data[i].timer, status_change_timer);
- sc_data[i].timer = -1;
+ (sc->count)--;
+ delete_timer(sc->data[i].timer, status_change_timer);
+ sc->data[i].timer = -1;
}
}
- //We can't assume the count is 0, some status don't end even when dead! [Skotlex]
- //(*sc_count) = 0;
- *opt1 = 0;
- *opt2 = 0;
- *opt3 = 0;
- *option &= OPTION_MASK;
+ sc->opt1 = 0;
+ sc->opt2 = 0;
+ sc->opt3 = 0;
+ sc->option &= OPTION_MASK;
if(!type || type&2)
clif_changeoption(bl);
@@ -4865,14 +4774,15 @@ int status_change_clear(struct block_list *bl,int type)
int status_change_end( struct block_list* bl , int type,int tid )
{
struct map_session_data *sd;
- struct status_change* sc_data;
+ struct status_change *sc;
int opt_flag=0, calc_flag = 0;
- short *sc_count, *option, *opt1, *opt2, *opt3;
nullpo_retr(0, bl);
- if(bl->type!=BL_PC && bl->type!=BL_MOB) {
+
+ sc = status_get_sc(bl);
+ if(!sc) {
if(battle_config.error_log)
- ShowError("status_change_end: neither MOB nor PC !\n");
+ ShowError("status_change_end: BL type %d doesn't has sc data!\n", bl->type);
return 0;
}
@@ -4880,22 +4790,15 @@ int status_change_end( struct block_list* bl , int type,int tid )
return 0;
sd = bl->type==BL_PC?(struct map_session_data *)bl:NULL;
-
- sc_data = status_get_sc_data(bl);
- sc_count = status_get_sc_count(bl);
- option = status_get_option(bl);
- opt1 = status_get_opt1(bl);
- opt2 = status_get_opt2(bl);
- opt3 = status_get_opt3(bl);
- if (sc_data[type].timer != -1 && (sc_data[type].timer == tid || tid == -1)) {
+ if (sc->data[type].timer != -1 && (sc->data[type].timer == tid || tid == -1)) {
if (tid == -1) // タイマから呼ばれていないならタイマ削除をする
- delete_timer(sc_data[type].timer,status_change_timer);
+ delete_timer(sc->data[type].timer,status_change_timer);
/* 該?の異常を正常に?す */
- sc_data[type].timer=-1;
- (*sc_count)--;
+ sc->data[type].timer=-1;
+ (sc->count)--;
switch(type){ /* 異常の種類ごとの?理 */
case SC_PROVOKE: /* プロボック */
@@ -5016,15 +4919,15 @@ int status_change_end( struct block_list* bl , int type,int tid )
case SC_RUN://駆け足
if (sd && sd->walktimer != -1)
pc_stop_walking(sd,1);
- if (sc_data[type].val1 >= 7 &&
- DIFF_TICK(gettick(), sc_data[type].val4) <= 1000 &&
+ if (sc->data[type].val1 >= 7 &&
+ DIFF_TICK(gettick(), sc->data[type].val4) <= 1000 &&
(!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0))
)
- status_change_start(bl,SC_SPURT,sc_data[type].val1,0,0,0,skill_get_time2(TK_RUN, sc_data[type].val1),0);
+ status_change_start(bl,SC_SPURT,sc->data[type].val1,0,0,0,skill_get_time2(TK_RUN, sc->data[type].val1),0);
calc_flag = 1;
break;
case SC_AUTOBERSERK:
- if (sc_data[SC_PROVOKE].timer != -1 && sc_data[SC_PROVOKE].val2 == 1)
+ if (sc->data[SC_PROVOKE].timer != -1 && sc->data[SC_PROVOKE].val2 == 1)
status_change_end(bl,SC_PROVOKE,-1);
break;
@@ -5036,60 +4939,60 @@ int status_change_end( struct block_list* bl , int type,int tid )
int i;
for (i = 0; i < 5; i++)
{ //Clear the status from the others too [Skotlex]
- if (sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) && tsd->sc_data[type].timer != -1)
+ if (sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) && tsd->sc.data[type].timer != -1)
status_change_end(&tsd->bl,type,-1);
}
}
break;
case SC_DEVOTION: /* ディボ?ション */
{
- struct map_session_data *md = map_id2sd(sc_data[type].val1);
+ struct map_session_data *md = map_id2sd(sc->data[type].val1);
//The status could have changed because the Crusader left the game. [Skotlex]
if (md)
{
- md->devotion[sc_data[type].val2] = 0;
+ md->devotion[sc->data[type].val2] = 0;
clif_devotion(md);
}
//Remove AutoGuard and Defender [Skotlex]
- if (sc_data[SC_AUTOGUARD].timer != -1)
+ if (sc->data[SC_AUTOGUARD].timer != -1)
status_change_end(bl,SC_AUTOGUARD,-1);
- if (sc_data[SC_DEFENDER].timer != -1)
+ if (sc->data[SC_DEFENDER].timer != -1)
status_change_end(bl,SC_DEFENDER,-1);
}
break;
case SC_BLADESTOP:
{
- struct status_change *t_sc_data = status_get_sc_data((struct block_list *)sc_data[type].val4);
+ struct status_change *tsc = status_get_sc((struct block_list *)sc->data[type].val4);
//片方が切れたので相手の白刃?態が切れてないのなら解除
- if(t_sc_data && t_sc_data[SC_BLADESTOP].timer!=-1)
- status_change_end((struct block_list *)sc_data[type].val4,SC_BLADESTOP,-1);
+ if(tsc && tsc->data[SC_BLADESTOP].timer!=-1)
+ status_change_end((struct block_list *)sc->data[type].val4,SC_BLADESTOP,-1);
- if(sc_data[type].val2==2)
- clif_bladestop((struct block_list *)sc_data[type].val3,(struct block_list *)sc_data[type].val4,0);
+ if(sc->data[type].val2==2)
+ clif_bladestop((struct block_list *)sc->data[type].val3,(struct block_list *)sc->data[type].val4,0);
}
break;
case SC_DANCING:
{
struct map_session_data *dsd;
- struct status_change *d_sc_data;
- if(sc_data[type].val2)
+ struct status_change *dsc;
+ if(sc->data[type].val2)
{
- skill_delunitgroup((struct skill_unit_group *)sc_data[type].val2);
- sc_data[type].val2 = 0;
+ skill_delunitgroup((struct skill_unit_group *)sc->data[type].val2);
+ sc->data[type].val2 = 0;
}
- if(sc_data[type].val4 && sc_data[type].val4 != BCT_SELF && (dsd=map_id2sd(sc_data[type].val4))){
- d_sc_data = dsd->sc_data;
+ if(sc->data[type].val4 && sc->data[type].val4 != BCT_SELF && (dsd=map_id2sd(sc->data[type].val4))){
+ dsc = &dsd->sc;
//合奏で相手がいる場合相手のval4を0にする
- if(d_sc_data && d_sc_data[type].timer!=-1)
+ if(dsc && dsc->data[type].timer!=-1)
{
- d_sc_data[type].val2 = d_sc_data[type].val4 = 0; //This will prevent recursive loops.
+ dsc->data[type].val2 = dsc->data[type].val4 = 0; //This will prevent recursive loops.
status_change_end(&dsd->bl, type, -1);
}
}
- if(sc_data[type].val1 == CG_MOONLIT) //Only dance that doesn't has ground tiles... [Skotlex]
+ if(sc->data[type].val1 == CG_MOONLIT) //Only dance that doesn't has ground tiles... [Skotlex]
status_change_end(bl, SC_MOONLIT, -1);
}
- if (sc_data[SC_LONGING].timer!=-1)
+ if (sc->data[SC_LONGING].timer!=-1)
status_change_end(bl,SC_LONGING,-1);
calc_flag = 1;
break;
@@ -5104,36 +5007,36 @@ int status_change_end( struct block_list* bl , int type,int tid )
break;
case SC_SPLASHER: /* ベナムスプラッシャ? */
{
- struct block_list *src=map_id2bl(sc_data[type].val3);
+ struct block_list *src=map_id2bl(sc->data[type].val3);
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,sc->data[type].val2,sc->data[type].val1,gettick(),0 );
}
}
break;
case SC_CLOSECONFINE2:
{
- struct block_list *src = sc_data[type].val2?map_id2bl(sc_data[type].val2):NULL;
- struct status_change *sc_data2 = src?status_get_sc_data(src):NULL;
- if (src && sc_data2) {
- if (sc_data2[SC_CLOSECONFINE].timer != -1) //If status was already ended, do nothing.
+ struct block_list *src = sc->data[type].val2?map_id2bl(sc->data[type].val2):NULL;
+ struct status_change *sc2 = src?status_get_sc(src):NULL;
+ if (src && sc2 && sc2->count) {
+ if (sc2->data[SC_CLOSECONFINE].timer != -1) //If status was already ended, do nothing.
{ //Decrease count
- if (--sc_data2[SC_CLOSECONFINE].val1 <= 0) //No more holds, free him up.
+ if (--sc2->data[SC_CLOSECONFINE].val1 <= 0) //No more holds, free him up.
status_change_end(src, SC_CLOSECONFINE, -1);
}
}
}
break;
case SC_CLOSECONFINE:
- if (sc_data[type].val1 > 0) { //Caster has been unlocked... nearby chars need to be unlocked.
+ if (sc->data[type].val1 > 0) { //Caster has been unlocked... nearby chars need to be unlocked.
int range = 2*skill_get_range2(bl, RG_CLOSECONFINE, 1);
map_foreachinarea(status_change_timer_sub,
- bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,type,gettick());
+ bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sc,type,gettick());
}
break;
/* option1 */
case SC_FREEZE:
- sc_data[type].val3 = 0;
+ sc->data[type].val3 = 0;
break;
/* option2 */
@@ -5148,12 +5051,10 @@ int status_change_end( struct block_list* bl , int type,int tid )
{
// check for partner and end their marionette status as well
int type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE;
- struct block_list *pbl = map_id2bl(sc_data[type].val3);
- if (pbl) {
- struct status_change* sc_data;
- if ((sc_data = status_get_sc_data(pbl)) && sc_data[type2].timer != -1)
+ struct block_list *pbl = map_id2bl(sc->data[type].val3);
+ struct status_change* sc2 = pbl?status_get_sc(pbl):NULL;
+ if (pbl && sc2 && sc2->count && sc2->data[type2].timer != -1)
status_change_end(pbl, type2, -1);
- }
if (type == SC_MARIONETTE)
clif_marionette(bl, 0);
calc_flag = 1;
@@ -5161,7 +5062,7 @@ int status_change_end( struct block_list* bl , int type,int tid )
break;
case SC_BERSERK: //val4 indicates if the skill was dispelled. [Skotlex]
- if (sd && sd->status.hp > 100 && !sc_data[type].val4) {
+ if (sd && sd->status.hp > 100 && !sc->data[type].val4) {
sd->status.hp = 100;
clif_updatestatus(sd,SP_HP);
}
@@ -5170,7 +5071,7 @@ int status_change_end( struct block_list* bl , int type,int tid )
case SC_GRAVITATION:
if (sd) {
- if (sc_data[type].val3 == BCT_SELF) {
+ if (sc->data[type].val3 == BCT_SELF) {
unsigned int tick = gettick();
sd->canmove_tick = tick;
sd->canact_tick = tick;
@@ -5179,21 +5080,21 @@ int status_change_end( struct block_list* bl , int type,int tid )
break;
case SC_GOSPEL: //Clear the buffs from other chars.
- if(sc_data[type].val4 != BCT_SELF)
+ if(sc->data[type].val4 != BCT_SELF)
calc_flag = 1;
- else if (sc_data[type].val3) { //Clear the group.
- struct skill_unit_group *group = (struct skill_unit_group *)sc_data[type].val3;
- sc_data[type].val3 = 0;
+ else if (sc->data[type].val3) { //Clear the group.
+ struct skill_unit_group *group = (struct skill_unit_group *)sc->data[type].val3;
+ sc->data[type].val3 = 0;
skill_delunitgroup(group);
}
break;
case SC_HERMODE:
case SC_BASILICA: //Clear the skill area. [Skotlex]
- if(sc_data[type].val3 == BCT_SELF)
+ if(sc->data[type].val3 == BCT_SELF)
skill_clear_unitgroup(bl);
break;
case SC_MOONLIT: //Clear the unit effect. [Skotlex]
- skill_setmapcell(bl,CG_MOONLIT, sc_data[SC_MOONLIT].val1, CELL_CLRMOONLIT);
+ skill_setmapcell(bl,CG_MOONLIT, sc->data[SC_MOONLIT].val1, CELL_CLRMOONLIT);
break;
}
@@ -5206,7 +5107,7 @@ int status_change_end( struct block_list* bl , int type,int tid )
case SC_FREEZE:
case SC_STAN:
case SC_SLEEP:
- *opt1 = 0;
+ sc->opt1 = 0;
opt_flag = 1;
break;
@@ -5214,53 +5115,53 @@ int status_change_end( struct block_list* bl , int type,int tid )
case SC_CURSE:
case SC_SILENCE:
case SC_BLIND:
- *opt2 &= ~(1<<(type-SC_POISON));
+ sc->opt2 &= ~(1<<(type-SC_POISON));
opt_flag = 1;
break;
case SC_DPOISON:
- *opt2 &= ~OPT2_DPOISON; // 毒?態解除
+ sc->opt2 &= ~OPT2_DPOISON; // 毒?態解除
opt_flag = 1;
break;
case SC_SIGNUMCRUCIS:
- *opt2 &= ~OPT2_SIGNUMCRUCIS;
+ sc->opt2 &= ~OPT2_SIGNUMCRUCIS;
opt_flag = 1;
break;
case SC_HIDING:
- *option &= ~OPTION_HIDE;
+ sc->option &= ~OPTION_HIDE;
opt_flag = 1 ;
break;
case SC_CLOAKING:
- *option &= ~OPTION_CLOAK;
+ sc->option &= ~OPTION_CLOAK;
calc_flag = 1; // orn
opt_flag = 1 ;
break;
case SC_CHASEWALK:
- *option &= ~(OPTION_CHASEWALK|OPTION_CLOAK);
+ sc->option &= ~(OPTION_CHASEWALK|OPTION_CLOAK);
opt_flag = 1 ;
break;
case SC_SIGHT:
- *option &= ~OPTION_SIGHT;
+ sc->option &= ~OPTION_SIGHT;
opt_flag = 1;
break;
case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか)
- *option &= ~OPTION_WEDDING;
+ sc->option &= ~OPTION_WEDDING;
opt_flag = 1;
break;
case SC_ORCISH:
- *option &= ~OPTION_ORCISH;
+ sc->option &= ~OPTION_ORCISH;
opt_flag = 1;
break;
case SC_RUWACH:
- *option &= ~OPTION_RUWACH;
+ sc->option &= ~OPTION_RUWACH;
opt_flag = 1;
break;
case SC_SIGHTTRASHER:
- *option &= ~OPTION_SIGHTTRASHER;
+ sc->option &= ~OPTION_SIGHTTRASHER;
opt_flag = 1;
break;
case SC_FUSION:
- *option &= ~OPTION_FLYING;
+ sc->option &= ~OPTION_FLYING;
opt_flag = 1;
break;
//opt3
@@ -5268,37 +5169,36 @@ int status_change_end( struct block_list* bl , int type,int tid )
case SC_ONEHAND: /* 1HQ */
case SC_SPEARSQUICKEN: /* スピアクイッケン */
case SC_CONCENTRATION: /* コンセントレ?ション */
- *opt3 &= ~1;
+ sc->opt3 &= ~1;
break;
case SC_OVERTHRUST: /* オ?バ?スラスト */
- *opt3 &= ~2;
+ sc->opt3 &= ~2;
break;
case SC_ENERGYCOAT: /* エナジ?コ?ト */
- *opt3 &= ~4;
+ sc->opt3 &= ~4;
break;
case SC_EXPLOSIONSPIRITS: // 爆裂波動
- *opt3 &= ~8;
+ sc->opt3 &= ~8;
break;
case SC_STEELBODY: // 金剛
case SC_SKA:
- *opt3 &= ~16;
+ sc->opt3 &= ~16;
break;
case SC_BLADESTOP: /* 白刃取り */
- *opt3 &= ~32;
+ sc->opt3 &= ~32;
break;
case SC_BERSERK: /* バ?サ?ク */
- *opt3 &= ~128;
+ sc->opt3 &= ~128;
break;
case SC_MARIONETTE: /* マリオネットコントロ?ル */
case SC_MARIONETTE2:
- *opt3 &= ~1024;
+ sc->opt3 &= ~1024;
break;
case SC_ASSUMPTIO: /* アスムプティオ */
- *opt3 &= ~2048;
+ sc->opt3 &= ~2048;
break;
case SC_WARM: //SG skills [Komurka]
- *opt3 &= ~4096;
- opt_flag = 1;
+ sc->opt3 &= ~4096;
break;
}
@@ -5322,8 +5222,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
int type = data;
struct block_list *bl;
struct map_session_data *sd=NULL;
- struct status_change *sc_data;
- //short *sc_count; //使ってない?
+ struct status_change *sc;
// security system to prevent forgetting timer removal
int temp_timerid;
@@ -5332,23 +5231,21 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
#ifndef _WIN32
nullpo_retr_f(0, bl, "id=%d data=%d",id,data);
#endif
- nullpo_retr(0, sc_data=status_get_sc_data(bl));
+ nullpo_retr(0, sc=status_get_sc(bl));
if(bl->type==BL_PC)
- nullpo_retr(0, sd=(struct map_session_data *)bl);
+ sd=(struct map_session_data *)bl;
- //sc_count=status_get_sc_count(bl); //使ってない?
-
- if(sc_data[type].timer != tid) {
+ if(sc->data[type].timer != tid) {
if(battle_config.error_log)
- ShowError("status_change_timer %d != %d\n",tid,sc_data[type].timer);
+ ShowError("status_change_timer %d != %d\n",tid,sc->data[type].timer);
return 0;
}
// security system to prevent forgetting timer removal
// you shouldn't be that careless inside the switch here
- temp_timerid = sc_data[type].timer;
- sc_data[type].timer = -1;
+ temp_timerid = sc->data[type].timer;
+ sc->data[type].timer = -1;
switch(type){ /* 特殊な?理になる場合 */
case SC_MAXIMIZEPOWER: /* マキシマイズパワ? */
@@ -5360,26 +5257,26 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
sd->status.sp--;
clif_updatestatus(sd,SP_SP);
}
- sc_data[type].timer=add_timer( /* タイマ?再設定 */
- sc_data[type].val2+tick, status_change_timer, bl->id, data);
+ sc->data[type].timer=add_timer( /* タイマ?再設定 */
+ sc->data[type].val2+tick, status_change_timer, bl->id, data);
return 0;
}
break;
case SC_CHASEWALK:
if(sd){
- int sp = 10+sc_data[SC_CHASEWALK].val1*2;
+ int sp = 10+sc->data[SC_CHASEWALK].val1*2;
if (map_flag_gvg(sd->bl.m)) sp *= 5;
if (sd->status.sp > sp){
sd->status.sp -= sp; // update sp cost [Celest]
clif_updatestatus(sd,SP_SP);
- if ((++sc_data[SC_CHASEWALK].val4) == 1) {
- status_change_start(bl, SC_INCSTR, 1<<(sc_data[SC_CHASEWALK].val1-1), 0, 0, 0,
- (sc_data[SC_SPIRIT].timer != -1 && sc_data[SC_SPIRIT].val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration
- *skill_get_time2(ST_CHASEWALK,sc_data[SC_CHASEWALK].val1), 0);
+ if ((++sc->data[SC_CHASEWALK].val4) == 1) {
+ status_change_start(bl, SC_INCSTR, 1<<(sc->data[SC_CHASEWALK].val1-1), 0, 0, 0,
+ (sc->data[SC_SPIRIT].timer != -1 && sc->data[SC_SPIRIT].val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration
+ *skill_get_time2(ST_CHASEWALK,sc->data[SC_CHASEWALK].val1), 0);
}
- sc_data[type].timer = add_timer( /* タイマ?再設定 */
- sc_data[type].val2+tick, status_change_timer, bl->id, data);
+ sc->data[type].timer = add_timer( /* タイマ?再設定 */
+ sc->data[type].val2+tick, status_change_timer, bl->id, data);
return 0;
}
}
@@ -5387,12 +5284,12 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_HIDING: /* ハイディング */
if(sd){ /* SPがあって、時間制限の間は持? */
- if( sd->status.sp > 0 && (--sc_data[type].val2)>0 ){
- if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){
+ if( sd->status.sp > 0 && (--sc->data[type].val2)>0 ){
+ if(sc->data[type].val2 % (sc->data[type].val1+3) ==0 ){
sd->status.sp--;
clif_updatestatus(sd,SP_SP);
}
- sc_data[type].timer=add_timer( /* タイマ?再設定 */
+ sc->data[type].timer=add_timer( /* タイマ?再設定 */
1000+tick, status_change_timer,
bl->id, data);
return 0;
@@ -5404,13 +5301,13 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_RUWACH: /* ルアフ */
case SC_SIGHTBLASTER:
{
- int range = skill_get_range2(bl, type==SC_SIGHT?MG_SIGHT:(type==SC_RUWACH?AL_RUWACH:WZ_SIGHTBLASTER), sc_data[type].val1);
+ int range = skill_get_range2(bl, type==SC_SIGHT?MG_SIGHT:(type==SC_RUWACH?AL_RUWACH:WZ_SIGHTBLASTER), sc->data[type].val1);
map_foreachinarea( status_change_timer_sub,
bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,
- bl,type,tick);
+ bl,sc,type,tick);
- if( (--sc_data[type].val2)>0 ){
- sc_data[type].timer=add_timer( /* タイマ?再設定 */
+ if( (--sc->data[type].val2)>0 ){
+ sc->data[type].timer=add_timer( /* タイマ?再設定 */
250+tick, status_change_timer,
bl->id, data);
return 0;
@@ -5422,58 +5319,51 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
{
int race = status_get_race(bl);
if(race == 6 || battle_check_undead(race,status_get_elem_type(bl))) {
- sc_data[type].timer=add_timer(1000*600+tick,status_change_timer, bl->id, data );
+ sc->data[type].timer=add_timer(1000*600+tick,status_change_timer, bl->id, data );
return 0;
}
}
break;
case SC_WARM: //SG skills [Komurka]
- if( (--sc_data[type].val2)>0){
+ if( (--sc->data[type].val2)>0){
map_foreachinarea( status_change_timer_sub,
- bl->m, bl->x-sc_data[type].val4, bl->y-sc_data[type].val4, bl->x+sc_data[type].val4,bl->y+sc_data[type].val4,BL_CHAR,
- bl,type,tick);
- sc_data[type].timer=add_timer(tick+1000, status_change_timer,bl->id, data);
+ bl->m, bl->x-sc->data[type].val4, bl->y-sc->data[type].val4, bl->x+sc->data[type].val4,bl->y+sc->data[type].val4,BL_CHAR,
+ bl,sc,type,tick);
+ sc->data[type].timer=add_timer(tick+1000, status_change_timer,bl->id, data);
return 0;
}
break;
case SC_PROVOKE: /* プロボック/オ?トバ?サ?ク */
- if(sc_data[type].val2!=0){ /* オ?トバ?サ?ク(1秒ごとにHPチェック) */
+ if(sc->data[type].val2!=0){ /* オ?トバ?サ?ク(1秒ごとにHPチェック) */
if(sd && sd->status.hp>sd->status.max_hp>>2) /* 停止 */
break;
- sc_data[type].timer=add_timer( 1000+tick,status_change_timer, bl->id, data );
+ sc->data[type].timer=add_timer( 1000+tick,status_change_timer, bl->id, data );
return 0;
}
break;
- case SC_AUTOBERSERK: //Auto Berserk continues until triggered off manually. [Skotlex]
- sc_data[type].timer=add_timer( 1000*60+tick,status_change_timer, bl->id, data );
- return 0;
-
case SC_ENDURE: /* インデュア */
if(sd && sd->special_state.infinite_endure) {
- sc_data[type].timer=add_timer( 1000*60+tick,status_change_timer, bl->id, data );
+ sc->data[type].timer=add_timer( 1000*60+tick,status_change_timer, bl->id, data );
return 0;
}
break;
case SC_STONE:
- if(sc_data[type].val2 != 0) {
- short *opt1 = status_get_opt1(bl);
- sc_data[type].val2 = 0;
- sc_data[type].val4 = 0;
+ if(sc->data[type].val2 != 0) {
+ sc->data[type].val2 = 0;
+ sc->data[type].val4 = 0;
battle_stopwalking(bl,1);
- if(opt1) {
- *opt1 = OPT1_STONE;
- clif_changeoption(bl);
- }
- sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+ sc->opt1 = OPT1_STONE;
+ clif_changeoption(bl);
+ sc->data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
return 0;
}
- else if( (--sc_data[type].val3) > 0) {
+ else if( (--sc->data[type].val3) > 0) {
int hp = status_get_max_hp(bl);
- if((++sc_data[type].val4)%5 == 0 && status_get_hp(bl) > hp>>2) {
+ if((++sc->data[type].val4)%5 == 0 && status_get_hp(bl) > hp>>2) {
hp = hp/100;
if(hp < 1) hp = 1;
if(sd)
@@ -5485,7 +5375,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
md->hp -= hp;
}
}
- sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+ sc->data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
return 0;
}
break;
@@ -5494,19 +5384,19 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
if (status_get_hp(bl) <= status_get_max_hp(bl)>>2) //Stop damaging after 25% HP left.
break;
case SC_DPOISON:
- if ((--sc_data[type].val3) > 0 && sc_data[SC_SLOWPOISON].timer == -1) {
+ if ((--sc->data[type].val3) > 0 && sc->data[SC_SLOWPOISON].timer == -1) {
if(sd) {
- pc_heal(sd, -sc_data[type].val4, 0);
+ pc_heal(sd, -sc->data[type].val4, 0);
} else if (bl->type == BL_MOB) {
- ((struct mob_data*)bl)->hp -= sc_data[type].val4;
+ ((struct mob_data*)bl)->hp -= sc->data[type].val4;
if (battle_config.show_mob_hp)
clif_charnameack (0, bl);
} else
- battle_heal(NULL, bl, -sc_data[type].val4, 0, 1);
+ battle_heal(NULL, bl, -sc->data[type].val4, 0, 1);
}
- if (sc_data[type].val3 > 0 && !status_isdead(bl))
+ if (sc->data[type].val3 > 0 && !status_isdead(bl))
{
- sc_data[type].timer = add_timer (1000 + tick, status_change_timer, bl->id, data );
+ sc->data[type].timer = add_timer (1000 + tick, status_change_timer, bl->id, data );
return 0;
}
break;
@@ -5514,7 +5404,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_TENSIONRELAX: /* テンションリラックス */
if(sd){ /* SPがあって、HPが?タンでなければ?? */
if( sd->status.sp > 12 && sd->status.max_hp > sd->status.hp ){
- sc_data[type].timer=add_timer( /* タイマ?再設定 */
+ sc->data[type].timer=add_timer( /* タイマ?再設定 */
10000+tick, status_change_timer,
bl->id, data);
return 0;
@@ -5532,7 +5422,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
// - 10ゥェエェネェヒHPェャハ盒
// - ェホェ゙ェ゙ォオ?ォミケヤムェ茘ォォーェキェニェ?ヘェマ眈ェィェハェ、
// To-do: bleeding effect increases damage taken?
- if ((sc_data[type].val4 -= 10000) >= 0) {
+ if ((sc->data[type].val4 -= 10000) >= 0) {
int hp = rand()%300 + 400;
if(sd) {
pc_heal(sd,-hp,0);
@@ -5544,7 +5434,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
// walking and casting effect is lost
battle_stopwalking (bl, 1);
skill_castcancel (bl, 0);
- sc_data[type].timer = add_timer(10000 + tick, status_change_timer, bl->id, data );
+ sc->data[type].timer = add_timer(10000 + tick, status_change_timer, bl->id, data );
}
return 0;
}
@@ -5567,15 +5457,16 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_READYCOUNTER:
case SC_RUN:
case SC_DODGE:
- sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data );
+ case SC_AUTOBERSERK: //continues until triggered off manually. [Skotlex]
+ sc->data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data );
return 0;
case SC_DANCING: //ダンススキルの時間SP消費
{
int s = 0;
int sp = 1;
- if(sd && (--sc_data[type].val3) > 0) {
- switch(sc_data[type].val1){
+ if(sd && (--sc->data[type].val3) > 0) {
+ switch(sc->data[type].val1){
case BD_RICHMANKIM: /* ニヨルドの宴 3秒にSP1 */
case BD_DRUMBATTLEFIELD: /* ?太鼓の響き 3秒にSP1 */
case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 3秒にSP1 */
@@ -5604,14 +5495,14 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
s=6;
break;
case CG_MOONLIT: /* 月明りの泉に落ちる花びら 10秒でSP1? */
- sp= 4*sc_data[type].val2; //Moonlit's cost is 4sp*skill_lv [Skotlex]
+ sp= 4*sc->data[type].val2; //Moonlit's cost is 4sp*skill_lv [Skotlex]
//Upkeep is also every 10 secs.
case DC_DONTFORGETME: /* 私を忘れないで… 10秒でSP1 */
s=10;
break;
}
- if (s && ((sc_data[type].val3 % s) == 0)) {
- if (sc_data[SC_LONGING].timer != -1)
+ if (s && ((sc->data[type].val3 % s) == 0)) {
+ if (sc->data[SC_LONGING].timer != -1)
sp = s;
if (sp > sd->status.sp)
sp = sd->status.sp;
@@ -5620,7 +5511,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
if (sd->status.sp <= 0)
break;
}
- sc_data[type].timer=add_timer( /* タイマ?再設定 */
+ sc->data[type].timer=add_timer( /* タイマ?再設定 */
1000+tick, status_change_timer,
bl->id, data);
return 0;
@@ -5631,10 +5522,10 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_DEVOTION:
{ //Check range and timeleft to preserve status [Skotlex]
//This implementation won't work for mobs because of map_id2sd, but it's a small cost in exchange of the speed of map_id2sd over map_id2sd
- struct map_session_data *md = map_id2sd(sc_data[type].val1);
- if (md && battle_check_range(bl, &md->bl, sc_data[type].val3) && (sc_data[type].val4-=1000)>0)
+ struct map_session_data *md = map_id2sd(sc->data[type].val1);
+ if (md && battle_check_range(bl, &md->bl, sc->data[type].val3) && (sc->data[type].val4-=1000)>0)
{
- sc_data[type].timer = add_timer(1000+tick, status_change_timer, bl->id, data);
+ sc->data[type].timer = add_timer(1000+tick, status_change_timer, bl->id, data);
return 0;
}
}
@@ -5645,7 +5536,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
if( (sd->status.hp - sd->status.max_hp*5/100) > 100 ){ // 5% every 10 seconds [DracoRPG]
sd->status.hp -= sd->status.max_hp*5/100; // changed to max hp [celest]
clif_updatestatus(sd,SP_HP);
- sc_data[type].timer = add_timer( /* タイマ?再設定 */
+ sc->data[type].timer = add_timer( /* タイマ?再設定 */
10000+tick, status_change_timer,
bl->id, data);
return 0;
@@ -5660,20 +5551,20 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
clif_updatestatus(sd,SP_MANNER);
if (sd->status.manner < 0)
{ //Every 60 seconds your manner goes up by 1 until it gets back to 0.
- sc_data[type].timer=add_timer(60000+tick, status_change_timer, bl->id, data);
+ sc->data[type].timer=add_timer(60000+tick, status_change_timer, bl->id, data);
return 0;
}
}
break;
case SC_SPLASHER:
- if (sc_data[type].val4 % 1000 == 0) {
+ if (sc->data[type].val4 % 1000 == 0) {
char timer[2];
- sprintf (timer, "%d", sc_data[type].val4/1000);
+ sprintf (timer, "%d", sc->data[type].val4/1000);
clif_message(bl, timer);
}
- if((sc_data[type].val4 -= 500) > 0) {
- sc_data[type].timer = add_timer(
+ if((sc->data[type].val4 -= 500) > 0) {
+ sc->data[type].timer = add_timer(
500 + tick, status_change_timer,
bl->id, data);
return 0;
@@ -5683,10 +5574,10 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_MARIONETTE: /* マリオネットコントロ?ル */
case SC_MARIONETTE2:
{
- struct block_list *pbl = map_id2bl(sc_data[type].val3);
+ struct block_list *pbl = map_id2bl(sc->data[type].val3);
if (pbl && battle_check_range(bl, pbl, 7) &&
- (sc_data[type].val2 -= 1000)>0) {
- sc_data[type].timer = add_timer(
+ (sc->data[type].val2 -= 1000)>0) {
+ sc->data[type].timer = add_timer(
1000 + tick, status_change_timer,
bl->id, data);
return 0;
@@ -5695,10 +5586,10 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
break;
case SC_GOSPEL:
- if(sc_data[type].val4 == BCT_SELF){
+ if(sc->data[type].val4 == BCT_SELF){
int hp, sp;
- hp = (sc_data[type].val1 > 5) ? 45 : 30;
- sp = (sc_data[type].val1 > 5) ? 35 : 20;
+ hp = (sc->data[type].val1 > 5) ? 45 : 30;
+ sp = (sc->data[type].val1 > 5) ? 35 : 20;
if(status_get_hp(bl) - hp > 0 &&
(sd == NULL || sd->status.sp - sp> 0))
{
@@ -5707,8 +5598,8 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
else if (bl->type == BL_MOB)
mob_heal((struct mob_data *)bl,-hp);
- if ((sc_data[type].val2 -= 10000) > 0) {
- sc_data[type].timer = add_timer(
+ if ((sc->data[type].val2 -= 10000) > 0) {
+ sc->data[type].timer = add_timer(
10000+tick, status_change_timer,
bl->id, data);
return 0;
@@ -5719,10 +5610,10 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
case SC_GUILDAURA:
{
- struct block_list *tbl = map_id2bl(sc_data[type].val2);
+ struct block_list *tbl = map_id2bl(sc->data[type].val2);
if (tbl && battle_check_range(bl, tbl, 2)){
- sc_data[type].timer = add_timer(
+ sc->data[type].timer = add_timer(
1000 + tick, status_change_timer,
bl->id, data);
return 0;
@@ -5736,7 +5627,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
// if we reach this point we need the timer for the next call,
// so restore it to have status_change_end handle a valid timer
- sc_data[type].timer = temp_timerid;
+ sc->data[type].timer = temp_timerid;
return status_change_end( bl,type,tid );
}
@@ -5748,6 +5639,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
int status_change_timer_sub(struct block_list *bl, va_list ap )
{
struct block_list *src;
+ struct status_change *sc, *tsc;
struct map_session_data* sd=NULL;
struct map_session_data* tsd=NULL;
@@ -5755,9 +5647,11 @@ int status_change_timer_sub(struct block_list *bl, va_list ap )
unsigned int tick;
src=va_arg(ap,struct block_list*);
+ sc=va_arg(ap,struct status_change*);
type=va_arg(ap,int);
tick=va_arg(ap,unsigned int);
-
+ tsc=status_get_sc(bl);
+
if (status_isdead(bl))
return 0;
if (src->type==BL_PC) sd= (struct map_session_data*)src;
@@ -5766,56 +5660,51 @@ int status_change_timer_sub(struct block_list *bl, va_list ap )
switch( type ){
case SC_SIGHT: /* サイト */
case SC_CONCENTRATE:
- if( (*status_get_option(bl))&(OPTION_HIDE|OPTION_CLOAK) ){
- status_change_end( bl, SC_HIDING, -1);
- status_change_end( bl, SC_CLOAKING, -1);
+ if (tsc && tsc->count) {
+ if (tsc->data[SC_HIDING].timer != -1)
+ status_change_end( bl, SC_HIDING, -1);
+ if (tsc->data[SC_CLOAKING].timer != -1)
+ status_change_end( bl, SC_CLOAKING, -1);
}
break;
case SC_RUWACH: /* ルアフ */
- if( (*status_get_option(bl))&(OPTION_HIDE|OPTION_CLOAK) ){
- struct status_change *sc_data = status_get_sc_data(bl); // check whether the target is hiding/cloaking [celest]
- if (sc_data && (sc_data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother
- sc_data[SC_CLOAKING].timer != -1)) {
- status_change_end( bl, SC_HIDING, -1);
- status_change_end( bl, SC_CLOAKING, -1);
- if(battle_check_target( src, bl, BCT_ENEMY ) > 0)
- skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,1,tick,0);
- }
+ if (tsc && tsc->count && (tsc->data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother
+ tsc->data[SC_CLOAKING].timer != -1)) {
+ status_change_end( bl, SC_HIDING, -1);
+ status_change_end( bl, SC_CLOAKING, -1);
+ if(battle_check_target( src, bl, BCT_ENEMY ) > 0)
+ skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,1,tick,0);
}
break;
case SC_SIGHTBLASTER:
{
- struct status_change *sc_data = status_get_sc_data(src);
- if (sc_data && sc_data[type].val2 > 0 && battle_check_target( src, bl, BCT_ENEMY ) > 0)
+ if (sc && sc->count && sc->data[type].val2 > 0 && battle_check_target( src, bl, BCT_ENEMY ) > 0)
{ //sc_ check prevents a single round of Sight Blaster hitting multiple opponents. [Skotlex]
skill_attack(BF_MAGIC,src,src,bl,WZ_SIGHTBLASTER,1,tick,0);
- sc_data[type].val2 = 0; //This signals it to end.
+ sc->data[type].val2 = 0; //This signals it to end.
}
}
break;
case SC_WARM: //SG skills [Komurka]
- {
- if(battle_check_target( src,bl, BCT_ENEMY ) > 0) {
- struct status_change *sc_data = status_get_sc_data(src);
- if(sd){
- if(sd->status.sp<2) {
- sd->sc_data[type].val2 = 0; //Makes it end on the next tick.
- break;
- }
- sd->status.sp -= 2;
- clif_updatestatus(sd,SP_SP);
+ if(battle_check_target( src,bl, BCT_ENEMY ) > 0) {
+ if(sd){
+ if(sd->status.sp<2) {
+ sd->sc.data[type].val2 = 0; //Makes it end on the next tick.
+ break;
}
- skill_attack(BF_WEAPON,src,src,bl,sc_data?sc_data[type].val3:SG_SUN_WARM,1,tick,0);
+ sd->status.sp -= 2;
+ clif_updatestatus(sd,SP_SP);
}
+ skill_attack(BF_WEAPON,src,src,bl,
+ sc?sc->data[type].val3:SG_SUN_WARM,sc?sc->data[type].val1:1,
+ tick,0);
}
break;
case SC_CLOSECONFINE:
- { //Lock char has released the hold on everyone...
- struct status_change *sc_data = status_get_sc_data(bl);
- if (sc_data && sc_data[SC_CLOSECONFINE2].timer != -1 && sc_data[SC_CLOSECONFINE2].val2 == src->id) {
- sc_data[SC_CLOSECONFINE2].val2 = 0;
- status_change_end(bl, SC_CLOSECONFINE2, -1);
- }
+ //Lock char has released the hold on everyone...
+ if (tsc && tsc->count && tsc->data[SC_CLOSECONFINE2].timer != -1 && tsc->data[SC_CLOSECONFINE2].val2 == src->id) {
+ tsc->data[SC_CLOSECONFINE2].val2 = 0;
+ status_change_end(bl, SC_CLOSECONFINE2, -1);
}
break;
}
@@ -5825,8 +5714,8 @@ int status_change_timer_sub(struct block_list *bl, va_list ap )
int status_change_clear_buffs (struct block_list *bl)
{
int i;
- struct status_change *sc_data = status_get_sc_data(bl);
- if (!sc_data)
+ struct status_change *sc= status_get_sc(bl);
+ if (!sc || !sc->count)
return 0;
for (i = 20; i < SC_MAX; i++) {
if(i==SC_HALLUCINATION || i==SC_WEIGHT50 || i==SC_WEIGHT90
@@ -5838,7 +5727,7 @@ int status_change_clear_buffs (struct block_list *bl)
|| i == SC_COMBO || i == SC_DANCING || i == SC_GUILDAURA
)
continue;
- if(sc_data[i].timer != -1)
+ if(sc->data[i].timer != -1)
status_change_end(bl,i,-1);
}
return 0;
@@ -5846,39 +5735,39 @@ int status_change_clear_buffs (struct block_list *bl)
int status_change_clear_debuffs (struct block_list *bl)
{
int i;
- struct status_change *sc_data = status_get_sc_data(bl);
- if (!sc_data)
+ struct status_change *sc = status_get_sc(bl);
+ if (!sc || !sc->count)
return 0;
for (i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++) {
- if(sc_data[i].timer != -1)
+ if(sc->data[i].timer != -1)
status_change_end(bl,i,-1);
}
//Other ailments not in the common range.
- if(sc_data[SC_HALLUCINATION].timer != -1)
+ if(sc->data[SC_HALLUCINATION].timer != -1)
status_change_end(bl,SC_HALLUCINATION,-1);
- if(sc_data[SC_QUAGMIRE].timer != -1)
+ if(sc->data[SC_QUAGMIRE].timer != -1)
status_change_end(bl,SC_QUAGMIRE,-1);
- if(sc_data[SC_SIGNUMCRUCIS].timer != -1)
+ if(sc->data[SC_SIGNUMCRUCIS].timer != -1)
status_change_end(bl,SC_SIGNUMCRUCIS,-1);
- if(sc_data[SC_DECREASEAGI].timer != -1)
+ if(sc->data[SC_DECREASEAGI].timer != -1)
status_change_end(bl,SC_DECREASEAGI,-1);
- if(sc_data[SC_SLOWDOWN].timer != -1)
+ if(sc->data[SC_SLOWDOWN].timer != -1)
status_change_end(bl,SC_SLOWDOWN,-1);
- if(sc_data[SC_MINDBREAKER].timer != -1)
+ if(sc->data[SC_MINDBREAKER].timer != -1)
status_change_end(bl,SC_MINDBREAKER,-1);
- if(sc_data[SC_WINKCHARM].timer != -1)
+ if(sc->data[SC_WINKCHARM].timer != -1)
status_change_end(bl,SC_WINKCHARM,-1);
- if(sc_data[SC_STOP].timer != -1)
+ if(sc->data[SC_STOP].timer != -1)
status_change_end(bl,SC_STOP,-1);
- if(sc_data[SC_ORCISH].timer != -1)
+ if(sc->data[SC_ORCISH].timer != -1)
status_change_end(bl,SC_ORCISH,-1);
- if(sc_data[SC_STRIPWEAPON].timer != -1)
+ if(sc->data[SC_STRIPWEAPON].timer != -1)
status_change_end(bl,SC_STRIPWEAPON,-1);
- if(sc_data[SC_STRIPSHIELD].timer != -1)
+ if(sc->data[SC_STRIPSHIELD].timer != -1)
status_change_end(bl,SC_STRIPSHIELD,-1);
- if(sc_data[SC_STRIPARMOR].timer != -1)
+ if(sc->data[SC_STRIPARMOR].timer != -1)
status_change_end(bl,SC_STRIPARMOR,-1);
- if(sc_data[SC_STRIPHELM].timer != -1)
+ if(sc->data[SC_STRIPHELM].timer != -1)
status_change_end(bl,SC_STRIPHELM,-1);
return 0;
}
diff --git a/src/map/status.h b/src/map/status.h
index e31667d0c..bd04f527c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -460,12 +460,7 @@ int status_get_mode(struct block_list *bl);
int status_get_mexp(struct block_list *bl);
int status_get_race2(struct block_list *bl);
-struct status_change *status_get_sc_data(struct block_list *bl);
-short *status_get_sc_count(struct block_list *bl);
-short *status_get_opt1(struct block_list *bl);
-short *status_get_opt2(struct block_list *bl);
-short *status_get_opt3(struct block_list *bl);
-short *status_get_option(struct block_list *bl);
+struct status_change *status_get_sc(struct block_list *bl);
int status_get_matk1(struct block_list *bl);
int status_get_matk2(struct block_list *bl);