diff options
author | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-05-13 12:17:19 +0000 |
---|---|---|
committer | Inkfish <Inkfish@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-05-13 12:17:19 +0000 |
commit | 8c84f301bd7495fd673275b90102d1fdbcc56e80 (patch) | |
tree | a06dba05fe39ec8dc4e493c342bedb44800e79ea /src | |
parent | 457e938b26c03a271c88ef768bd3d88d9f81e3fa (diff) | |
download | hercules-8c84f301bd7495fd673275b90102d1fdbcc56e80.tar.gz hercules-8c84f301bd7495fd673275b90102d1fdbcc56e80.tar.bz2 hercules-8c84f301bd7495fd673275b90102d1fdbcc56e80.tar.xz hercules-8c84f301bd7495fd673275b90102d1fdbcc56e80.zip |
* Sorry for taking 3 steps for this ugly code. Please take it as a compromise since we do not have enough info to emulate how Aegis does.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13769 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 2153cea84..84e711dc6 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2140,8 +2140,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo { //There is a total damage value if(!wd.damage2) { - wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); - if( wd.damage == -1 ) + bool flag = (wd.damage > 0); + wd.damage = battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + if( flag && wd.damage == -1 ) { wd.flag |= 0xf000; wd.damage = 0; @@ -2153,32 +2154,35 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } else if(!wd.damage) { - wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); - if( wd.damage2 == -1 ) + bool flag = (wd.damage2 > 0); + wd.damage2 = battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); + if( flag && wd.damage2 == -1 ) { wd.flag |= 0xf000; wd.damage2 = 0; } if( map_flag_gvg2(target->m) ) - wd.damage2=battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); else if( map[target->m].flag.battleground ) - wd.damage=battle_calc_bg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage = battle_calc_bg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag); } else { - int d1=wd.damage+wd.damage2,d2=wd.damage2; - wd.damage=battle_calc_damage(src,target,d1,wd.div_,skill_num,skill_lv,wd.flag); - if( wd.damage == -1 ) + int d1 = wd.damage + wd.damage2,d2 = wd.damage2; + bool flag; + flag = (d1 > 0); + wd.damage = battle_calc_damage(src,target,d1,wd.div_,skill_num,skill_lv,wd.flag); + if( flag && wd.damage == -1 ) { wd.flag |= 0xf000; wd.damage = 0; } if( map_flag_gvg2(target->m) ) - wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); else if( map[target->m].flag.battleground ) - wd.damage=battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); - wd.damage2=(d2*100/d1)*wd.damage/100; - if(wd.damage > 1 && wd.damage2 < 1) wd.damage2=1; + wd.damage = battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag); + wd.damage2 = (d2*100/d1)*wd.damage/100; + if(wd.damage > 1 && wd.damage2 < 1) wd.damage2 = 1; wd.damage-=wd.damage2; } } @@ -2573,12 +2577,15 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list if (flag.infdef && ad.damage) ad.damage = ad.damage>0?1:-1; - - ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); - if( ad.damage == -1 ) + { - ad.flag |= 0xf000; - ad.damage = 0; + bool flag = (ad.damage > 0); + ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); + if( flag && ad.damage == -1 ) + { + ad.flag |= 0xf000; + ad.damage = 0; + } } if( map_flag_gvg2(target->m) ) ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); @@ -2808,11 +2815,14 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * if(!(nk&NK_NO_ELEFIX)) md.damage=battle_attr_fix(src, target, md.damage, s_ele, tstatus->def_ele, tstatus->ele_lv); - md.damage=battle_calc_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); - if( md.damage == -1 ) { - md.flag |= 0xf000; - md.damage = 0; + bool flag = (md.damage > 0); + md.damage=battle_calc_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); + if( flag && md.damage == -1 ) + { + md.flag |= 0xf000; + md.damage = 0; + } } if( map_flag_gvg2(target->m) ) md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag); |