summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-29 22:52:10 +0000
committerepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-29 22:52:10 +0000
commitefc39a408c225e1f030b1d21938ad7004b65af96 (patch)
treec7a5a9a7e19d82dd0663d31969c2bb47964f9545 /src/map/battle.c
parentcb54f6e503c6160eb5896088f04dcb75860ef153 (diff)
downloadhercules-efc39a408c225e1f030b1d21938ad7004b65af96.tar.gz
hercules-efc39a408c225e1f030b1d21938ad7004b65af96.tar.bz2
hercules-efc39a408c225e1f030b1d21938ad7004b65af96.tar.xz
hercules-efc39a408c225e1f030b1d21938ad7004b65af96.zip
- Updated the unit engine to cache attacker count rather than utilise CPU intensive block iterations
- This update removes two unofficial settings, nothing that will go amiss git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16011 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 167a040ce..9ea7f5595 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1461,13 +1461,10 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
hitrate = 80; //Default hitrate
#endif
- if(battle_config.agi_penalty_type &&
- battle_config.agi_penalty_target&target->type)
- {
+ if(battle_config.agi_penalty_type && battle_config.agi_penalty_target&target->type) {
unsigned char attacker_count; //256 max targets should be a sane max
- attacker_count = unit_counttargeted(target,battle_config.agi_penalty_count_lv);
- if(attacker_count >= battle_config.agi_penalty_count)
- {
+ attacker_count = unit_counttargeted(target);
+ if(attacker_count >= battle_config.agi_penalty_count) {
if (battle_config.agi_penalty_type == 1)
flee = (flee * (100 - (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
else //asume type 2: absolute reduction
@@ -2507,10 +2504,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo
}
}
- if( battle_config.vit_penalty_type && battle_config.vit_penalty_target&target->type )
- {
+ if( battle_config.vit_penalty_type && battle_config.vit_penalty_target&target->type ) {
unsigned char target_count; //256 max targets should be a sane max
- target_count = unit_counttargeted(target,battle_config.vit_penalty_count_lv);
+ target_count = unit_counttargeted(target);
if(target_count >= battle_config.vit_penalty_count) {
if(battle_config.vit_penalty_type == 1) {
if( !tsc || !tsc->data[SC_STEELBODY] )
@@ -3920,11 +3916,9 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
hitrate = 80; //Default hitrate
#endif
- if(battle_config.agi_penalty_type &&
- battle_config.agi_penalty_target&target->type)
- {
+ if(battle_config.agi_penalty_type && battle_config.agi_penalty_target&target->type) {
unsigned char attacker_count; //256 max targets should be a sane max
- attacker_count = unit_counttargeted(target,battle_config.agi_penalty_count_lv);
+ attacker_count = unit_counttargeted(target);
if(attacker_count >= battle_config.agi_penalty_count)
{
if (battle_config.agi_penalty_type == 1)
@@ -5040,12 +5034,10 @@ static const struct _battle_data {
{ "agi_penalty_type", &battle_config.agi_penalty_type, 1, 0, 2, },
{ "agi_penalty_count", &battle_config.agi_penalty_count, 3, 2, INT_MAX, },
{ "agi_penalty_num", &battle_config.agi_penalty_num, 10, 0, INT_MAX, },
- { "agi_penalty_count_lv", &battle_config.agi_penalty_count_lv, ATK_FLEE, 0, INT_MAX, },
{ "vit_penalty_target", &battle_config.vit_penalty_target, BL_PC, BL_NUL, BL_ALL, },
{ "vit_penalty_type", &battle_config.vit_penalty_type, 1, 0, 2, },
{ "vit_penalty_count", &battle_config.vit_penalty_count, 3, 2, INT_MAX, },
{ "vit_penalty_num", &battle_config.vit_penalty_num, 5, 0, INT_MAX, },
- { "vit_penalty_count_lv", &battle_config.vit_penalty_count_lv, ATK_MISS, 0, INT_MAX, },
{ "weapon_defense_type", &battle_config.weapon_defense_type, 0, 0, INT_MAX, },
{ "magic_defense_type", &battle_config.magic_defense_type, 0, 0, INT_MAX, },
{ "skill_reiteration", &battle_config.skill_reiteration, BL_NUL, BL_NUL, BL_ALL, },