Fixed bug that allowed a specific timing to not receive reflected damage if the origin of the reflect has died, bugreport:4494

Special thanks to xazax!
Also: Added a performance improvement:
-- Before: all delayed damage would loop through all mobs/players/etc units in the server to confirm that the origin of the damage is equal to the source
-- Now: it compares the id of the damage source to the source id.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15314 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
shennetsind 2011-12-29 19:13:41 +00:00
parent ce627737db
commit 922e56e099

View File

@ -197,18 +197,28 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data)
{
struct delay_damage *dat = (struct delay_damage *)data;
struct block_list *target = map_id2bl(dat->target);
if (target && dat && map_id2bl(id) == dat->src && target->prev != NULL && !status_isdead(target) &&
target->m == dat->src->m &&
(target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) &&
check_distance_bl(dat->src, target, dat->distance)) //Check to see if you haven't teleported. [Skotlex]
{
map_freeblock_lock();
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->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();
if ( target && dat && target->prev != NULL && !status_isdead(target) ) {
if( id == dat->src->id &&
target->m == dat->src->m &&
(target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) &&
check_distance_bl(dat->src, target, dat->distance) ) //Check to see if you haven't teleported. [Skotlex]
{
map_freeblock_lock();
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->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();
} else if( dat->skill_id == CR_REFLECTSHIELD && !map_id2bl(id) ) {
/**
* it was monster reflected damage, and the monster died, we pass the damage to the character as expected
**/
map_freeblock_lock();
status_fix_damage(target, target, dat->damage, dat->delay);
map_freeblock_unlock();
}
}
ers_free(delay_damage_ers, dat);
return 0;