Browse Source

* Fixed killed monsters were assumed to be killed by homunculus only, if no damage log entries were elligible for exp distribution, even when no homunculus took part in damage dealing (bugreport:4452, since r12203).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14588 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei 14 years ago
parent
commit
23ac179cf0
2 changed files with 13 additions and 5 deletions
  1. 1 0
      Changelog-Trunk.txt
  2. 12 5
      src/map/mob.c

+ 1 - 0
Changelog-Trunk.txt

@@ -1,6 +1,7 @@
 Date	Added
 Date	Added
 
 
 2010/12/12
 2010/12/12
+	* Fixed killed monsters were assumed to be killed by homunculus only, if no damage log entries were elligible for exp distribution, even when no homunculus took part in damage dealing (bugreport:4452, since r12203).
 	* Added enumeration for monster damage log field 'flag'. [Ai4rei]
 	* Added enumeration for monster damage log field 'flag'. [Ai4rei]
 	* Removed disabled backup of script command 'isequipped' (since r1605). [Ai4rei]
 	* Removed disabled backup of script command 'isequipped' (since r1605). [Ai4rei]
 	* Made script engine's DEBUG_DISASM block use script_op2name, rather than hardcoding operator names as per TODO from r13083 (related r9569, follow up to r10667). [Ai4rei]
 	* Made script engine's DEBUG_DISASM block use script_op2name, rather than hardcoding operator names as per TODO from r13083 (related r9569, follow up to r10667). [Ai4rei]

+ 12 - 5
src/map/mob.c

@@ -1959,9 +1959,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		unsigned int base_exp,job_exp;
 		unsigned int base_exp,job_exp;
 	} pt[DAMAGELOG_SIZE];
 	} pt[DAMAGELOG_SIZE];
 	int i,temp,count,pnum=0,m=md->bl.m;
 	int i,temp,count,pnum=0,m=md->bl.m;
+	int dmgbltypes = 0;  // bitfield of all bl types, that caused damage to the mob and are elligible for exp distribution
 	unsigned int mvp_damage, tick = gettick();
 	unsigned int mvp_damage, tick = gettick();
-	unsigned short flaghom = 1; // [Zephyrus] Does the mob only received damage from homunculus?
-	bool rebirth;
+	bool rebirth, homkillonly;
 
 
 	status = &md->status;
 	status = &md->status;
 
 
@@ -2036,10 +2036,17 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 
 
 		tmpsd[i] = tsd; // record as valid damage-log entry
 		tmpsd[i] = tsd; // record as valid damage-log entry
 
 
-		if(!md->dmglog[i].flag == MDLF_HOMUN && flaghom)
-			flaghom = 0; // Damage received from other Types != Homunculus
+		switch( md->dmglog[i].flag )
+		{
+			case MDLF_NORMAL: dmgbltypes|= BL_PC;  break;
+			case MDLF_HOMUN:  dmgbltypes|= BL_HOM; break;
+			case MDLF_PET:    dmgbltypes|= BL_PET; break;
+		}
 	}
 	}
 
 
+	// determines, if the monster was killed by homunculus' damage only
+	homkillonly = (bool)( ( dmgbltypes&BL_HOM ) && !( dmgbltypes&~BL_HOM ) );
+
 	if(!battle_config.exp_calc_type && count > 1)
 	if(!battle_config.exp_calc_type && count > 1)
 	{	//Apply first-attacker 200% exp share bonus
 	{	//Apply first-attacker 200% exp share bonus
 		//TODO: Determine if this should go before calculating the MVP player instead of after.
 		//TODO: Determine if this should go before calculating the MVP player instead of after.
@@ -2240,7 +2247,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			}
 			}
 			// Announce first, or else ditem will be freed. [Lance]
 			// Announce first, or else ditem will be freed. [Lance]
 			// By popular demand, use base drop rate for autoloot code. [Skotlex]
 			// By popular demand, use base drop rate for autoloot code. [Skotlex]
-			mob_item_drop(md, dlist, ditem, 0, md->db->dropitem[i].p, flaghom);
+			mob_item_drop(md, dlist, ditem, 0, md->db->dropitem[i].p, homkillonly);
 		}
 		}
 
 
 		// Ore Discovery [Celest]
 		// Ore Discovery [Celest]