diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-09-08 19:37:56 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-09-08 19:37:56 +0000 |
commit | bdc2958ced13d80122b040ab357fd002d5c0e550 (patch) | |
tree | d133c73651e4ac575964c91496ebe13ea631fc0a /src/map/skill.c | |
parent | 7a308b07b92f9aa82b0e3d8dc987d69f3535b7e2 (diff) | |
download | hercules-bdc2958ced13d80122b040ab357fd002d5c0e550.tar.gz hercules-bdc2958ced13d80122b040ab357fd002d5c0e550.tar.bz2 hercules-bdc2958ced13d80122b040ab357fd002d5c0e550.tar.xz hercules-bdc2958ced13d80122b040ab357fd002d5c0e550.zip |
- 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
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 138 |
1 files changed, 52 insertions, 86 deletions
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; } + /*========================================== * *------------------------------------------ |