From 6a22fe4dc257228b28dd67cb35301d44ed6f6060 Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 6 Apr 2015 23:08:13 -0400 Subject: emulate @alive --- src/map/script-fun.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 3d699e2..919bf90 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -401,16 +401,23 @@ void builtin_areawarp(ScriptState *st) static void builtin_heal(ScriptState *st) { - int hp, sp, item; + int hp, sp; + dumb_ptr sd = script_rid2sd(st); hp = conv_num(st, &AARG(0)); sp = conv_num(st, &AARG(1)); - item = conv_num(st, &AARG(2)); - if(item) - pc_itemheal(script_rid2sd(st), hp, sp); + if(sd != nullptr && (sd->status.hp < 1 && hp > 0)){ + pc_setstand(sd); + if (battle_config.player_invincible_time > interval_t::zero()) + pc_setinvincibletimer(sd, battle_config.player_invincible_time); + clif_resurrection(sd, 1); + } + + if(HARG(2) && bool(conv_num(st, &AARG(2))) && hp > 0) + pc_itemheal(sd, hp, sp); else - pc_heal(script_rid2sd(st), hp, sp); + pc_heal(sd, hp, sp); } /*========================================== -- cgit v1.2.3-60-g2f50