From 92c2232a9e0160aff8d087086a4e14ec1e322c56 Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 6 Apr 2015 22:42:15 -0400 Subject: remove deprecated percentheal --- src/map/pc.cpp | 69 -------------------------------------------------- src/map/pc.hpp | 1 - src/map/script-fun.cpp | 15 ----------- 3 files changed, 85 deletions(-) (limited to 'src') diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 7d04785..95fabde 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -3689,75 +3689,6 @@ int pc_itemheal_effect(dumb_ptr sd, int hp, int sp) return 0; } -/*========================================== - * HP/SP回復 - *------------------------------------------ - */ -int pc_percentheal(dumb_ptr sd, int hp, int sp) -{ - nullpo_retz(sd); - - if (pc_checkoverhp(sd)) - { - if (hp > 0) - hp = 0; - } - if (pc_checkoversp(sd)) - { - if (sp > 0) - sp = 0; - } - if (hp) - { - if (hp >= 100) - { - sd->status.hp = sd->status.max_hp; - } - else if (hp <= -100) - { - sd->status.hp = 0; - pc_damage(nullptr, sd, 1); - } - else - { - sd->status.hp += sd->status.max_hp * hp / 100; - if (sd->status.hp > sd->status.max_hp) - sd->status.hp = sd->status.max_hp; - if (sd->status.hp <= 0) - { - sd->status.hp = 0; - pc_damage(nullptr, sd, 1); - hp = 0; - } - } - } - if (sp) - { - if (sp >= 100) - { - sd->status.sp = sd->status.max_sp; - } - else if (sp <= -100) - { - sd->status.sp = 0; - } - else - { - sd->status.sp += sd->status.max_sp * sp / 100; - if (sd->status.sp > sd->status.max_sp) - sd->status.sp = sd->status.max_sp; - if (sd->status.sp < 0) - sd->status.sp = 0; - } - } - if (hp) - clif_updatestatus(sd, SP::HP); - if (sp) - clif_updatestatus(sd, SP::SP); - - return 0; -} - /*========================================== * 見た目変更 *------------------------------------------ diff --git a/src/map/pc.hpp b/src/map/pc.hpp index ba0a46f..4bca255 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -138,7 +138,6 @@ int pc_useitem(dumb_ptr, IOff0); int pc_damage(dumb_ptr, dumb_ptr, int); int pc_heal(dumb_ptr, int, int); int pc_itemheal(dumb_ptr sd, int hp, int sp); -int pc_percentheal(dumb_ptr sd, int, int); int pc_changelook(dumb_ptr, LOOK, int); int pc_readparam(dumb_ptr, SP); diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 8c25266..52b425a 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -422,20 +422,6 @@ void builtin_itemheal(ScriptState *st) pc_itemheal(script_rid2sd(st), hp, sp); } -/*========================================== - * - *------------------------------------------ - */ -static -void builtin_percentheal(ScriptState *st) -{ - int hp, sp; - - hp = conv_num(st, &AARG(0)); - sp = conv_num(st, &AARG(1)); - pc_percentheal(script_rid2sd(st), hp, sp); -} - /*========================================== * *------------------------------------------ @@ -3011,7 +2997,6 @@ BuiltinFunction builtin_functions[] = BUILTIN(areawarp, "MxyxyMxy"_s, '\0'), BUILTIN(heal, "ii"_s, '\0'), BUILTIN(itemheal, "ii"_s, '\0'), - BUILTIN(percentheal, "ii"_s, '\0'), BUILTIN(input, "N"_s, '\0'), BUILTIN(if, "iF*"_s, '\0'), BUILTIN(set, "Ne"_s, '\0'), -- cgit v1.2.3-60-g2f50 From 34deaf57bed37f5a43f28e039ed7caa8bde65bb4 Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 6 Apr 2015 22:46:51 -0400 Subject: remove deprecated itemheal --- src/map/script-fun.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src') diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 52b425a..b8cca26 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -408,20 +408,6 @@ void builtin_heal(ScriptState *st) pc_heal(script_rid2sd(st), hp, sp); } -/*========================================== - * - *------------------------------------------ - */ -static -void builtin_itemheal(ScriptState *st) -{ - int hp, sp; - - hp = conv_num(st, &AARG(0)); - sp = conv_num(st, &AARG(1)); - pc_itemheal(script_rid2sd(st), hp, sp); -} - /*========================================== * *------------------------------------------ @@ -2996,7 +2982,6 @@ BuiltinFunction builtin_functions[] = BUILTIN(warp, "Mxy"_s, '\0'), BUILTIN(areawarp, "MxyxyMxy"_s, '\0'), BUILTIN(heal, "ii"_s, '\0'), - BUILTIN(itemheal, "ii"_s, '\0'), BUILTIN(input, "N"_s, '\0'), BUILTIN(if, "iF*"_s, '\0'), BUILTIN(set, "Ne"_s, '\0'), -- cgit v1.2.3-60-g2f50 From da8a9751c6277e6f936bf57b367ea9c78ce0ba4f Mon Sep 17 00:00:00 2001 From: mekolat Date: Mon, 6 Apr 2015 22:55:25 -0400 Subject: add 3rd param to heal --- src/map/script-fun.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index b8cca26..3d699e2 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -401,11 +401,16 @@ void builtin_areawarp(ScriptState *st) static void builtin_heal(ScriptState *st) { - int hp, sp; + int hp, sp, item; hp = conv_num(st, &AARG(0)); sp = conv_num(st, &AARG(1)); - pc_heal(script_rid2sd(st), hp, sp); + item = conv_num(st, &AARG(2)); + + if(item) + pc_itemheal(script_rid2sd(st), hp, sp); + else + pc_heal(script_rid2sd(st), hp, sp); } /*========================================== @@ -2981,7 +2986,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(isat, "Mxy"_s, 'i'), BUILTIN(warp, "Mxy"_s, '\0'), BUILTIN(areawarp, "MxyxyMxy"_s, '\0'), - BUILTIN(heal, "ii"_s, '\0'), + BUILTIN(heal, "ii?"_s, '\0'), BUILTIN(input, "N"_s, '\0'), BUILTIN(if, "iF*"_s, '\0'), BUILTIN(set, "Ne"_s, '\0'), -- cgit v1.2.3-60-g2f50 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