Quellcode durchsuchen

- Unified the rest and ganstar paradise code into a single function.
- Moved the Happy State trigger to the regen function, it now triggers at the same time the SPTIME does.


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

skotlex vor 18 Jahren
Ursprung
Commit
99aca1182b
8 geänderte Dateien mit 65 neuen und 102 gelöschten Zeilen
  1. 4 0
      Changelog-Trunk.txt
  2. 2 9
      src/map/clif.c
  3. 1 2
      src/map/pc.c
  4. 52 86
      src/map/skill.c
  5. 1 2
      src/map/skill.h
  6. 3 1
      src/map/status.c
  7. 1 0
      src/map/status.h
  8. 1 2
      src/map/unit.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/09/08
+	* Unified the rest and ganster paradise code into a single function.
+	  [Skotlex]
+	* Moved the Happy State trigger to the regen function, it now triggers at
+	  the same time SPTIME does. [Skotlex]
 	* Cleaned up SG_HATE, hope it works now. [Skotlex]
 	* Removed sg_miracle_skill_duration, replaced it with
 	  sg_miracle_skill_min_duration and sg_miracle_skill_max_duration, to specify

+ 2 - 9
src/map/clif.c

@@ -8921,8 +8921,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
 		)) //No sitting during these states neither.
 		break;
 		pc_setsit(sd);
-		skill_gangsterparadise(sd, 1); // ギャングスターパラダイス設定 fixed Valaris
-		skill_rest(sd, 1); // TK_HPTIME sitting down mode [Dralnu]
+		skill_sit(sd, 1);
 		clif_sitting(sd);
 		break;
 	case 0x03: // standup
@@ -8935,8 +8934,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
 			return;
 		}
 		pc_setstand(sd);
-		skill_gangsterparadise(sd, 0); 
-		skill_rest(sd, 0); // TK_HPTIME standing up mode [Dralnu]
+		skill_sit(sd, 0); 
 		WBUFW(buf, 0) = 0x8a;
 		WBUFL(buf, 2) = sd->bl.id;
 		WBUFB(buf,26) = 3;
@@ -11084,8 +11082,6 @@ void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd)
  *------------------------------------------
  */
 void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) {
-	int level;
-	
 	if (sd->state.doridori) return;
 
 	switch (sd->class_&MAPID_UPPERMASK)
@@ -11093,9 +11089,6 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd) {
 		case MAPID_TAEKWON:
 			if (!sd->state.rest)
 				break;
-			if ((level = pc_checkskill(sd,TK_SPTIME)))
-				sc_start(&sd->bl,SkillStatusChangeTable(TK_SPTIME),
-					100,level,skill_get_time(TK_SPTIME, level));
 		case MAPID_SUPER_NOVICE:
 			sd->state.doridori=1;
 			break;	

+ 1 - 2
src/map/pc.c

@@ -4768,8 +4768,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
 
 	if(pc_issit(sd)) {
 		pc_setstand(sd);
-		skill_gangsterparadise(sd,0);
-		skill_rest(sd,0);
+		skill_sit(sd,0);
 	}
 
 	clif_updatestatus(sd,SP_HP);

+ 52 - 86
src/map/skill.c

@@ -8919,131 +8919,97 @@ int skill_autospell (struct map_session_data *sd, int skillid)
 }
 
 /*==========================================
- *
+ * Sitting skills functions.
  *------------------------------------------
  */
-
-static int skill_gangster_count (struct block_list *bl, va_list ap)
+static int skill_sit_count (struct block_list *bl, va_list ap)
 {
 	struct map_session_data *sd;
+	int type =va_arg(ap,int);
 	sd=(struct map_session_data*)bl;
 
-	if(sd && pc_issit(sd) && pc_checkskill(sd,RG_GANGSTER) > 0)
+	if(!pc_issit(sd))
+		return 0;
+
+	if(type&1 && pc_checkskill(sd,RG_GANGSTER) > 0)
 		return 1;
-	return 0;
-}
 
