From bdc2958ced13d80122b040ab357fd002d5c0e550 Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 8 Sep 2006 19:37:56 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8681 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 11 +---- src/map/pc.c | 3 +- src/map/skill.c | 138 +++++++++++++++++++++---------------------------------- src/map/skill.h | 3 +- src/map/status.c | 4 +- src/map/status.h | 1 + src/map/unit.c | 3 +- 7 files changed, 61 insertions(+), 102 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index a8970a8b1..73ab29e6b 100644 --- a/src/map/clif.c +++ b/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; diff --git a/src/map/pc.c b/src/map/pc.c index 0ec41a6c2..855a84979 100644 --- a/src/map/pc.c +++ b/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); diff --git a/src/map/skill.c b/src/map/skill.c index eea144311..5d3ae3f3d 100644 --- a/src/map/skill.c +++ b/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; } + /*========================================== * *------------------------------------------ diff --git a/src/map/skill.h b/src/map/skill.h index c5d3fca58..d1d6cc011 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -226,8 +226,7 @@ int skill_guildaura_sub (struct block_list *bl,va_list ap); // 詠唱キャンセル 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); diff --git a/src/map/status.c b/src/map/status.c index eeb73c0df..39530e5d5 100644 --- a/src/map/status.c +++ b/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 diff --git a/src/map/status.h b/src/map/status.h index 9579adc1f..15d0f0bf3 100644 --- a/src/map/status.h +++ b/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); diff --git a/src/map/unit.c b/src/map/unit.c index cfa7be2da..396eeca45 100644 --- a/src/map/unit.c +++ b/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); -- cgit v1.2.3-60-g2f50