summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-04 05:21:17 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-04 05:21:17 +0000
commitff35e6448d38510b727c2f381260aac9969cf784 (patch)
tree011daac6cd85456ced50662ed32e0db7e33affd8 /src/map/battle.c
parent4e909b3f50b8a3750dc8af9075a763aafc2088a6 (diff)
downloadhercules-ff35e6448d38510b727c2f381260aac9969cf784.tar.gz
hercules-ff35e6448d38510b727c2f381260aac9969cf784.tar.bz2
hercules-ff35e6448d38510b727c2f381260aac9969cf784.tar.xz
hercules-ff35e6448d38510b727c2f381260aac9969cf784.zip
- Removed usage of MAX_PC_BONUS all over the code, it is now only used in map.h (this is done so that individual bonuses can have their array length modified without having to change all the other bonuses as well).
- Removed bonus bAddDamageByClass since it is not needed, and implemented bAddDefClass which can be used for the same (but previously was doing nothing). - Cleaned up the weapon_data structure to use a sub-structure to hold the add_dmg information. - Cleaned up some of the add dmg/def bonuses so the 'count' variable is not needed anymore. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11121 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 4ec4e652d..93bc5e1d0 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -817,7 +817,7 @@ static int battle_blewcount_bonus(struct map_session_data *sd, int skill_num)
if (!sd->skillblown[0].id)
return 0;
//Apply the bonus blewcount. [Skotlex]
- for (i = 0; i < MAX_PC_BONUS && sd->skillblown[i].id; i++) {
+ for (i = 0; i < ARRAYLENGTH(sd->skillblown) && sd->skillblown[i].id; i++) {
if (sd->skillblown[i].id == skill_num)
return sd->skillblown[i].val;
}
@@ -1871,18 +1871,18 @@ static struct Damage battle_calc_weapon_attack(
}
}
- for(i=0;i<sd->right_weapon.add_damage_class_count;i++) {
- if(sd->right_weapon.add_damage_classid[i] == t_class) {
- cardfix=cardfix*(100+sd->right_weapon.add_damage_classrate[i])/100;
+ for(i=0;i<ARRAYLENGTH(sd->right_weapon.add_dmg) && sd->right_weapon.add_dmg[i].rate;i++) {
+ if(sd->right_weapon.add_dmg[i].class_ == t_class) {
+ cardfix=cardfix*(100+sd->right_weapon.add_dmg[i].rate)/100;
break;
}
}
if (flag.lh)
{
- for(i=0;i<sd->left_weapon.add_damage_class_count;i++) {
- if(sd->left_weapon.add_damage_classid[i] == t_class) {
- cardfix_=cardfix_*(100+sd->left_weapon.add_damage_classrate[i])/100;
+ for(i=0;i<ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate;i++) {
+ if(sd->left_weapon.add_dmg[i].class_ == t_class) {
+ cardfix_=cardfix_*(100+sd->left_weapon.add_dmg[i].rate)/100;
break;
}
}
@@ -1923,10 +1923,9 @@ static struct Damage battle_calc_weapon_attack(
cardfix=cardfix*(100-tsd->subrace2[s_race2])/100;
cardfix=cardfix*(100-tsd->subrace[sstatus->race])/100;
cardfix=cardfix*(100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS])/100;
-
- for(i=0;i<tsd->add_dmg_count;i++) {
- if(tsd->add_dmg[i].class_ == s_class) {
- cardfix=cardfix*(100+tsd->add_dmg[i].rate)/100;
+ for(i=0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++) {
+ if(tsd->add_def[i].class_ == s_class) {
+ cardfix=cardfix*(100-tsd->add_def[i].rate)/100;
break;
}
}
@@ -2379,7 +2378,7 @@ struct Damage battle_calc_magic_attack(
cardfix=cardfix*(100+sd->magic_addele[tstatus->def_ele])/100;
cardfix=cardfix*(100+sd->magic_addsize[tstatus->size])/100;
cardfix=cardfix*(100+sd->magic_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100;
- for(i=0;i<sd->add_mdmg_count;i++) {
+ for(i=0; i< ARRAYLENGTH(sd->add_mdmg) && sd->add_mdmg[i].rate;i++) {
if(sd->add_mdmg[i].class_ == t_class) {
cardfix=cardfix*(100+sd->add_mdmg[i].rate)/100;
continue;
@@ -2401,10 +2400,10 @@ struct Damage battle_calc_magic_attack(
cardfix=cardfix*(100-tsd->subrace2[s_race2])/100;
cardfix=cardfix*(100-tsd->subrace[sstatus->race])/100;
cardfix=cardfix*(100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS])/100;
- for(i=0;i<tsd->add_mdef_count;i++) {
+ for(i=0; i < ARRAYLENGTH(tsd->add_mdef) && tsd->add_mdef[i].rate;i++) {
if(tsd->add_mdef[i].class_ == s_class) {
cardfix=cardfix*(100-tsd->add_mdef[i].rate)/100;
- continue;
+ break;
}
}
//It was discovered that ranged defense also counts vs magic! [Skotlex]