-static int skill_gangster_in (struct block_list *bl, va_list ap)
-{
-	struct map_session_data *sd;
-	sd=(struct map_session_data*)bl;
-	if(sd && pc_issit(sd) && pc_checkskill(sd,RG_GANGSTER) > 0)
-		sd->state.gangsterparadise=1;
-	return 0;
-}
+	if(type&2 && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0))
+		return 1;
 
-static int skill_gangster_out (struct block_list *bl, va_list ap)
-{
-	struct map_session_data *sd;
-	sd=(struct map_session_data*)bl;
-	if(sd && sd->state.gangsterparadise)
-		sd->state.gangsterparadise=0;
 	return 0;
 }
 
-int skill_gangsterparadise (struct map_session_data *sd, int type)
-{
-	int range;
-	nullpo_retr(0, sd);
-
-	if((range = pc_checkskill(sd,RG_GANGSTER)) <= 0)
-		return 0;
-	range = skill_get_splash(RG_GANGSTER, range);
-
-	if(type==1) {
-		if (map_foreachinrange(skill_gangster_count,&sd->bl, range, BL_PC) > 1)
-	  	{
-			map_foreachinrange(skill_gangster_in,&sd->bl, range, BL_PC);
-			sd->state.gangsterparadise = 1;
-		}
-		return 0;
-	}
-	else if(type==0) {
-		if (map_foreachinrange(skill_gangster_count,&sd->bl, range, BL_PC) < 2)
-			map_foreachinrange(skill_gangster_out,&sd->bl, range, BL_PC);
-		sd->state.gangsterparadise = 0;
-		return 0;
-	}
-	return 0;
-}
-/*==========================================
- * Taekwon TK_HPTIME and TK_SPTIME skills [Dralnu]
- *------------------------------------------
- */
-static int skill_rest_count (struct block_list *bl, va_list ap)
+static int skill_sit_in (struct block_list *bl, va_list ap)
 {
 	struct map_session_data *sd;
+	int type =va_arg(ap,int);
+
 	sd=(struct map_session_data*)bl;
 
-	if(sd && pc_issit(sd) && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0  ))
-		return 1;
-	return 0;
-}
+	if(!pc_issit(sd))
+		return 0;
 
-static int skill_rest_in(struct block_list *bl, va_list ap)
-{
-	struct map_session_data *sd;
-	nullpo_retr(0, bl);
-	nullpo_retr(0, ap);
+	if(type&1 && pc_checkskill(sd,RG_GANGSTER) > 0)
+		sd->state.gangsterparadise=1;
 
-	sd=(struct map_session_data*)bl;
-	if(sd && pc_issit(sd) && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0 )){
+	if(type&2 && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0 ))
+	{
 		sd->state.rest=1;
-		status_calc_pc(sd,0);
-	}		
+		status_calc_regen(bl, status_get_status_data(bl), status_get_regen_data(bl));
+	}
+
 	return 0;
 }
 
-static int skill_rest_out(struct block_list *bl, va_list ap)
+static int skill_sit_out (struct block_list *bl, va_list ap)
 {
 	struct map_session_data *sd;
+	int type =va_arg(ap,int);
 	sd=(struct map_session_data*)bl;
-	if(sd && sd->state.rest != 0)
+	if(sd->state.gangsterparadise && type&1)
+		sd->state.gangsterparadise=0;
+	if(sd->state.rest && type&2)
 		sd->state.rest=0;
 	return 0;
 }
 
