From 9667d693f53f5eb0be58798bbb953aa3ee0146b8 Mon Sep 17 00:00:00 2001 From: Inkfish Date: Mon, 20 Sep 2010 13:37:12 +0000 Subject: Fixed when devoter is killed by the redirected damage, devotee takes the whole damage. (follow up to r14406) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14410 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 35 ++++++++++++++++++----------------- src/map/skill.c | 34 +++++++++++++++++----------------- 2 files changed, 35 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index b03d13417..c5a1f4272 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -163,13 +163,11 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr data) (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == -1) && check_distance_bl(dat->src, target, dat->distance)) //Check to see if you haven't teleported. [Skotlex] { - struct status_change *sc = status_get_sc(target); map_freeblock_lock(); - if( !sc || !sc->data[SC_DEVOTION] ) - status_fix_damage(dat->src, target, dat->damage, dat->delay); + status_fix_damage(dat->src, target, dat->damage, dat->delay); if( dat->attack_type && !status_isdead(target) ) skill_additional_effect(dat->src,target,dat->skill_id,dat->skill_lv,dat->attack_type,dat->dmg_lv,tick); - if( dat->damage > 0 && dat->attack_type ) + if( dat->dmg_lv > ATK_BLOCK && dat->attack_type ) skill_counter_additional_effect(dat->src,target,dat->skill_id,dat->skill_lv,dat->attack_type,tick); map_freeblock_unlock(); } @@ -180,17 +178,20 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr data) int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay) { struct delay_damage *dat; + struct status_change *sc; nullpo_retr(0, src); nullpo_retr(0, target); + sc = status_get_sc(target); + if( sc && sc->data[SC_DEVOTION] && damage > 0 ) + damage = 0; + if (!battle_config.delay_battle_damage) { - struct status_change *sc = status_get_sc(target); map_freeblock_lock(); - if( !sc || !sc->data[SC_DEVOTION] ) - status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope] + status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope] if( attack_type && !status_isdead(target) ) skill_additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, gettick()); - if( damage > 0 && attack_type ) + if( dmg_lv > ATK_BLOCK && attack_type ) skill_counter_additional_effect(src, target, skill_id, skill_lv, attack_type, gettick()); map_freeblock_unlock(); return 0; @@ -3176,6 +3177,15 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } } + wd.dmotion = clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2); + + if (sd && sd->splash_range > 0 && damage > 0) + skill_castend_damage_id(src, target, 0, 1, tick, 0); + + map_freeblock_lock(); + + battle_delay_damage(tick, wd.amotion, src, target, wd.flag, 0, 0, damage, wd.dmg_lv, wd.dmotion); + if( tsc && tsc->data[SC_DEVOTION] ) { struct status_change_entry *sce = tsc->data[SC_DEVOTION]; @@ -3193,15 +3203,6 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t status_change_end(target, SC_DEVOTION, -1); } - wd.dmotion = clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2); - - if (sd && sd->splash_range > 0 && damage > 0) - skill_castend_damage_id(src, target, 0, 1, tick, 0); - - map_freeblock_lock(); - - battle_delay_damage(tick, wd.amotion, src, target, wd.flag, 0, 0, damage, wd.dmg_lv, wd.dmotion); - if (sc && sc->data[SC_AUTOSPELL] && rand()%100 < sc->data[SC_AUTOSPELL]->val4) { int sp = 0; int skillid = sc->data[SC_AUTOSPELL]->val2; diff --git a/src/map/skill.c b/src/map/skill.c index ac6591cad..baf30af35 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1715,23 +1715,6 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds && skillid != WS_CARTTERMINATION ) rdamage = battle_calc_return_damage(bl, damage, dmg.flag); - if( sc && sc->data[SC_DEVOTION] && skillid != PA_PRESSURE ) - { - struct status_change_entry *sce = sc->data[SC_DEVOTION]; - struct block_list *d_bl = map_id2bl(sce->val1); - - if( d_bl && ( - (d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id) || - (d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce->val2] == bl->id) - ) && check_distance_bl(bl, d_bl, sce->val3) ) - { - clif_damage(d_bl, d_bl, gettick(), 0, 0, damage, 0, 0, 0); - status_fix_damage(NULL, d_bl, damage, 0); - } - else - status_change_end(bl, SC_DEVOTION, -1); - } - //Skill hit type type=(skillid==0)?5:skill_get_hit(skillid); @@ -1945,6 +1928,23 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if (dmg.amotion) battle_delay_damage(tick, dmg.amotion,src,bl,dmg.flag,skillid,skilllv,damage,dmg.dmg_lv,dmg.dmotion); + if( sc && sc->data[SC_DEVOTION] && skillid != PA_PRESSURE ) + { + struct status_change_entry *sce = sc->data[SC_DEVOTION]; + struct block_list *d_bl = map_id2bl(sce->val1); + + if( d_bl && ( + (d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id) || + (d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce->val2] == bl->id) + ) && check_distance_bl(bl, d_bl, sce->val3) ) + { + clif_damage(d_bl, d_bl, gettick(), 0, 0, damage, 0, 0, 0); + status_fix_damage(NULL, d_bl, damage, 0); + } + else + status_change_end(bl, SC_DEVOTION, -1); + } + if(skillid == RG_INTIMIDATE && damage > 0 && !(tstatus->mode&MD_BOSS)) { int rate = 50 + skilllv * 5; rate = rate + (status_get_lv(src) - status_get_lv(bl)); -- cgit v1.2.3-70-g09d2