summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/pc.c29
2 files changed, 17 insertions, 13 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 4639fc6b4..3a2d3fe72 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -5,6 +5,7 @@ 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/03/09
+ * Fixed pc_damage_sp not properly substracting SP. [Skotlex]
* Made Magic Crasher a BF_WEAPON attack. [Skotlex]
* Made skill_unit_range a per-level setting. meteor and Lov now have their
unit range for bosses adjusted in the skill_unit_db rather than
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にダメ?ジを?える