summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-19 15:19:25 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-19 15:19:25 +0000
commitd6aa899bd3508d34b569f5745afb08fe97593b20 (patch)
tree00fe59b73270e82e8a10521fcde1c710adfe198a /src/map/battle.c
parentead9663ed875ca0c3e64ebe5f9a5dd6004b2abbc (diff)
downloadhercules-d6aa899bd3508d34b569f5745afb08fe97593b20.tar.gz
hercules-d6aa899bd3508d34b569f5745afb08fe97593b20.tar.bz2
hercules-d6aa899bd3508d34b569f5745afb08fe97593b20.tar.xz
hercules-d6aa899bd3508d34b569f5745afb08fe97593b20.zip
- Some cleanups and corrections in battle.c to account for negative (absorbed) damage.
- Fixed umbala.txt's Elemental Stones Quest bug. Thanks to Vhan Morthis. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7250 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 85a8310e0..357e169e3 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -232,8 +232,8 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
nullpo_retr(0, bl);
- if (damage <= 0)
- return 0;
+ if (damage <= 0) //No reductions to make.
+ return damage;
if (bl->type == BL_MOB) {
md=(struct mob_data *)bl;
@@ -457,8 +457,8 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
struct mob_data *md = NULL;
int class_;
- if (damage <= 0)
- return 0;
+ if (damage <= 0) //No reductions to make.
+ return damage;
class_ = status_get_class(bl);
@@ -1720,7 +1720,7 @@ static struct Damage battle_calc_weapon_attack(
}
}
- if ((!flag.rh || wd.damage == 0) && (!flag.lh || wd.damage2 == 0))
+ if ((!flag.rh || !wd.damage) && (!flag.lh || !wd.damage2))
flag.cardfix = 0; //When the attack does no damage, avoid doing %bonuses
if (sd)
@@ -1877,13 +1877,13 @@ static struct Damage battle_calc_weapon_attack(
flag.lh=0;
} else if(sd->status.weapon > MAX_WEAPON_TYPE)
{ //Dual-wield
- if (wd.damage > 0)
+ if (wd.damage)
{
skill = pc_checkskill(sd,AS_RIGHT);
wd.damage = wd.damage * (50 + (skill * 10))/100;
if(wd.damage < 1) wd.damage = 1;
}
- if (wd.damage2 > 0)
+ if (wd.damage2)
{
skill = pc_checkskill(sd,AS_LEFT);
wd.damage2 = wd.damage2 * (30 + (skill * 10))/100;
@@ -1894,7 +1894,7 @@ static struct Damage battle_calc_weapon_attack(
skill = pc_checkskill(sd,TF_DOUBLE);
wd.damage2 = wd.damage * (1 + (skill * 2))/100;
- if(wd.damage > 0 && wd.damage2 < 1) wd.damage2 = 1;
+ if(wd.damage && !wd.damage2) wd.damage2 = 1;
flag.lh = 1;
}
}
@@ -1907,11 +1907,12 @@ static struct Damage battle_calc_weapon_attack(
if(wd.damage > 0 || wd.damage2 > 0)
{
- if(wd.damage2<1) {
+ if(!wd.damage2) {
wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
if (map_flag_gvg(target->m))
wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
- } else if(wd.damage<1) {
+ } else
+ if(!wd.damage) {
wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
if (map_flag_gvg(target->m))
wd.damage2=battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
@@ -1949,7 +1950,7 @@ static struct Damage battle_calc_weapon_attack(
}
}
- if (wd.damage > 0 || wd.damage2 > 0) {
+ if (wd.damage || wd.damage2) {
if (sd && battle_config.equip_self_break_rate)
{ // Self weapon breaking
int breakrate = battle_config.equip_natural_break_rate;
@@ -2360,8 +2361,8 @@ struct Damage battle_calc_magic_attack(
damage_div_fix(ad.damage, ad.div_);
- if (flag.infdef && ad.damage > 0)
- ad.damage = 1;
+ if (flag.infdef && ad.damage)
+ ad.damage/= ad.damage; //Why this? Because, well, if damage is absorbed, it should heal 1, not do 1 dmg.
ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
if (map_flag_gvg(target->m))