summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-12-11 02:44:00 +0100
committerHaru <haru@dotalux.com>2017-08-17 03:08:14 +0200
commit36bfce24b6cdb1416f85ef246fbcd6523a30f1dd (patch)
tree96e4db44017cb5ca7c16bce4bf0e5c12a6004047 /src/map/battle.c
parent2357990ccea2f622992bc1d424eda30cd77ef082 (diff)
downloadhercules-36bfce24b6cdb1416f85ef246fbcd6523a30f1dd.tar.gz
hercules-36bfce24b6cdb1416f85ef246fbcd6523a30f1dd.tar.bz2
hercules-36bfce24b6cdb1416f85ef246fbcd6523a30f1dd.tar.xz
hercules-36bfce24b6cdb1416f85ef246fbcd6523a30f1dd.zip
Remove separate cardfix definition for pre-re/re
Cardfix is now always calculated in thousandths (it previously was in hundredths in renewal mode only). The variable size is increased to int (from short), to ensure that no overflows occur in case of large multipliers. This doesn't change the game mechanics (barring some minor truncation issues that would previously occur due to the lack of precision in renewal) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index b5ad62407..ab3b0f0eb 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -993,11 +993,7 @@ int64 battle_calc_cardfix2(struct block_list *src, struct block_list *bl, int64
// FIXME: wflag is undocumented
int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int64 damage, int cflag, int wflag){
struct map_session_data *sd, *tsd;
-#ifdef RENEWAL
- short cardfix = 100;
-#else
- short cardfix = 1000;
-#endif
+ int cardfix = 1000;
short t_class, s_class, s_race2, t_race2;
struct status_data *sstatus, *tstatus;
int i;
@@ -1073,24 +1069,14 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_
if( tsd->sc.data[SC_PROTECT_MDEF] )
cardfix = cardfix * ( 100 - tsd->sc.data[SC_PROTECT_MDEF]->val1 ) / 100;
}
-#ifdef RENEWAL
- if ( cardfix != 100 )
- damage += damage * (cardfix - 100) / 100;
-#else
if ( cardfix != 1000 )
damage = damage * cardfix / 1000;
-#endif
break;
case BF_WEAPON:
t_race2 = status->get_race2(target);
if( cflag&2 ){
if( sd && !(nk&NK_NO_CARDFIX_ATK) ){
- short cardfix_ =
-#ifdef RENEWAL
- 100;
-#else
- 1000;
-#endif
+ int cardfix_ = 1000;
if( sd->state.arrow_atk ){
cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->arrow_addrace[tstatus->race]) / 100;
if( !(nk&NK_NO_ELEFIX) ){
@@ -1190,16 +1176,11 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_
#ifndef RENEWAL
if( wflag&BF_LONG )
cardfix = cardfix * (100 + sd->bonus.long_attack_atk_rate) / 100;
+#endif
if( (cflag&1) && cardfix_ != 1000 )
damage = damage * cardfix_ / 1000;
else if( cardfix != 1000 )
damage = damage * cardfix / 1000;
-#else
- if ((cflag & 1) && cardfix_ != 100)
- damage += damage * (cardfix_ - 100) / 100;
- else if (cardfix != 100)
- damage += damage * (cardfix - 100) / 100;
-#endif
}
}else{
// Target side
@@ -1249,13 +1230,8 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_
#endif
if( tsd->sc.data[SC_PROTECT_DEF] )
cardfix = cardfix * (100 - tsd->sc.data[SC_PROTECT_DEF]->val1) / 100;
-#ifdef RENEWAL
- if ( cardfix != 100 )
- damage += damage * (cardfix - 100) / 100;
-#else
if( cardfix != 1000 )
damage = damage * cardfix / 1000;
-#endif
}
}
break;
@@ -1287,13 +1263,8 @@ int64 battle_calc_cardfix(int attack_type, struct block_list *src, struct block_
cardfix = cardfix*(100 - tsd->subsize[sstatus->size]) / 100;
cardfix = cardfix*(100 - tsd->subrace2[s_race2]) / 100;
cardfix = cardfix * (100 - tsd->bonus.misc_def_rate) / 100;
-#ifdef RENEWAL
- if ( cardfix != 100 )
- damage += damage * (cardfix - 100) / 100;
-#else
if ( cardfix != 1000 )
damage = damage * cardfix / 1000;
-#endif
}
break;
}