Forráskód Böngészése

* Fixed the logged damage from pets doesn't count when 'pet_attack_exp_to_master' is inactive.
* Uncommented the codes that stop pc_bleeding when dead (shouldn't have been commented out.....)

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

Inkfish 15 éve
szülő
commit
96c3de31a6
3 módosított fájl, 22 hozzáadás és 16 törlés
  1. 19 13
      src/map/mob.c
  2. 1 1
      src/map/mob.h
  3. 2 2
      src/map/pc.c

+ 19 - 13
src/map/mob.c

@@ -1837,14 +1837,13 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
 		case BL_PET:
 		{
 			struct pet_data *pd = (TBL_PET*)src;
-			if( battle_config.pet_attack_exp_to_master && pd->msd )
+			flag = 2;
+			if( pd->msd )
 			{
 				char_id = pd->msd->status.char_id;
-				damage = (damage*battle_config.pet_attack_exp_rate)/100; //Modify logged damage accordingly.
+				if( damage ) //Let mobs retaliate against the pet's master [Skotlex]
+					md->attacked_id = pd->msd->bl.id;
 			}
-			//Let mobs retaliate against the pet's master [Skotlex]
-			if( pd->msd && damage )
-				md->attacked_id = pd->msd->bl.id;
 			break;
 		}
 		case BL_MOB:
@@ -2014,8 +2013,10 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		count++; //Only logged into same map chars are counted for the total.
 		if (pc_isdead(tsd))
 			continue; // skip dead players
-		if(md->dmglog[i].flag && !merc_is_hom_active(tsd->hd))
+		if(md->dmglog[i].flag == 1 && !merc_is_hom_active(tsd->hd))
 			continue; // skip homunc's share if inactive
+		if( md->dmglog[i].flag == 2 && (!tsd->status.pet_id || !tsd->pd) )
+			continue; // skip pet's share if inactive
 
 		if(md->dmglog[i].dmg > mvp_damage)
 		{
@@ -2027,7 +2028,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 
 		tmpsd[i] = tsd; // record as valid damage-log entry
 
-		if(!md->dmglog[i].flag && flaghom)
+		if(!md->dmglog[i].flag == 1 && flaghom)
 			flaghom = 0; // Damage received from other Types != Homunculus
 	}
 
@@ -2092,8 +2093,10 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			per /=2.;
 		else if(md->special_state.size==2)
 			per *=2.;
-		
-	
+
+		if( md->dmglog[i].flag == 2 )
+			per *= battle_config.pet_attack_exp_rate/100.;
+
 		if(battle_config.zeny_from_mobs && md->level) {
 			 // zeny calculation moblv + random moblv [Valaris]
 			zeny=(int) ((md->level+rand()%md->level)*per*bonus/100.);
@@ -2106,12 +2109,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		else
 			base_exp = (unsigned int)cap_value(md->db->base_exp * per * bonus/100. * map[m].bexp/100., 1, UINT_MAX);
 		
-		if (map[m].flag.nojobexp || !md->db->job_exp || md->dmglog[i].flag) //Homun earned job-exp is always lost.
+		if (map[m].flag.nojobexp || !md->db->job_exp || md->dmglog[i].flag == 1) //Homun earned job-exp is always lost.
 			job_exp = 0; 
 		else
 			job_exp = (unsigned int)cap_value(md->db->job_exp * per * bonus/100. * map[m].jexp/100., 1, UINT_MAX);
  		
-		if((temp = tmpsd[i]->status.party_id )>0 && !md->dmglog[i].flag) //Homun-done damage (flag 1) is not given to party
+		if((temp = tmpsd[i]->status.party_id )>0 && !md->dmglog[i].flag == 1) //Homun-done damage (flag 1) is not given to party
 		{
 			int j;
 			for(j=0;j<pnum && pt[j].id!=temp;j++); //Locate party.
@@ -2143,10 +2146,13 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			}
 		}
 		if(flag) {
-			if(base_exp && md->dmglog[i].flag) //tmpsd[i] is null if it has no homunc.
+			if(base_exp && md->dmglog[i].flag == 1) //tmpsd[i] is null if it has no homunc.
 				merc_hom_gainexp(tmpsd[i]->hd, base_exp);
 			if(base_exp || job_exp)
-				pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp);
+			{
+				if( md->dmglog[i].flag != 2 || battle_config.pet_attack_exp_to_master )
+					pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp);
+			}
 			if(zeny) // zeny from mobs [Valaris]
 				pc_getzeny(tmpsd[i], zeny);
 		}

+ 1 - 1
src/map/mob.h

@@ -121,7 +121,7 @@ struct mob_data {
 	struct {
 		int id;
 		unsigned int dmg;
-		unsigned flag : 1; //0: Normal. 1: Homunc exp
+		unsigned flag : 2; //0: Normal. 1: Homunc exp. 2: Pet exp
 	} dmglog[DAMAGELOG_SIZE];
 	struct spawn_data *spawn; //Spawn data.
 	int spawn_timer; //Required for Convex Mirror

+ 2 - 2
src/map/pc.c

@@ -7369,8 +7369,8 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick)
 {
 	int hp = 0, sp = 0;
 
-	//if( pc_isdead(sd) )
-	//	return;
+	if( pc_isdead(sd) )
+		return;
 
 	if (sd->hp_loss.value) {
 		sd->hp_loss.tick += diff_tick;