Explorar el Código

- Added A_* constants to identify ammo types.
- Added Ishizu's code to check ammo type on attack. No more using Grenade rounds with Guns.


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

skotlex hace 19 años
padre
commit
fa591ce109
Se han modificado 3 ficheros con 48 adiciones y 3 borrados
  1. 2 0
      Changelog-Trunk.txt
  2. 37 3
      src/map/battle.c
  3. 9 0
      src/map/pc.h

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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/07/28
+	* Added Ishizu's code to check ammo type on attack. No more using Grenade
+	  rounds with Guns. [Skotlex]
 	* offensive heal/sanctuary will only happen when the source of the heal is
 	  a player, mob/pet casted heal will now always heal regardless of target.
 	  [Skotlex]

+ 37 - 3
src/map/battle.c

@@ -2854,9 +2854,43 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
 	if (sd)
 	{
 		sd->state.arrow_atk = (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE));
-		if (sd->state.arrow_atk && sd->equip_index[10]<0) {
-			clif_arrow_fail(sd,0);
-			return 0;
+		if (sd->state.arrow_atk)
+		{	//Recycled damage variable to store index.
+			damage = sd->equip_index[EQI_AMMO];
+			if (damage<0) {
+				clif_arrow_fail(sd,0);
+				return 0;
+			}
+			//Ammo check by Ishizu-chan
+			if (sd->inventory_data[damage])
+			switch (sd->status.weapon) {
+			case W_BOW:
+				if (sd->inventory_data[damage]->look != A_ARROW) {
+					clif_arrow_fail(sd,0);
+					return 0;
+				}
+			break;
+			case W_REVOLVER:
+			case W_RIFLE:
+			case W_GATLING:
+				if (sd->inventory_data[damage]->look != A_BULLET) {
+					clif_arrow_fail(sd,0);
+					return 0;
+				}
+			break;
+			case W_SHOTGUN:
+				if (sd->inventory_data[damage]->look != A_SHELL) {
+					clif_arrow_fail(sd,0);
+					return 0;
+				}
+			break;
+			case W_GRENADE:
+				if (sd->inventory_data[damage]->look != A_GRENADE) {
+					clif_arrow_fail(sd,0);
+					return 0;
+				}
+			break;
+			}
 		}
 	}
 

+ 9 - 0
src/map/pc.h

@@ -40,6 +40,15 @@ enum {
 	MAX_WEAPON_TYPE
 } weapon_type;
 
+enum {
+	A_ARROW = 1,
+	A_DAGGER,    //2
+	A_BULLET,   //3
+	A_SHELL,    //4
+	A_GRENADE,  //5
+	A_SHURIKEN, //6
+	A_KUNAI     //7
+} ammo_type;
 //Equip position constants
 enum {
 	EQP_HEAD_LOW = 0x0001,