summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorxazax-hun <xazax-hun@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-25 20:06:48 +0000
committerxazax-hun <xazax-hun@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-25 20:06:48 +0000
commit7e48e6cc160d62a996e7fc56c17d4fbe24c6f2a2 (patch)
treebc606fdb30c13c636548070a28abdbb92faf57e1 /src/map/battle.c
parent150ddb16d18f4f1ed0920a400ed92cc1be5b006f (diff)
downloadhercules-7e48e6cc160d62a996e7fc56c17d4fbe24c6f2a2.tar.gz
hercules-7e48e6cc160d62a996e7fc56c17d4fbe24c6f2a2.tar.bz2
hercules-7e48e6cc160d62a996e7fc56c17d4fbe24c6f2a2.tar.xz
hercules-7e48e6cc160d62a996e7fc56c17d4fbe24c6f2a2.zip
Fixed a crash bug caused by clones that were committing suicide with PA_SACRAFICE. bugreport:4950
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15277 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index aa494c3e4..c474ba69b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3705,6 +3705,11 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if (sc->data[SC_SACRIFICE])
{
int skilllv = sc->data[SC_SACRIFICE]->val1;
+ /**
+ * We need to calculate the DMG before the hp reduction, because it can kill the source.
+ * For futher information: bugreport:4950
+ **/
+ damage_lv ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skilllv,tick,0);
if( --sc->data[SC_SACRIFICE]->val2 <= 0 )
status_change_end(src, SC_SACRIFICE, INVALID_TIMER);
@@ -3712,7 +3717,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
status_zap(src, sstatus->max_hp*9/100, 0);//Damage to self is always 9%
//FIXME: invalid return type!
- return (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skilllv,tick,0);
+ return ret_val;
}
if (sc->data[SC_MAGICALATTACK])
//FIXME: invalid return type!