summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-29 19:13:41 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-29 19:13:41 +0000
commitd535b319f4ebc18472ffdbcbbdfeb5a0592d05e3 (patch)
treecc014d4133a3d21b7ba53daacf56534e5623caab /src/map
parented891a3a49a7356a52a6cdd8ff8da3838a3c704a (diff)
downloadhercules-d535b319f4ebc18472ffdbcbbdfeb5a0592d05e3.tar.gz
hercules-d535b319f4ebc18472ffdbcbbdfeb5a0592d05e3.tar.bz2
hercules-d535b319f4ebc18472ffdbcbbdfeb5a0592d05e3.tar.xz
hercules-d535b319f4ebc18472ffdbcbbdfeb5a0592d05e3.zip
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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15314 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 3f4c7f463..d01b72e84 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -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;