Browse Source

- Modified PA_GOSPEL so that the random damage attack becomes a BF_MISC attack.
- Added pc_resetskill when lowering job level and there's not enough skpoints to substract.
- Fixed compile error of SG_FUSION in pc.c
- Modified pc_resetskill to receive a flag to indicate if it should or not do status_calc_pc and send skill block updates. Meant to optimize performance when used in the middle of a larger update.


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

skotlex 19 years ago
parent
commit
59e17a948b
9 changed files with 43 additions and 38 deletions
  1. 4 0
      Changelog-Trunk.txt
  2. 6 7
      src/map/atcommand.c
  3. 4 1
      src/map/battle.c
  4. 8 8
      src/map/charcommand.c
  5. 1 1
      src/map/clif.c
  6. 10 12
      src/map/pc.c
  7. 1 1
      src/map/pc.h
  8. 1 1
      src/map/script.c
  9. 8 7
      src/map/skill.c

+ 4 - 0
Changelog-Trunk.txt

@@ -5,6 +5,10 @@ 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/02/13
+	* Modified PA_GOSPEL so that the random damage attack becomes a BF_MISC
+	  attack. [Skotlex]
+	* Added pc_resetskill when lowering job level and there's not enough
+	  skill points to substract. [Skotlex]
 	* Fixed SG_FUSION costing SP to deactivate. [Skotlex]
 	* Some cleaning up at pc_setpos to prevent calling pc_clean_skilltree
 	  [Skotlex]

+ 6 - 7
src/map/atcommand.c

@@ -2710,7 +2710,6 @@ int atcommand_baselevelup(
 		sd->status.base_level += level;
 		clif_updatestatus(sd, SP_BASELEVEL);
 		clif_updatestatus(sd, SP_NEXTBASEEXP);
-		pc_resetskill(sd);	/* Skills are reset */
 		status_calc_pc(sd, 0);
 		clif_displaymessage(fd, msg_table[22]); /* Base level lowered. */
 	}
@@ -2761,12 +2760,12 @@ int atcommand_joblevelup(
 		sd->status.job_level -= level;
 		clif_updatestatus(sd, SP_JOBLEVEL);
 		clif_updatestatus(sd, SP_NEXTJOBEXP);
-		if (sd->status.skill_point > 0) {
-			sd->status.skill_point -= level;
-			if (sd->status.skill_point < 0)
-				sd->status.skill_point = 0;
-			clif_updatestatus(sd, SP_SKILLPOINT);
-		} // to add: remove status points from skills
+		if (sd->status.skill_point < level)
+			pc_resetskill(sd,0);	//Reset skills since we need to substract more points.
+		sd->status.skill_point -= level;
+		if (sd->status.skill_point < 0)
+			sd->status.skill_point = 0;
+		clif_updatestatus(sd, SP_SKILLPOINT);
 		status_calc_pc(sd, 0);
 		clif_displaymessage(fd, msg_table[25]); // Job level lowered.
 	}

+ 4 - 1
src/map/battle.c

