summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-07-02 17:05:34 -0300
committerpanikon <panikon@zoho.com>2014-07-02 17:05:34 -0300
commitcf176a77c4c9197773967ff0a03810bcc07b98a5 (patch)
treeb4680cde8365ab381f3c2fefad8333c5936eb47e /src/map
parent58746ca809fe202b9d5c2519941093744c34e68f (diff)
downloadhercules-cf176a77c4c9197773967ff0a03810bcc07b98a5.tar.gz
hercules-cf176a77c4c9197773967ff0a03810bcc07b98a5.tar.bz2
hercules-cf176a77c4c9197773967ff0a03810bcc07b98a5.tar.xz
hercules-cf176a77c4c9197773967ff0a03810bcc07b98a5.zip
Refactoring in AB_PRAEFATIO in order to prevent crashes and to clean code.
Removed some redundant checks in WM_LULLABY_DEEPSLEEP and in WM_VOICEOFSIREN
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 19984bdbc..d2021b0b4 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8134,15 +8134,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if( dstsd && dstsd->special_state.no_magic_damage )
break;
- if ( sd == NULL || (sd && sd->status.party_id == 0 ) )
- count = 1;
- else
- count = party->foreachsamemap(party->sub_count, sd, 0);
+ if( sd && sd->status.party_id != 0 )
+ count = party->foreachsamemap(party->sub_count, sd, 0);
- if (count > 0)
- clif->skill_nodamage(bl, bl, skill_id, skill_lv,
- sc_start4(src, bl, type, 100, skill_lv, 0, 0, count, skill->get_time(skill_id, skill_lv)));
- } else
+ clif->skill_nodamage(bl, bl, skill_id, skill_lv,
+ sc_start4(src, bl, type, 100, skill_lv, 0, 0, count, skill->get_time(skill_id, skill_lv)));
+ } else if( sd )
party->foreachsamemap(skill->area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id);
break;
case AB_CHEAL:
@@ -8874,7 +8871,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if ( flag&1 )
sc_start2(src,bl,type,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv));
else if ( sd ) {
- int rate = 4 * skill_lv + 2 * (sd ? pc->checkskill(sd,WM_LESSON) : 1) + status->get_lv(src) / 15 + (sd? sd->status.job_level:0) / 5;
+ int rate = 4 * skill_lv + 2 * pc->checkskill(sd,WM_LESSON) + status->get_lv(src)/15 + sd->status.job_level/5;
if ( rnd()%100 < rate ) {
flag |= BCT_PARTY|BCT_GUILD;
map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_NPC|BL_SKILL, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
@@ -8891,7 +8888,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
if( flag&1 ) {
sc_start2(src,bl,type,100,skill_lv,(skill_id==WM_VOICEOFSIREN)?src->id:0,skill->get_time(skill_id,skill_lv));
} else if( sd ) {
- int rate = 6 * skill_lv + (sd ? pc->checkskill(sd,WM_LESSON) : 1) + (sd? sd->status.job_level:0) / 2;
+ int rate = 6 * skill_lv + pc->checkskill(sd,WM_LESSON) + sd->status.job_level/2;
if ( rnd()%100 < rate ) {
flag |= BCT_PARTY|BCT_GUILD;
map->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_NPC|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);