summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-04-22 21:02:00 +0200
committerHaru <haru@dotalux.com>2018-11-14 18:44:19 +0100
commit8269fdcd5d036ddc3c24bc0ebb4ad958b5c19a3a (patch)
tree12f538ec393399874eedc24724281b2980c59dc8
parent9ae4b5ad26029f8056635a6112828d87dc671184 (diff)
downloadhercules-8269fdcd5d036ddc3c24bc0ebb4ad958b5c19a3a.tar.gz
hercules-8269fdcd5d036ddc3c24bc0ebb4ad958b5c19a3a.tar.bz2
hercules-8269fdcd5d036ddc3c24bc0ebb4ad958b5c19a3a.tar.xz
hercules-8269fdcd5d036ddc3c24bc0ebb4ad958b5c19a3a.zip
Extend status->heal() with a flag to allow reviving a dead character
This adds `STATUS_HEAL_ALLOWREVIVE` to `enum status_heal_flag`. Fixes an issue caused by a hack in the resurrection code, that would make characters respawn with 2 HP instead of 1. Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/map/pc.c3
-rw-r--r--src/map/status.c4
-rw-r--r--src/map/status.h1
3 files changed, 5 insertions, 3 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index ba2edf0f4..78b773550 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -523,8 +523,7 @@ static int pc_setrestartvalue(struct map_session_data *sd, int type)
if (type&1) {
//Normal resurrection
- st->hp = 1; //Otherwise status->heal may fail if dead.
- status->heal(&sd->bl, bst->hp, 0, STATUS_HEAL_FORCED);
+ status->heal(&sd->bl, bst->hp, 0, STATUS_HEAL_FORCED | STATUS_HEAL_ALLOWREVIVE);
if( st->sp < bst->sp )
status->set_sp(&sd->bl, bst->sp, STATUS_HEAL_FORCED);
} else { //Just for saving on the char-server (with values as if respawned)
diff --git a/src/map/status.c b/src/map/status.c
index a1be36ff4..edcdd515d 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1555,7 +1555,9 @@ static int status_heal(struct block_list *bl, int64 in_hp, int64 in_sp, enum sta
nullpo_ret(bl);
st = status->get_status_data(bl);
- if (st == &status->dummy || !st->hp)
+ if (st == &status->dummy)
+ return 0;
+ if (st->hp == 0 && (flag & STATUS_HEAL_ALLOWREVIVE) != 0)
return 0;
/* From here onwards, we consider it a 32-type as the client does not support higher and the value doesn't get through percentage modifiers */
diff --git a/src/map/status.h b/src/map/status.h
index 35721c46a..d6a5c2002 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -106,6 +106,7 @@ enum status_heal_flag {
STATUS_HEAL_DEFAULT = 0x00, ///< Default
STATUS_HEAL_FORCED = 0x01, ///< Forced healing (bypassing Berserk and similar)
STATUS_HEAL_SHOWEFFECT = 0x02, ///< Show the HP/SP heal effect
+ STATUS_HEAL_ALLOWREVIVE = 0x04, ///< Force resurrection in case of dead targets.
};
// Status changes listing. These code are for use by the server.