summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-19 18:54:30 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-19 18:54:30 +0000
commit149fe5b74b8567b4720111e96a283f5e938e5631 (patch)
tree4ffb2ef120003a63d2d951dae3bf60189ef09698 /src/map/battle.c
parent49c3ba9aa1f9e52bdf0fe6756637c52bf686c84a (diff)
downloadhercules-149fe5b74b8567b4720111e96a283f5e938e5631.tar.gz
hercules-149fe5b74b8567b4720111e96a283f5e938e5631.tar.bz2
hercules-149fe5b74b8567b4720111e96a283f5e938e5631.tar.xz
hercules-149fe5b74b8567b4720111e96a283f5e938e5631.zip
- Some more cleanups of battle_calc_damage to account for absorbed damage reductions.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7254 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 357e169e3..b2be1e295 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) //No reductions to make.
- return damage;
+ if (!damage)
+ return 0;
if (bl->type == BL_MOB) {
md=(struct mob_data *)bl;
@@ -254,15 +254,13 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
//First, sc_*'s that reduce damage to 0.
if (sc->data[SC_SAFETYWALL].timer!=-1 && flag&BF_SHORT && (skill_num != NPC_GUIDEDATTACK && skill_num != AM_DEMONSTRATION)
) {
- // セ?[フティウォ?[ル
struct skill_unit_group *group = (struct skill_unit_group *)sc->data[SC_SAFETYWALL].val3;
if (group) {
if (--group->val2<=0)
skill_delunitgroup(NULL,group);
return 0;
- } else {
- status_change_end(bl,SC_SAFETYWALL,-1);
}
+ status_change_end(bl,SC_SAFETYWALL,-1);
}
if(sc->data[SC_LANDPROTECTOR].timer!=-1 && flag&BF_MAGIC)
@@ -376,7 +374,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
}
//Finally Kyrie because it may, or not, reduce damage to 0.
- if(sc->data[SC_KYRIE].timer!=-1){
+ if(sc->data[SC_KYRIE].timer!=-1 && damage > 0){
sci=&sc->data[SC_KYRIE];
sci->val2-=damage;
if(flag&BF_WEAPON || skill_num == TF_THROWSTONE){
@@ -396,7 +394,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
if(flag&BF_MAGIC && sd && sd->special_state.no_magic_damage)
damage -= damage*sd->special_state.no_magic_damage/100;
- if (damage <= 0) return 0;
+ if (!damage) return 0;
}
//SC effects from caster side.
@@ -411,7 +409,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
}
}
- if (battle_config.pk_mode && sd && damage > 0)
+ if (battle_config.pk_mode && sd && damage)
{
if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
if (flag&BF_WEAPON)
@@ -426,7 +424,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
if (flag & BF_LONG)
damage = damage * battle_config.pk_long_damage_rate/100;
}
- if(damage < 1) damage = 1;
+ if(!damage) damage = 1;
}
if(battle_config.skill_min_damage && damage > 0 && damage < div_)
@@ -457,8 +455,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) //No reductions to make.
- return damage;
+ if (!damage) //No reductions to make.
+ return 0;
class_ = status_get_class(bl);
@@ -511,7 +509,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama
if (flag & BF_LONG)
damage = damage * battle_config.gvg_long_damage_rate/100;
}
- if(damage < 1) damage = 1;
+ if(!damage) damage = 1;
}
return damage;
}