summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 04:07:27 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-30 04:07:27 +0000
commit6343274ad8e270888df854926bc47a0bc5713f47 (patch)
treec33b3baa689b1f352ed75fc57ba7645bd1edce78 /src/map/battle.c
parentcf4023f83aa1e2f5ed3009f0e7d020e387d6ef57 (diff)
downloadhercules-6343274ad8e270888df854926bc47a0bc5713f47.tar.gz
hercules-6343274ad8e270888df854926bc47a0bc5713f47.tar.bz2
hercules-6343274ad8e270888df854926bc47a0bc5713f47.tar.xz
hercules-6343274ad8e270888df854926bc47a0bc5713f47.zip
- 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
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c21
1 files changed, 8 insertions, 13 deletions
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)