From a59be8328048f628cd200996b5d4a530a4d99cea Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 10 Apr 2013 19:45:56 -0300 Subject: Fixed reflect-damage loop that'd result to a crash Special Thanks to jTynne! Signed-off-by: shennetsind --- src/map/battle.c | 8 +++++--- src/map/skill.c | 10 +++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index 1abcaa19e..d06e02f6c 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4669,7 +4669,8 @@ int battle_damage_area( struct block_list *bl, va_list ap) { else status_fix_damage(src,bl,damage,0); clif->damage(bl,bl,tick,amotion,dmotion,damage,1,ATK_BLOCK,0); - skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); + if( !(src && src->type == BL_PC && ((TBL_PC*)src)->state.autocast) ) + skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); map_freeblock_unlock(); } @@ -4880,8 +4881,9 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t rdamage = battle->calc_return_damage(target,src, &damage, wd.flag, 0); if( rdamage > 0 ) { if( tsc && tsc->data[SC_REFLECTDAMAGE] ) { - if( src != target )// Don't reflect your own damage (Grand Cross) - map_foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race,0); + if( src != target ) {// Don't reflect your own damage (Grand Cross) + map_foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race); + } } else { rdelay = clif->damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0); //Use Reflect Shield to signal this kind of skill trigger. [Skotlex] diff --git a/src/map/skill.c b/src/map/skill.c index d686bef7f..e393e4293 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2698,8 +2698,16 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if( rdamage > 0 ) { if( sc && sc->data[SC_REFLECTDAMAGE] ) { - if( src != bl )// Don't reflect your own damage (Grand Cross) + if( src != bl ) {// Don't reflect your own damage (Grand Cross) + bool change = false; + if( sd && !sd->state.autocast ) + change = true; + if( change ) + sd->state.autocast = 1; map_foreachinshootrange(battle->damage_area,bl,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,bl,dmg.amotion,sstatus->dmotion,rdamage,tstatus->race); + if( change ) + sd->state.autocast = 0; + } } else { if( dmg.amotion ) battle->delay_damage(tick, dmg.amotion,bl,src,0,CR_REFLECTSHIELD,0,rdamage,ATK_DEF,0,additional_effects); -- cgit v1.2.3-70-g09d2