@@ -2834,7 +2834,10 @@ struct Damage  battle_calc_misc_attack(
 		damagefix=0;
 		aflag = (aflag&~BF_RANGEMASK)|BF_LONG;
 		break;
-
+	case PA_GOSPEL:
+		damage = 1+rand()%9999;
+		aflag = (aflag&~BF_RANGEMASK)|BF_LONG;
+		break;
 	case CR_ACIDDEMONSTRATION:
 		//This equation is not official, but it's the closest to the official one 
 		//that Viccious Pucca and the other folks at the forums could come up with. [Skotlex]

+ 8 - 8
src/map/charcommand.c

@@ -523,7 +523,7 @@ int charcommand_reset(
 	if ((pl_sd = map_nick2sd(character)) != NULL) {
 		if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset a character only for lower or same GM level
 			pc_resetstate(pl_sd);
-			pc_resetskill(pl_sd);
+			pc_resetskill(pl_sd,1);
 			sprintf(output, msg_table[208], character); // '%s' skill and stats points reseted!
 			clif_displaymessage(fd, output);
 		} else {
@@ -1357,12 +1357,12 @@ int charcommand_joblevel(
 				pl_sd->status.job_level -= level;
 				clif_updatestatus(pl_sd, SP_JOBLEVEL);
 				clif_updatestatus(pl_sd, SP_NEXTJOBEXP);
-				if (pl_sd->status.skill_point > 0) {
-					pl_sd->status.skill_point -= level;
-					if (pl_sd->status.skill_point < 0)
-						pl_sd->status.skill_point = 0;
-					clif_updatestatus(pl_sd, SP_SKILLPOINT);
-				} // to add: remove status points from skills
+				if (pl_sd->status.skill_point < level)
+					pc_resetskill(pl_sd, 0); //Need more skill points to substract
+				pl_sd->status.skill_point -= level;
+				if (pl_sd->status.skill_point < 0)
+					pl_sd->status.skill_point = 0;
+				clif_updatestatus(pl_sd, SP_SKILLPOINT);
 				status_calc_pc(pl_sd, 0);
 				clif_displaymessage(fd, msg_table[69]); // Character's job level lowered.
 			}
@@ -1492,7 +1492,7 @@ int charcommand_skreset(
 
 	if ((pl_sd = map_nick2sd(player)) != NULL) {
 		if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can reset skill points only lower or same gm level
-			pc_resetskill(pl_sd);
+			pc_resetskill(pl_sd,1);
 			sprintf(tmp_cmdoutput, msg_table[206], player); // '%s' skill points reseted!
 			clif_displaymessage(fd, tmp_cmdoutput);
 		} else {

+ 1 - 1
src/map/clif.c

@@ -10369,7 +10369,7 @@ void clif_parse_ResetChar(int fd, struct map_session_data *sd) {
 			pc_resetstate(sd);
 			break;
 		case 1:
-			pc_resetskill(sd);
+			pc_resetskill(sd,1);
 			break;
 		}
 	}

+ 10 - 12
src/map/pc.c

@@ -5065,13 +5065,8 @@ int pc_resetlvl(struct map_session_data* sd,int type)
 
 	nullpo_retr(0, sd);
 
-	if (type != 3) {
-		for(i=1;i<MAX_SKILL;i++){
-			if (sd->status.skill[i].lv &&
-				!skill_get_inf2(i)&INF2_WEDDING_SKILL) //Do not reset Wedding Skills. [Skotlex]
-				sd->status.skill[i].lv = 0; 
-		}
-	}
+	if (type != 3) //Also reset skills
+		pc_resetskill(sd, 0);
 
 	if(type == 1){
 	sd->status.skill_point=0;
@@ -5142,8 +5137,8 @@ int pc_resetlvl(struct map_session_data* sd,int type)
 		//Send map-change packet to do a level range check and break party settings. [Skotlex]
 		party_send_movemap(sd);
 	}
-	clif_skillinfoblock(sd);
 	status_calc_pc(sd,0);
+	clif_skillinfoblock(sd);
 
 	return 0;
 }
@@ -5205,9 +5200,10 @@ int pc_resetstate(struct map_session_data* sd)
 
 /*==========================================
  * /resetskill
+ * if flag is 1, perform block resync and status_calc call.
  *------------------------------------------
  */
-int pc_resetskill(struct map_session_data* sd)
+int pc_resetskill(struct map_session_data* sd, int flag)
 {
 	int i, skill, inf2;
 	nullpo_retr(0, sd);
@@ -5236,9 +5232,11 @@ int pc_resetskill(struct map_session_data* sd)
 			sd->status.skill[i].lv = 0;
 		}
 	}
-	clif_updatestatus(sd,SP_SKILLPOINT);
-	clif_skillinfoblock(sd);
-	status_calc_pc(sd,0);
+	if (flag) {
+		clif_updatestatus(sd,SP_SKILLPOINT);
+		clif_skillinfoblock(sd);
+		status_calc_pc(sd,0);
+	}
 
 	return 0;
 }

+ 1 - 1
src/map/pc.h

@@ -131,7 +131,7 @@ int pc_skillup(struct map_session_data*,int);
 int pc_allskillup(struct map_session_data*);
 int pc_resetlvl(struct map_session_data*,int type);
 int pc_resetstate(struct map_session_data*);
-int pc_resetskill(struct map_session_data*);
+int pc_resetskill(struct map_session_data*, int);
 int pc_resetfeel(struct map_session_data*);
 int pc_equipitem(struct map_session_data*,int,int);
 int pc_unequipitem(struct map_session_data*,int,int);

+ 1 - 1
src/map/script.c

@@ -6243,7 +6243,7 @@ int buildin_resetskill(struct script_state *st)
 {
 	struct map_session_data *sd;
 	sd=script_rid2sd(st);
-	pc_resetskill(sd);
+	pc_resetskill(sd,1);
 	return 0;
 }
 

+ 8 - 7
src/map/skill.c

@@ -1756,6 +1756,10 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
 	case SG_STAR_WARM:
 		clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, skillid, -1, 5);
 		break;
+	case PA_GOSPEL: //Should look like Holy Cross [Skotlex]
+		clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, CR_HOLYCROSS, -1, 5);
+		break;
+
 	case ASC_BREAKER:	// [celest]
 		if (attack_type&BF_WEAPON) { // the 1st attack won't really deal any damage
 			tmpdmg = damage;	// store the temporary weapon damage
@@ -7152,12 +7156,8 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign
 			switch (i)
 			{
 				case 0: // Deal 1~9999 damage
-				{
-					int dmg = rand() % 9999 +1;
-					clif_skill_damage(bl, bl, sg->tick,0,0,dmg,0,CR_HOLYCROSS,1,-1);
-					battle_damage(ss, bl, dmg,0);
+					skill_attack(BF_MISC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
 					break;
-				}
 				case 1: // Curse
 					status_change_start(bl,SC_CURSE,100,1,0,0,0,skill_get_time2(sg->skill_id, sg->skill_lv),0);
 					break;
@@ -7861,7 +7861,6 @@ int skill_check_condition(struct map_session_data *sd,int type)
 	case PA_GOSPEL:
 	case CR_SHRINK:
 	case TK_RUN:
-	case SG_FUSION:
 		if(sd->sc.data[SkillStatusChangeTable[skill]].timer!=-1)
 			return 1;			/* ‰ð?œ‚·‚é?ê?‡‚ÍSP?Á”‚È‚¢ */
 		break;
@@ -8195,7 +8194,9 @@ int skill_check_condition(struct map_session_data *sd,int type)
 		clif_skill_fail(sd,skill,0,0);
 		return 0;
 	case SG_FUSION:
-		if ((sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_STAR) || sd->sc.data[SC_FUSION].timer != -1)
+		if (sd->sc.data[SC_FUSION].timer!=-1)
+			return 1;
+		if (sd->sc.data[SC_SPIRIT].timer != -1 && sd->sc.data[SC_SPIRIT].val2 == SL_STAR)
 			break;
 		return 0;
 	}