diff options
author | Haru <haru@dotalux.com> | 2015-09-08 10:47:22 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-09-08 10:47:22 +0200 |
commit | 4d0c83b84594763e1f14cc5814bd147e36f249fd (patch) | |
tree | 1ad41ca0286152ad6e761bfab8696a81d97ea7a3 /src | |
parent | 860f4eb744af463dd4a0e7d11e7882973ccf1e44 (diff) | |
download | hercules-4d0c83b84594763e1f14cc5814bd147e36f249fd.tar.gz hercules-4d0c83b84594763e1f14cc5814bd147e36f249fd.tar.bz2 hercules-4d0c83b84594763e1f14cc5814bd147e36f249fd.tar.xz hercules-4d0c83b84594763e1f14cc5814bd147e36f249fd.zip |
Fixed a failed assertion in skill_get_ele. Fixes #708
- Thanks to AnisotropicDefixation
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 671d63200..6536e54c4 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3251,24 +3251,27 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam if (skill_id) mob->skill_event((TBL_MOB*)bl,src,timer->gettick(),MSC_SKILLUSED|(skill_id<<16)); } - if( sd ) { - if( pc_ismadogear(sd) && rnd()%100 < 50 ) { - short element = skill->get_ele(skill_id, skill_lv); - if( !skill_id || element == -1 ) { //Take weapon's element - struct status_data *sstatus = NULL; - if( src->type == BL_PC && ((TBL_PC*)src)->bonus.arrow_ele ) - element = ((TBL_PC*)src)->bonus.arrow_ele; - else if( (sstatus = status->get_status_data(src)) ) { - element = sstatus->rhw.ele; - } + if (sd && pc_ismadogear(sd) && rnd()%100 < 50) { + int element = -1; + if (!skill_id || (element = skill->get_ele(skill_id, skill_lv)) == -1) { + // Take weapon's element + struct status_data *sstatus = NULL; + if (src->type == BL_PC && ((TBL_PC*)src)->bonus.arrow_ele) { + element = ((TBL_PC*)src)->bonus.arrow_ele; + } else if ((sstatus = status->get_status_data(src)) != NULL) { + element = sstatus->rhw.ele; } - else if( element == -2 ) //Use enchantment's element - element = status_get_attack_sc_element(src,status->get_sc(src)); - else if( element == -3 ) //Use random element - element = rnd()%ELE_MAX; - if( element == ELE_FIRE || element == ELE_WATER ) - pc->overheat(sd,element == ELE_FIRE ? 1 : -1); - } + } else if (element == -2) { + // Use enchantment's element + element = status_get_attack_sc_element(src,status->get_sc(src)); + } else if (element == -3) { + // Use random element + element = rnd()%ELE_MAX; + } + if (element == ELE_FIRE) + pc->overheat(sd, 1); + else if (element == ELE_WATER) + pc->overheat(sd, -1); } return damage; |