summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/map.h5
-rw-r--r--src/map/pc.c31
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c3
-rw-r--r--src/map/skill.c11
-rw-r--r--src/map/status.c3
6 files changed, 38 insertions, 17 deletions
diff --git a/src/map/map.h b/src/map/map.h
index bb7a99432..6b8ffbe5b 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -392,8 +392,9 @@ enum _sp {
SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037
SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040
SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, //2041-2045
- SP_WEAPON_MATK, SP_BASE_MATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SP_RATE_SKILL, //2046-2050
- SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE //2051-2055
+ SP_WEAPON_MATK, SP_BASE_MATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2050
+ SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2051-2055
+ SP_SKILL_USE_SP //2056
};
enum _look {
diff --git a/src/map/pc.c b/src/map/pc.c
index 138bc0828..459f6ef99 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3064,19 +3064,19 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag != 2)
sd->hp_gain_race_attack[type2] = cap_value(sd->hp_gain_race_attack[type2] + val, 0, INT16_MAX);
break;
- case SP_SP_RATE_SKILL: //bonus2 bUseSPrateSkill,n,x;
+ case SP_SKILL_USE_SP_RATE: //bonus2 bSkillUseSPrate,n,x;
if(sd->state.lr_flag == 2)
break;
- ARR_FIND(0, ARRAYLENGTH(sd->sprateskill), i, sd->sprateskill[i].id == 0 || sd->sprateskill[i].id == type2);
- if (i == ARRAYLENGTH(sd->sprateskill)) {
- ShowDebug("run_script: bonus2 bUseSPrateSkill reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->sprateskill), type2, val);
+ ARR_FIND(0, ARRAYLENGTH(sd->skillusesprate), i, sd->skillusesprate[i].id == 0 || sd->skillusesprate[i].id == type2);
+ if (i == ARRAYLENGTH(sd->skillusesprate)) {
+ ShowDebug("run_script: bonus2 bSkillUseSPrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillusesprate), type2, val);
break;
}
- if (sd->sprateskill[i].id == type2)
- sd->sprateskill[i].val += val;
+ if (sd->skillusesprate[i].id == type2)
+ sd->skillusesprate[i].val += val;
else {
- sd->sprateskill[i].id = type2;
- sd->sprateskill[i].val = val;
+ sd->skillusesprate[i].id = type2;
+ sd->skillusesprate[i].val = val;
}
break;
case SP_SKILL_COOLDOWN:
@@ -3127,6 +3127,21 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
sd->skillvarcast[i].val = val;
}
break;
+ case SP_SKILL_USE_SP: //bonus2 bSkillUseSP,n,x;
+ if(sd->state.lr_flag == 2)
+ break;
+ ARR_FIND(0, ARRAYLENGTH(sd->skillusesp), i, sd->skillusesp[i].id == 0 || sd->skillusesp[i].id == type2);
+ if (i == ARRAYLENGTH(sd->skillusesp)) {
+ ShowDebug("run_script: bonus2 bSkillUseSP reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillusesp), type2, val);
+ break;
+ }
+ if (sd->skillusesp[i].id == type2)
+ sd->skillusesp[i].val += val;
+ else {
+ sd->skillusesp[i].id = type2;
+ sd->skillusesp[i].val = val;
+ }
+ break;
default:
ShowWarning("pc_bonus2: unknown type %d %d %d!\n",type,type2,val);
break;
diff --git a/src/map/pc.h b/src/map/pc.h
index 2cf4947a1..6f2275fa7 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -259,7 +259,7 @@ struct map_session_data {
struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
unsigned short id;
short val;
- } skillatk[MAX_PC_BONUS], sprateskill[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS];
+ } skillatk[MAX_PC_BONUS], skillusesprate[MAX_PC_BONUS], skillusesp[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillcooldown[MAX_PC_BONUS], skillfixcast[MAX_PC_BONUS], skillvarcast[MAX_PC_BONUS];
struct {
short value;
int rate;
diff --git a/src/map/script.c b/src/map/script.c
index 68baecc23..0329f4928 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7354,10 +7354,11 @@ BUILDIN_FUNC(bonus)
case SP_ADD_SKILL_BLOW:
case SP_CASTRATE:
case SP_ADDEFF_ONSKILL:
- case SP_SP_RATE_SKILL:
+ case SP_SKILL_USE_SP_RATE:
case SP_SKILL_COOLDOWN:
case SP_SKILL_FIXEDCAST:
case SP_SKILL_VARIABLECAST:
+ case SP_SKILL_USE_SP:
// these bonuses support skill names
val1 = ( script_isstring(st,3) ? skill_name2id(script_getstr(st,3)) : script_getnum(st,3) );
break;
diff --git a/src/map/skill.c b/src/map/skill.c
index 3c99dc74a..006018d47 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -12794,10 +12794,13 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short
req.sp += (status->max_sp * (-sp_rate))/100;
if( sd->dsprate != 100 )
req.sp = req.sp * sd->dsprate / 100;
-
- ARR_FIND(0, ARRAYLENGTH(sd->sprateskill), i, sd->sprateskill[i].id == skill);
- if( i < ARRAYLENGTH(sd->sprateskill) )
- sp_skill_rate_bonus += sd->sprateskill[i].val;
+
+ ARR_FIND(0, ARRAYLENGTH(sd->skillusesprate), i, sd->skillusesprate[i].id == skill);
+ if( i < ARRAYLENGTH(sd->skillusesprate) )
+ sp_skill_rate_bonus += sd->skillusesprate[i].val;
+ ARR_FIND(0, ARRAYLENGTH(sd->skillusesp), i, sd->skillusesp[i].id == skill);
+ if( i < ARRAYLENGTH(sd->skillusesp) )
+ req.sp -= sd->skillusesp[i].val;
req.sp = cap_value(req.sp * sp_skill_rate_bonus / 100, 0, SHRT_MAX);
diff --git a/src/map/status.c b/src/map/status.c
index b349e6ab2..1b12c2ae4 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2358,7 +2358,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
+ sizeof(sd->addeff2)
+ sizeof(sd->addeff3)
+ sizeof(sd->skillatk)
- + sizeof(sd->sprateskill)
+ + sizeof(sd->skillusesprate)
+ + sizeof(sd->skillusesp)
+ sizeof(sd->skillheal)
+ sizeof(sd->skillheal2)
+ sizeof(sd->hp_loss)