summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/battle.c37
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;