diff options
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 549f7678c..58879802b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4910,14 +4910,16 @@ int pc_skillup(struct map_session_data *sd,int skill_num) {
nullpo_retr(0, sd);
- if( skill_num>=10000 ){
+ if( skill_num>=GD_SKILLBASE){
guild_skillup(sd,skill_num,0);
return 0;
}
-
- if( sd->status.skill_point>0 &&
- sd->status.skill[skill_num].id!=0 &&
- //sd->status.skill[skill_num].lv < skill_get_max(skill_num) ) - celest
+ if (skill_num < 0 || skill_num >= MAX_SKILL)
+ return 0;
+
+ if(sd->status.skill_point>0 &&
+ sd->status.skill[skill_num].id &&
+ sd->status.skill[skill_num].flag==0 && //Don't allow raising while you have granted skills. [Skotlex]
sd->status.skill[skill_num].lv < skill_tree_get_max(skill_num, sd->status.class_) )
{
sd->status.skill[skill_num].lv++;
@@ -5197,6 +5199,7 @@ static int pc_respawn(int tid,unsigned int tick,int id,int data) /*==========================================
* Damages a player's SP, returns remaining SP. [Skotlex]
* damage is absolute damage, rate is % damage (100 = 100%)
+ * if rate is positive, it is % of current sp, if negative, it is % of max
* Returns remaining SP, or -1 if the player did not have enough SP to substract from.
*------------------------------------------
*/
@@ -5205,20 +5208,20 @@ int pc_damage_sp(struct map_session_data *sd, int damage, int rate) if (!sd->status.sp)
return 0;
- if (rate)
- damage += (rate*(sd->status.sp-damage)/sd->status.max_sp)/100;
+ if (rate > 0)
+ damage += (rate*sd->status.sp)/100;
+ else if (rate < 0)
+ damage -= (rate*sd->status.max_sp)/100;
+
if (sd->status.sp >= damage){
sd->status.sp -= damage;
clif_updatestatus(sd,SP_SP);
return sd->status.sp;
}
- if (sd->status.sp) {
- sd->status.sp = 0;
- clif_updatestatus(sd,SP_SP);
- return -1;
- }
- return 0;
+ sd->status.sp = 0;
+ clif_updatestatus(sd,SP_SP);
+ return -1;
}
/*==========================================
* pcにダメ?ジを?える
|