Issue information

Issue ID
#4494
Status
Fixed
Severity
High
Started
Hercules Elf Bot
Oct 21, 2010 18:26
Last Post
Hercules Elf Bot
Apr 18, 2012 15:45
Confirmation
N/A

Hercules Elf Bot - Oct 21, 2010 18:26

Originally posted by [b]Kazukin[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4494

When a monster is killed under SC_REFLECTSHIELD or any other statuses capable of making a monster to reflect damage, the blow which killed such monster and the reflected damage are under a race condition which can lead to 2 different outputs:

1. If battle_delay_damage_sub() is executed first with the reflected dmg, all is alright, last blow dmg is reflected back to the source and the monster is killed by a second call to battle_delay_damage_sub() with the blow's dmg.

2. If battle_delay_damage_sub() is executed first with the blow's dmg, unit is cleared and when battle_delay_damage_sub() is executed with the reflected dmg, these conditions make it fail, so dmg is never reflected back to the source:

(map_id2bl(id) == dat->src)

check_distance_bl(dat->src, target, dat->distance)

Where src is the killed monster.

This behavior can be observed pretty clearly when killing a Golden Thief Bug under SC_REFLECTSHIELD with Asura. There are times when you die by the reflected dmg, and there are times when even if the reflected dmg is shown, you don't receive any dmg at all.

This post has been edited by Kazukin: Jul 7 2011, 07:47 PM

Hercules Elf Bot - Dec 28, 2011 11:44

Originally posted by [b]Arcadia[/b]
Hello any fix on this ?

Hercules Elf Bot - Dec 29, 2011 18:00

Originally posted by [b]Ind[/b]
Developers: I've found a concerning issue while trying to fix this. in battle_delay_damage_sub I've added the following debug line
[code]
if( target && dat->src && dat->skill_id == CR_REFLECTSHIELD )
ShowDebug("A: %d ( %d,%d vs %d,%d ) | %d | %d\n",distance_bl(dat->src, target),target->x,target->y,dat->src->x,dat->src->y,status_isdead(target)?1:0,status_isdead(dat->src)?1:0);
[/code]
and whenever I successfully reproduced the bug (damn, there were times when i had to spawn over 10 gtb to get there), I'd get this:
[code]
A: 634 ( 56,119 vs -515,-515 ) | 0 | 0
[/code]
Looks like we're with a memory problem somewhere, that is what causes this bug (and maybe even more)

Hercules Elf Bot - Dec 29, 2011 19:14

Originally posted by [b]Ind[/b]
Fixed in [rev=15314]