Pārlūkot izejas kodu

- Some code cleaning in status.c
- Reflected damage will now also have a chance of draining hp/sp.


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

skotlex 19 gadi atpakaļ
vecāks
revīzija
26a6620863
5 mainītis faili ar 15 papildinājumiem un 37 dzēšanām
  1. 1 0
      Changelog-Trunk.txt
  2. 4 3
      src/map/battle.c
  3. 3 11
      src/map/battle.h
  4. 1 0
      src/map/skill.c
  5. 6 23
      src/map/status.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ 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/07
+	* Reflected damage will now also have a chance of draining hp/sp. [Skotlex]
 	* Adjusted the order in which option/sc change packets are sent to match
 	  Aegis's [Skotlex]
 	* Added script command getpartyleader through which you can retrieve

+ 4 - 3
src/map/battle.c

@@ -25,8 +25,6 @@
 #include "guild.h"
 #include "party.h"
 
-#define	is_boss(bl)	status_get_mexp(bl)	// Can refine later [Aru]
-
 int attr_fix_table[4][ELE_MAX][ELE_MAX];
 
 struct Battle_Config battle_config;
@@ -3061,8 +3059,11 @@ int battle_weapon_attack( struct block_list *src,struct block_list *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]
+	if (rdamage > 0) { //By sending attack type "none" skill_additional_effect won't be invoked. [Skotlex]
+
+		battle_drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
 		battle_delay_damage(tick+wd.amotion, target, src, 0, 0, 0, rdamage, ATK_DEF, rdelay);
+	}
 
 	if (tsc) {
 		if (tsc->data[SC_POISONREACT].timer != -1 && 

+ 3 - 11
src/map/battle.h

@@ -73,17 +73,9 @@ int battle_getcurrentskill(struct block_list *bl);
 #define BCT_NOONE 0x000000
 #define BCT_SELF 0x010000
 #define BCT_NEUTRAL 0x100000
-/*
-enum {
-	BCT_NOENEMY	=0x00000,
-	BCT_PARTY	=0x10000,
-	BCT_ENEMY	=0x40000,
-	BCT_NOPARTY	=0x50000,
-	BCT_ALL		=0x20000,
-	BCT_NOONE	=0x60000,
-	BCT_SELF	=0x60000,
-};
-*/
+
+#define	is_boss(bl)	status_get_mexp(bl)	// Can refine later [Aru]
+
 int battle_check_undead(int race,int element);
 int battle_check_target(struct block_list *src, struct block_list *target,int flag);
 int battle_check_range(struct block_list *src,struct block_list *bl,int range);

+ 1 - 0
src/map/skill.c

@@ -2112,6 +2112,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
 			status_fix_damage(bl,src,rdamage,0);
 		clif_damage(src,src,tick, dmg.amotion,0,rdamage,1,4,0);
 		//Use Reflect Shield to signal this kind of skill trigger. [Skotlex]
+		battle_drain(tsd, src, rdamage, rdamage, sstatus->race, is_boss(src));
 		skill_additional_effect(bl,src,CR_REFLECTSHIELD, 1,BF_WEAPON,tick);
 	}
 

+ 6 - 23
src/map/status.c

@@ -1992,7 +1992,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
 		status->aspd_rate -= 30*skill;
 	if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 &&
 		(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
-		status->aspd_rate -= (int)((skill+1)/2) * 10;
+		status->aspd_rate -= ((skill+1)/2) * 10;
 	if(pc_isriding(sd))
 		status->aspd_rate += 500-100*pc_checkskill(sd,KN_CAVALIERMASTERY);
 	
@@ -3842,16 +3842,8 @@ int status_get_party_id(struct block_list *bl)
 		}
 		return 0; //No party.
 	}
-	if(bl->type==BL_HOM){	//[orn]
-		struct homun_data *hd=(struct homun_data *)bl;
-		if( hd->master->bl.id>0 )
-		{
-			if ( hd->master != NULL)
-				return hd->master->status.party_id;
-			return -1;
-		}
-		return 0; //No party.
-	}
+	if(bl->type==BL_HOM && ((TBL_HOM*)bl)->master)
+		return ((TBL_HOM*)bl)->master->status.party_id;
 	if(bl->type==BL_SKILL)
 		return ((struct skill_unit *)bl)->group->party_id;
 	return 0;
@@ -3874,16 +3866,8 @@ int status_get_guild_id(struct block_list *bl)
 			return msd->status.guild_id; //Alchemist's mobs [Skotlex]
 		return 0; //No guild.
 	}
-	if(bl->type==BL_HOM){	//[orn]
-		struct homun_data *hd=(struct homun_data *)bl;
-		if( hd->master->bl.id>0 )
-		{
-			if ( hd->master != NULL)
-				return hd->master->status.guild_id;
-			return -1;
-		}
-		return 0; //No guild.
-	}
+	if(bl->type==BL_HOM && ((TBL_HOM*)bl)->master)
+		return ((TBL_HOM*)bl)->master->status.guild_id;
 	if (bl->type == BL_NPC && bl->subtype == SCRIPT)
 		return ((TBL_NPC*)bl)->u.scr.guild_id;
 	if(bl->type==BL_SKILL)
@@ -3940,7 +3924,7 @@ struct view_data *status_get_viewdata(struct block_list *bl)
 		case BL_NPC:
 			return ((TBL_NPC*)bl)->vd;
 		case BL_HOM: //[blackhole89]
-			return ((struct homun_data*)bl)->vd;
+			return ((TBL_HOM*)bl)->vd;
 	}
 	return NULL;
 }
@@ -5604,7 +5588,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 	sc->data[type].timer = add_timer(
 		gettick() + tick, status_change_timer, bl->id, type);
 
-
 	if (calc_flag)
 		status_calc_bl(bl,calc_flag);