Переглянути джерело

- Fixed battle_calc_base_damage being called for the left hand even for non-dual-wielding attacks. left-hand damage was being set to 0 later anyway, so no exploit existed.
- Moved the weapon_atk_rate bonus to battle_calc_base_damage so that it'll apply correctly when dual-wielding different types of weapons.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8370 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 роки тому
батько
коміт
78296c878c
2 змінених файлів з 20 додано та 6 видалено
  1. 5 0
      Changelog-Trunk.txt
  2. 15 6
      src/map/battle.c

+ 5 - 0
Changelog-Trunk.txt

@@ -4,6 +4,11 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/08/19
+	* Fixed battle_calc_base_damage being called for the left hand even for
+	  non-dual-wielding attacks. left-hand damage was being set to 0 later
+	  anyway, so no exploit existed. [Skotlex]
+	* Moved the weapon_atk_rate bonus to battle_calc_base_damage so that it'll
+	  apply correctly when dual-wielding different types of weapons. [Skotlex]
 	* Fixed job-mask 0x100000 in the item_db enabling Dancers/Bards to use the
 	  items (0x80000 should be for them and 0x100000 should be currently unused)
 	  [Skotlex]

+ 15 - 6
src/map/battle.c

@@ -713,10 +713,19 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk
 		damage += status->batk;
 	
 	//rodatazone says that Overrefine bonuses are part of baseatk
+	//Here we also apply the weapon_atk_rate bonus so it is correctly applied on left/right hands.
 	if(sd) {
-		type = (wa == status->lhw)?sd->left_weapon.overrefine:sd->right_weapon.overrefine;
-		if (type > 0)
-			damage += rand()%type+1;
+		if (type == EQI_HAND_L) {
+			if(sd->left_weapon.overrefine)
+				damage += rand()%sd->left_weapon.overrefine+1;
+			if (sd->weapon_atk_rate[sd->weapontype2])
+				damage += damage*sd->weapon_atk_rate[sd->weapontype2]/100;;
+		} else { //Right hand
+			if(sd->right_weapon.overrefine)
+				damage += rand()%sd->right_weapon.overrefine+1;
+			if (sd->weapon_atk_rate[sd->weapontype1])
+				damage += damage*sd->weapon_atk_rate[sd->weapontype1]/100;;
+		}
 	}
 	return damage;
 }
@@ -1216,7 +1225,7 @@ static struct Damage battle_calc_weapon_attack(
 				  i |= 16; // for ex. shuriken must not be influenced by DEX
 				}
 				wd.damage = battle_calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, sd, i);
-				if (sstatus->lhw)
+				if (sstatus->lhw && flag.lh)
 					wd.damage2 = battle_calc_base_damage(sstatus, sstatus->lhw, sc, tstatus->size, sd, i);
 
 				// Added split damage for Huuma
@@ -1230,8 +1239,8 @@ static struct Damage battle_calc_weapon_attack(
 				//Add any bonuses that modify the base baseatk+watk (pre-skills)
 				if(sd)
 				{
-					if ((sd->atk_rate != 100 || sd->weapon_atk_rate[sd->weapontype1] != 0))
-						ATK_RATE(sd->atk_rate + sd->weapon_atk_rate[sd->weapontype1]);
+					if (sd->atk_rate != 100)
+						ATK_RATE(sd->atk_rate);
 
 					if(flag.cri && sd->crit_atk_rate)
 						ATK_ADDRATE(sd->crit_atk_rate);