Kaynağa Gözat

- Some cleaning of battle_drain, Evil Druid card should work now.
- Made status_damage allow damaging of objects not on a map, this should fix pet-catching making the mob never respawn again.


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

skotlex 19 yıl önce
ebeveyn
işleme
1d754d8cd8
5 değiştirilmiş dosya ile 20 ekleme ve 16 silme
  1. 3 0
      Changelog-Trunk.txt
  2. 9 9
      src/map/battle.c
  3. 2 1
      src/map/battle.h
  4. 2 4
      src/map/skill.c
  5. 4 2
      src/map/status.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ 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
+	* Some cleaning of battle_drain, Evil Druid card should work now. [Skotlex]
+	* Made status_damage allow damaging of objects not on a map, this should
+	  fix pet-catching making the mob never respawn again. [Skotlex]
 	* Casted nothl to (unsigned int) in sprintf functions, IP is 32bits and sql field the same :) [Toms]
 	* Fixed "warning: `list' might be used uninitialized in this function" in char/char.c@3032 [Toms]
 	* Fixed "uninitialized local variable 'i' used" in skill.c and "warning: suggest explicit braces to avoid ambiguous `else'" in battle.c [Toms]

+ 9 - 9
src/map/battle.c

@@ -2765,7 +2765,7 @@ int battle_calc_return_damage(struct block_list *bl, int *damage, int flag) {
 	return rdamage;
 }
 
-void battle_drain(TBL_PC *sd, TBL_PC* tsd, int rdamage, int ldamage, int race, int boss)
+void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss)
 {
 	struct weapon_data *wd;
 	int type, thp = 0, tsp = 0, rhp = 0, rsp = 0, hp, sp, i, *damage;
@@ -2803,17 +2803,17 @@ void battle_drain(TBL_PC *sd, TBL_PC* tsd, int rdamage, int ldamage, int race, i
 			tsp += sp;
 		}
 	}
+
+	if (sd->sp_vanish_rate && rand()%1000 < sd->sp_vanish_rate)
+		status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->sp_vanish_per);
 	if (!thp && !tsp) return;
 
 	status_heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1);
 	
-	if (tsd) {
-		if (rhp || rsp)
-			status_zap(&tsd->bl, rhp, rsp);
-		if (rand()%1000 < sd->sp_vanish_rate)
-			status_percent_damage(&sd->bl, &tsd->bl, 0, (unsigned char)sd->sp_vanish_per);
-	}
+	if (rhp || rsp)
+		status_zap(tbl, rhp, rsp);
 }
+
 /*==========================================
  * ’Ê?í?UŒ‚?ˆ—?‚܂Ƃß
  *------------------------------------------
@@ -2978,9 +2978,9 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target,
 	if (sd) {
 		if (wd.flag & BF_WEAPON && src != target && damage > 0) {
 			if (battle_config.left_cardfix_to_right)
-				battle_drain(sd, tsd, wd.damage, wd.damage, tstatus->race, is_boss(target));
+				battle_drain(sd, target, wd.damage, wd.damage, tstatus->race, is_boss(target));
 			else
-				battle_drain(sd, tsd, wd.damage, wd.damage2, tstatus->race, is_boss(target));
+				battle_drain(sd, target, wd.damage, wd.damage2, tstatus->race, is_boss(target));
 		}
 	}
 	if (rdamage > 0) //By sending attack type "none" skill_additional_effect won't be invoked. [Skotlex]

+ 2 - 1
src/map/battle.h

@@ -26,7 +26,8 @@ struct block_list;
 struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag);
 
 int battle_calc_return_damage(struct block_list *bl, int *damage, int flag);
-void battle_drain(struct map_session_data *sd, struct map_session_data *tsd, int rdamage, int ldamage, int race, int boss);
+
+void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss);
 
 int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_type, int def_lv);
 

+ 2 - 4
src/map/skill.c

@@ -2087,9 +2087,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
 
 	if(sd && dmg.flag&BF_WEAPON && src != bl && src == dsrc && damage > 0) {
 		if (battle_config.left_cardfix_to_right)
-			battle_drain(sd, tsd, dmg.damage, dmg.damage, tstatus->race, tstatus->mode&MD_BOSS);
+			battle_drain(sd, bl, dmg.damage, dmg.damage, tstatus->race, tstatus->mode&MD_BOSS);
 		else
-			battle_drain(sd, tsd, dmg.damage, dmg.damage2, tstatus->race, tstatus->mode&MD_BOSS);
+			battle_drain(sd, bl, dmg.damage, dmg.damage2, tstatus->race, tstatus->mode&MD_BOSS);
 	}
 
 	if (rdamage>0) {
@@ -3711,8 +3711,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 			if (skill_break_equip(bl, EQP_WEAPON, 10000, BCT_PARTY) && sd && sd != dstsd)
 				clif_displaymessage(sd->fd,"You broke target's weapon");
 		}
-		//FIXME : Why clif_skill_nodamage 2 times ?
-		//clif_skill_nodamage(src,bl,skillid,skilllv,i);
 		break;
 
 	case PR_ASPERSIO:		/* アスペルシオ */

+ 4 - 2
src/map/status.c

@@ -566,8 +566,10 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
 	if (status == &dummy_status || !status->hp)
 		return 0; //Invalid targets: no damage or dead
 
-	if (!target->prev && !(flag&2))
-		return 0; //Cannot damage a bl not on a map, except when "charging" hp/sp
+// Let through. battle.c/skill.c have the whole logic of when it's possible or
+// not to hurt someone (and this check breaks pet catching) [Skotlex]
+//	if (!target->prev && !(flag&2))
+//		return 0; //Cannot damage a bl not on a map, except when "charging" hp/sp
 
 	sc = status_get_sc(target);