-int skill_rest(struct map_session_data *sd, int type)
+int skill_sit (struct map_session_data *sd, int type)
 {
-	int range;
+	int flag = 0;
+	int range, lv;
 	nullpo_retr(0, sd);
 
-	if((range = pc_checkskill(sd,TK_HPTIME)) > 0)
-		range = skill_get_splash(TK_HPTIME, range);
-	else if ((range =	pc_checkskill(sd,TK_SPTIME)) > 0)
-		range = skill_get_splash(TK_SPTIME, range);
-	else
-		return 0;
 
-	
-	if(type==1) {	//When you sit down
-		if (map_foreachinrange(skill_rest_count,&sd->bl, range, BL_PC) > 1)
-		{
-			map_foreachinrange(skill_rest_in,&sd->bl, range, BL_PC);
-			sd->state.rest = 1;
-			status_calc_pc(sd,0);
-		}
+	if((lv = pc_checkskill(sd,RG_GANGSTER)) <= 0) {
+		flag|=1;
+		range = skill_get_splash(RG_GANGSTER, lv);
+	}
+	if((lv = pc_checkskill(sd,TK_HPTIME)) > 0) {
+		flag|=2;
+		range = skill_get_splash(TK_HPTIME, lv);
+	}
+	else if ((lv=	pc_checkskill(sd,TK_SPTIME)) > 0) {
+		flag|=2;
+		range = skill_get_splash(TK_SPTIME, lv);
+	}
+
+	if (!flag) return 0;
+
+	if(type==1) {
+		if (map_foreachinrange(skill_sit_count,&sd->bl, range, BL_PC, flag) > 1)
+			map_foreachinrange(skill_sit_in,&sd->bl, range, BL_PC, flag);
 		return 0;
 	}
-	else if(type==0) {	//When you stand up
-		if (map_foreachinrange(skill_rest_count,&sd->bl, range, BL_PC) < 2)
-			map_foreachinrange(skill_rest_out,&sd->bl, range, BL_PC);
-		sd->state.rest = 0;
-		status_calc_pc(sd,0);
+	else
+	if(type==0) {
+		if (map_foreachinrange(skill_sit_count,&sd->bl, range, BL_PC, flag) < 2)
+			map_foreachinrange(skill_sit_out,&sd->bl, range, BL_PC, flag);
 		return 0;
 	}
 	return 0;
 }
+
 /*==========================================
  *
  *------------------------------------------

+ 1 - 2
src/map/skill.h

@@ -226,8 +226,7 @@ int skill_guildaura_sub (struct block_list *bl,va_list ap);
 // ‰r�¥ƒLƒƒƒ“ƒZƒ‹
 int skill_castcancel(struct block_list *bl,int type);
 
-int skill_gangsterparadise(struct map_session_data *sd ,int type);
-int skill_rest(struct map_session_data *sd ,int type);
+int skill_sit (struct map_session_data *sd, int type);
 void skill_brandishspear_first(struct square *tc,int dir,int x,int y);
 void skill_brandishspear_dir(struct square *tc,int dir,int are);
 void skill_repairweapon(struct map_session_data *sd, int idx);

+ 3 - 1
src/map/status.c

@@ -1162,7 +1162,6 @@ int status_check_visibility(struct block_list *src, struct block_list *target)
 }
 
 void status_calc_bl(struct block_list *bl, unsigned long flag);
-void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen);
 
 static int status_base_atk(struct block_list *bl, struct status_data *status)
 {
@@ -7009,6 +7008,9 @@ static int status_natural_heal(DBKey key,void * data,va_list app)
 			if (sd && sd->state.doridori) {
 				val*=2;
 				sd->state.doridori = 0;
+				if ((rate = pc_checkskill(sd,TK_SPTIME)))
+					sc_start(bl,SkillStatusChangeTable(TK_SPTIME),
+						100,rate,skill_get_time(TK_SPTIME, rate));
 				if (
 					(sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR &&
 					rand()%10000 < battle_config.sg_angel_skill_ratio

+ 1 - 0
src/map/status.h

@@ -637,6 +637,7 @@ int status_calc_pc(struct map_session_data* sd,int first);
 int status_calc_mob(struct mob_data* md, int first); //[Skotlex]
 int status_calc_homunculus(struct homun_data *hd, int first);
 void status_calc_misc(struct block_list *bl, struct status_data *status, int level);
+void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen);
 
 void status_freecast_switch(struct map_session_data *sd);
 int status_getrefinebonus(int lv,int type);

+ 1 - 2
src/map/unit.c

@@ -1596,8 +1596,7 @@ int unit_remove_map(struct block_list *bl, int clrtype) {
 
 		if(pc_issit(sd)) {
 			pc_setstand(sd);
-			skill_gangsterparadise(sd,0);
-			skill_rest(sd,0);
+			skill_sit(sd,0);
 		}
 		party_send_dot_remove(sd);//minimap dot fix [Kevin]
 		guild_send_dot_remove(sd);