summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/pc.c53
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/skill.c7
3 files changed, 44 insertions, 18 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 8ba137bfe..913f108d0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4098,7 +4098,6 @@ int pc_checkbaselevelup(struct map_session_data *sd)
if (!next || sd->status.base_exp < next)
return 0;
-
do {
sd->status.base_exp -= next;
//Kyoki pointed out that the max overcarry exp is the exp needed for the previous level -1. [Skotlex]
@@ -4272,24 +4271,26 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
}
}
- //Overflow checks... think we'll ever really need'em? [Skotlex]
- if (base_exp && sd->status.base_exp > UINT_MAX - base_exp)
- sd->status.base_exp = UINT_MAX;
- else
- sd->status.base_exp += base_exp;
-
- pc_checkbaselevelup(sd);
-
- clif_updatestatus(sd,SP_BASEEXP);
-
- if (job_exp && sd->status.job_exp > UINT_MAX - job_exp)
- sd->status.job_exp = UINT_MAX;
- else
- sd->status.job_exp += job_exp;
-
- pc_checkjoblevelup(sd);
+ //Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex]
+ if (base_exp) {
+ nextb = nextb?UINT_MAX:pc_thisbaseexp(sd);
+ if(sd->status.base_exp > nextb - base_exp)
+ sd->status.base_exp = nextb;
+ else
+ sd->status.base_exp += base_exp;
+ pc_checkbaselevelup(sd);
+ clif_updatestatus(sd,SP_BASEEXP);
+ }
- clif_updatestatus(sd,SP_JOBEXP);
+ if (job_exp) {
+ nextj = nextj?UINT_MAX:pc_thisjobexp(sd);
+ if(sd->status.job_exp > nextj - job_exp)
+ sd->status.job_exp = nextj;
+ else
+ sd->status.job_exp += job_exp;
+ pc_checkjoblevelup(sd);
+ clif_updatestatus(sd,SP_JOBEXP);
+ }
if(sd->state.showexp){
sprintf(output,
@@ -4326,6 +4327,15 @@ unsigned int pc_nextbaseexp(struct map_session_data *sd)
return exp_table[pc_class2idx(sd->status.class_)][0][sd->status.base_level-1];
}
+unsigned int pc_thisbaseexp(struct map_session_data *sd)
+{
+ if(sd->status.base_level>pc_maxbaselv(sd) || sd->status.base_level<=1)
+ return 0;
+
+ return exp_table[pc_class2idx(sd->status.class_)][0][sd->status.base_level-2];
+}
+
+
/*==========================================
* job level側必要??値計算
*------------------------------------------*/
@@ -4338,6 +4348,13 @@ unsigned int pc_nextjobexp(struct map_session_data *sd)
return exp_table[pc_class2idx(sd->status.class_)][1][sd->status.job_level-1];
}
+unsigned int pc_thisjobexp(struct map_session_data *sd)
+{
+ if(sd->status.job_level>pc_maxjoblv(sd) || sd->status.job_level<=1)
+ return 0;
+ return exp_table[pc_class2idx(sd->status.class_)][1][sd->status.job_level-2];
+}
+
/*==========================================
* 必要ステ?タスポイント計算
*------------------------------------------*/
diff --git a/src/map/pc.h b/src/map/pc.h
index 1c8b191d9..1af042b6e 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -205,7 +205,9 @@ int pc_checkbaselevelup(struct map_session_data *sd);
int pc_checkjoblevelup(struct map_session_data *sd);
int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int);
unsigned int pc_nextbaseexp(struct map_session_data *);
+unsigned int pc_thisbaseexp(struct map_session_data *);
unsigned int pc_nextjobexp(struct map_session_data *);
+unsigned int pc_thisjobexp(struct map_session_data *);
int pc_need_status_point(struct map_session_data *,int);
int pc_statusup(struct map_session_data*,int);
int pc_statusup2(struct map_session_data*,int,int);
diff --git a/src/map/skill.c b/src/map/skill.c
index 5d1e33fc0..1726285d1 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -4883,6 +4883,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
clif_skill_fail(sd,skillid,0,0);
break;
}
+ if (skillid == SL_SUPERNOVICE && dstsd && dstsd->die_counter && !(rand()%100))
+ { //Erase death count 1% of the casts
+ dstsd->die_counter = 0;
+ pc_setglobalreg(dstsd,"PC_DIE_COUNTER", 0);
+ clif_misceffect2(bl, 0x152);
+ //SC_SPIRIT invokes status_calc_pc for us.
+ }
clif_skill_nodamage(src,bl,skillid,skilllv,
sc_start4(bl,SC_SPIRIT,100,skilllv,skillid,0,0,skill_get_time(skillid,skilllv)));
sc_start(src,SC_SMA,100,skilllv,skill_get_time(SL_SMA,skilllv));