diff options
Diffstat (limited to 'src/map/battle.c')
-rw-r--r-- | src/map/battle.c | 83 |
1 files changed, 36 insertions, 47 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 76b74a766..879776871 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3263,30 +3263,8 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam } } /* no data claims these settings affect anything other than players */ - if( damage && t_sd && bl->type == BL_PC ) { - switch( skill_id ) { - //case PA_PRESSURE: /* pressure also belongs to this list but it doesn't reach this area -- so don't worry about it */ - case HW_GRAVITATION: - case NJ_ZENYNAGE: - case KO_MUCHANAGE: - break; - default: - if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex] - if (flag&BF_WEAPON) - damage = damage * map->list[bl->m].weapon_damage_rate / 100; - if (flag&BF_MAGIC) - damage = damage * map->list[bl->m].magic_damage_rate / 100; - if (flag&BF_MISC) - damage = damage * map->list[bl->m].misc_damage_rate / 100; - } else { //Normal attacks get reductions based on range. - if (flag & BF_SHORT) - damage = damage * map->list[bl->m].short_damage_rate / 100; - if (flag & BF_LONG) - damage = damage * map->list[bl->m].long_damage_rate / 100; - } - if(!damage) damage = 1; - break; - } + if (damage && t_sd && bl->type == BL_PC) { + damage = battle->calc_pc_damage(src, bl, d, damage, skill_id, skill_lv); } if(battle_config.skill_min_damage && damage > 0 && damage < div_) @@ -3331,6 +3309,37 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam return damage; } +int64 battle_calc_pc_damage(struct block_list *src, struct block_list *bl, struct Damage *d, int64 damage, uint16 skill_id, uint16 skill_lv) +{ + int flag = d->flag; + + switch (skill_id) { + //case PA_PRESSURE: /* pressure also belongs to this list but it doesn't reach this area -- so don't worry about it */ + case HW_GRAVITATION: + case NJ_ZENYNAGE: + case KO_MUCHANAGE: + break; + default: + if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex] + if (flag & BF_WEAPON) + damage = damage * map->list[bl->m].weapon_damage_rate / 100; + if (flag & BF_MAGIC) + damage = damage * map->list[bl->m].magic_damage_rate / 100; + if (flag & BF_MISC) + damage = damage * map->list[bl->m].misc_damage_rate / 100; + } else { //Normal attacks get reductions based on range. + if (flag & BF_SHORT) + damage = damage * map->list[bl->m].short_damage_rate / 100; + if (flag & BF_LONG) + damage = damage * map->list[bl->m].long_damage_rate / 100; + } + if (!damage) + damage = 1; + break; + } + return damage; +} + /*========================================== * Calculates BG related damage adjustments. *------------------------------------------*/ @@ -6269,17 +6278,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t sp = skill->get_sp(skill_id,skill_lv) * 2 / 3; if (status->charge(src, 0, sp)) { - switch (skill->get_casttype(skill_id)) { - case CAST_GROUND: - skill->castend_pos2(src, target->x, target->y, skill_id, skill_lv, tick, flag); - break; - case CAST_NODAMAGE: - skill->castend_nodamage_id(src, target, skill_id, skill_lv, tick, flag); - break; - case CAST_DAMAGE: - skill->castend_damage_id(src, target, skill_id, skill_lv, tick, flag); - break; - } + skill->castend_type(skill->get_casttype(skill_id), src, target, skill_id, skill_lv, tick, flag); } } if (sd) { @@ -6325,19 +6324,8 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t sd->state.autocast = 1; skill->consume_requirement(sd,r_skill,r_lv,3); - switch( type ) { - case CAST_GROUND: - skill->castend_pos2(src, target->x, target->y, r_skill, r_lv, tick, flag); - break; - case CAST_NODAMAGE: - skill->castend_nodamage_id(src, target, r_skill, r_lv, tick, flag); - break; - case CAST_DAMAGE: - skill->castend_damage_id(src, target, r_skill, r_lv, tick, flag); - break; - } + skill->castend_type(type, src, target, r_skill, r_lv, tick, flag); sd->state.autocast = 0; - sd->ud.canact_tick = tick + skill->delay_fix(src, r_skill, r_lv); clif->status_change(src, SI_POSTDELAY, 1, skill->delay_fix(src, r_skill, r_lv), 0, 0, 1); } @@ -7611,6 +7599,7 @@ void battle_defaults(void) { battle->calc_attack = battle_calc_attack; battle->calc_damage = battle_calc_damage; + battle->calc_pc_damage = battle_calc_pc_damage; battle->calc_gvg_damage = battle_calc_gvg_damage; battle->calc_bg_damage = battle_calc_bg_damage; battle->weapon_attack = battle_weapon_attack; |