From f11d79e00eeeffc1a7be0d75b78f580e396b2e7a Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 30 Apr 2006 06:01:16 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6392 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 3 --- src/map/clif.c | 1 - src/map/map.h | 1 - src/map/mob.c | 8 +------- src/map/skill.c | 15 +++++++++++++++ 5 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index cf1d06a7f..521753a25 100644 --- a/src/map/battle.c +++ b/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] diff --git a/src/map/clif.c b/src/map/clif.c index 97c0df9bb..3c1c33db5 100644 --- a/src/map/clif.c +++ b/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); diff --git a/src/map/map.h b/src/map/map.h index dfec131c1..105183244 100644 --- a/src/map/map.h +++ b/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; diff --git a/src/map/mob.c b/src/map/mob.c index e98917ae4..84f40b514 100644 --- a/src/map/mob.c +++ b/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); diff --git a/src/map/skill.c b/src/map/skill.c index ea673682d..8040127fb 100644 --- a/src/map/skill.c +++ b/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)) { -- cgit v1.2.3-70-g09d2