From 7751fc21990d18f215dff82669a470b7c3660b11 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 13 Feb 2006 16:54:24 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5269 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++++ src/map/atcommand.c | 13 ++++++------- src/map/battle.c | 5 ++++- src/map/charcommand.c | 16 ++++++++-------- src/map/clif.c | 2 +- src/map/pc.c | 22 ++++++++++------------ src/map/pc.h | 2 +- src/map/script.c | 2 +- src/map/skill.c | 15 ++++++++------- 9 files changed, 43 insertions(+), 38 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 7f877680c..d9cdb7850 100644 --- a/Changelog-Trunk.txt +++ b/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] diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 99c13339d..4527ae42e 100644 --- a/src/map/atcommand.c +++ b/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. } diff --git a/src/map/battle.c b/src/map/battle.c index 50afba057..f096ab117 100644 --- a/src/map/battle.c +++ b/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] diff --git a/src/map/charcommand.c b/src/map/charcommand.c index b685f4bfd..69a5a9ac4 100644 --- a/src/map/charcommand.c +++ b/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 { diff --git a/src/map/clif.c b/src/map/clif.c index bf5f3ba6d..ebc065bde 100644 --- a/src/map/clif.c +++ b/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; } } diff --git a/src/map/pc.c b/src/map/pc.c index 9e8467c33..1800c74ea 100644 --- a/src/map/pc.c +++ b/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;istatus.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; } diff --git a/src/map/pc.h b/src/map/pc.h index f184f3f5d..8e695cafc 100644 --- a/src/map/pc.h +++ b/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); diff --git a/src/map/script.c b/src/map/script.c index 84c5c59e1..19d52b026 100644 --- a/src/map/script.c +++ b/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; } diff --git a/src/map/skill.c b/src/map/skill.c index 001be8625..cd44beabb 100644 --- a/src/map/skill.c +++ b/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; } -- cgit v1.2.3-70-g09d2