From 6343274ad8e270888df854926bc47a0bc5713f47 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 30 May 2006 04:07:27 +0000 Subject: - Changed status_heal and status_damage to receive signed int values. They will invoke each other as needed when the passed values are negative. - Updated battle_calc_attack to set atk type to ATK_FLEE and dmotion to 0 when the damage is less than 1 (missed or absorbed) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6832 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index 52e82ce9f..0287fb8f8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1970,6 +1970,7 @@ static struct Damage battle_calc_weapon_attack( mob_class_change(tmd,class_); } } + if (wd.damage > 0 || wd.damage2 > 0) { if (sd && battle_config.equip_self_break_rate) { // Self weapon breaking @@ -2392,8 +2393,6 @@ struct Damage battle_calc_magic_attack( ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); if (map_flag_gvg(target->m)) ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); - if (ad.damage == 0) //Magic attack blocked? Consider it a miss so it doesn't invokes additional effects. [Skotlex] - ad.dmg_lv = ATK_FLEE; return ad; } @@ -2632,7 +2631,7 @@ struct Damage battle_calc_misc_attack( md.damage=battle_calc_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); if (map_flag_gvg(target->m)) md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); - + return md; } /*========================================== @@ -2659,6 +2658,11 @@ struct Damage battle_calc_attack( int attack_type, memset(&d,0,sizeof(d)); break; } + if (d.damage + d.damage2 < 1 && d.dmg_lv != ATK_LUCKY) + { //Miss/Absorbed + d.dmg_lv = ATK_FLEE; + d.dmotion = 0; + } return d; } @@ -2744,16 +2748,7 @@ void battle_drain(TBL_PC *sd, TBL_PC* tsd, int rdamage, int ldamage, int race, i if (!thp && !tsp) return; //Split'em up as Hp/Sp could be drained/leeched. - if(thp> 0) - status_heal(&sd->bl, thp, 0, battle_config.show_hp_sp_drain?3:1); - else if (thp < 0) - status_zap(&sd->bl, thp, 0); - - if(tsp > 0) - status_heal(&sd->bl, 0, tsp, battle_config.show_hp_sp_drain?3:1); - else if (tsp < 0) - status_zap(&sd->bl, 0, tsp); - + status_heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1); if (tsd) { if (rhp || rsp) -- cgit v1.2.3-70-g09d2