Ver código fonte

- Removed attack_type from sd->state structure (it's only use was for soul-drain!)
- Moved the soul-drain code to skill_counter_additionaleffect


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

skotlex 19 anos atrás
pai
commit
ffea9656f8
6 arquivos alterados com 17 adições e 12 exclusões
  1. 1 0
      Changelog-Trunk.txt
  2. 0 3
      src/map/battle.c
  3. 0 1
      src/map/clif.c
  4. 0 1
      src/map/map.h
  5. 1 7
      src/map/mob.c
  6. 15 0
      src/map/skill.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/04/30
+	* Moved the soul-drain code to skill_counter_additionaleffect [Skotlex]
 	* Fixed fake NPC missing code. Thanks to Skotlex for pointing out. [Lance]
 
 2006/04/29

+ 0 - 3
src/map/battle.c

@@ -1050,7 +1050,6 @@ static struct Damage battle_calc_weapon_attack(
 	}
 
 	if(sd) {
-		sd->state.attack_type = BF_WEAPON;
 		if (sd->skillblown[0].id != 0)
 		{	//Apply the bonus blewcount. [Skotlex]
 			for (i = 0; i < 5 && sd->skillblown[i].id != 0 && sd->skillblown[i].id != skill_num; i++);
@@ -2385,7 +2384,6 @@ struct Damage battle_calc_magic_attack(
 
 	//Set miscellaneous data that needs be filled
 	if(sd) {
-		sd->state.attack_type = BF_MAGIC;
 		sd->state.arrow_atk = 0;
 		if (sd->skillblown[0].id != 0)
 		{	//Apply the bonus blewcount. [Skotlex]
@@ -2762,7 +2760,6 @@ struct Damage  battle_calc_misc_attack(
 	md.dmg_lv=ATK_DEF;
 
 	if( bl->type == BL_PC && (sd=(struct map_session_data *)bl) ) {
-		sd->state.attack_type = BF_MISC;
 		sd->state.arrow_atk = 0;
 		if (sd->skillblown[0].id != 0)
 		{	//Apply the bonus blewcount. [Skotlex]

+ 0 - 1
src/map/clif.c

@@ -10439,7 +10439,6 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd) {
 					clif_GM_kickack(sd, 0);
 			} else if (target->type == BL_MOB) {
 				struct mob_data *md = (struct mob_data *)target;
-				sd->state.attack_type = 0;
 				mob_damage(&sd->bl, md, md->hp, 2);
 			} else
 				clif_GM_kickack(sd, 0);

+ 0 - 1
src/map/map.h

@@ -486,7 +486,6 @@ struct map_session_data {
 		unsigned lr_flag : 2;
 		unsigned connect_new : 1;
 		unsigned arrow_atk : 1;
-		unsigned attack_type : 3;
 		unsigned skill_flag : 1;
 		unsigned gangsterparadise : 1;
 		unsigned rest : 1;

+ 1 - 7
src/map/mob.c

@@ -1715,12 +1715,6 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 
 	if(sd) {
 		int sp = 0, hp = 0;
-		if (sd->state.attack_type == BF_MAGIC && sd->ud.skilltarget == md->bl.id && (i=pc_checkskill(sd,HW_SOULDRAIN))>0)
-		{	//Soul Drain should only work on targetted spells [Skotlex]
-			if (pc_issit(sd)) pc_setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex]
-			clif_skill_nodamage(src,&md->bl,HW_SOULDRAIN,i,1);
-			sp += (status_get_lv(&md->bl))*(95+15*i)/100;
-		}
 		sp += sd->sp_gain_value;
 		sp += sd->sp_gain_race[race];
 		sp += sd->sp_gain_race[mode&MD_BOSS?10:11];
@@ -2035,7 +2029,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
 				mob_item_drop(md, dlist, mob_setlootitem(&md->lootitem[i]), 1, 10000);
 		}
 		if (dlist->item) //There are drop items.
-			add_timer(tick + ((!battle_config.delay_battle_damage || (sd && sd->state.attack_type == BF_MAGIC))?500:0),
+			add_timer(tick + (!battle_config.delay_battle_damage?500:0),
 				mob_delay_item_drop, (int)dlist, 0);
 		else //No drops
 			ers_free(item_drop_list_ers, dlist);

+ 15 - 0
src/map/skill.c

@@ -1451,6 +1451,21 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
 		}
 	}
 
+	if(sd && bl->type == BL_MOB && status_isdead(bl) && skill_get_inf(skillid)!=INF_GROUND_SKILL && (rate=pc_checkskill(sd,HW_SOULDRAIN))>0)
+	{	//Soul Drain should only work on targetted spells [Skotlex]
+		int sp;
+		if (pc_issit(sd)) pc_setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex]
+		clif_skill_nodamage(src,bl,HW_SOULDRAIN,rate,1);
+		sp = (status_get_lv(bl))*(95+15*rate)/100;
+		if (sp > 0) {
+			if(sd->status.sp + sp > sd->status.max_sp)
+				sp = sd->status.max_sp - sd->status.sp;
+			sd->status.sp += sp;
+			if (sp > 0 && battle_config.show_hp_sp_gain)
+				clif_heal(sd->fd,SP_SP,sp);
+		}
+	}
+
 	//Trigger counter-spells to retaliate against damage causing skills. [Skotlex]
 	if(dstsd && !status_isdead(bl) && src != bl && !(skillid && skill_get_nk(skillid)&NK_NO_DAMAGE)) 
 	{