浏览代码

- Implemented SL_SUPERNOVICE erasing the death record 1% of the casts.
- Implemented current exp being capped to the exp required to level up from the previous level when we are at max level (required for some S. Novice buffs)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11764 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 17 年之前
父节点
当前提交
e96015d64b
共有 4 个文件被更改,包括 49 次插入18 次删除
  1. 5 0
      Changelog-Trunk.txt
  2. 35 18
      src/map/pc.c
  3. 2 0
      src/map/pc.h
  4. 7 0
      src/map/skill.c

+ 5 - 0
Changelog-Trunk.txt

@@ -3,6 +3,11 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/11/20
+	* Implemented SL_SUPERNOVICE erasing the death record 1% of the casts.
+	* Implemented current exp being capped to the exp required to level up from
+	  the previous level when we are at max level (required for some S. Novice
+	  buffs) [Skotlex]
 2007/11/19
 	* Nullpo's disabled on release builds.
 	* Added timestamps to the log of memory leaks.

+ 35 - 18
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];
+}
+
 /*==========================================
  * 必要ステ?タスポイント計算
  *------------------------------------------*/

+ 2 - 0
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);

+ 7 - 0
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));