From b84f8eb92e9a6d93e34dc4a6b8127f92998b36f1 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 9 Mar 2006 19:48:50 +0000 Subject: - Now you can't raise levels on an acquired skill when that skill is currently an acquired skill. - Fixed pc_damage_sp not properly substracting SP. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5537 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src/map') 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にダメ?ジを?える -- cgit v1.2.3-70-g09d2