summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-04-13 21:25:17 -0500
committerWushin <pasekei@gmail.com>2015-04-13 21:25:17 -0500
commit0b04c49460a2e0c894c818ae190465fc2607bca8 (patch)
tree0e1a89b9c1402c2a5b2e1c125034ae8534a53a49 /src/map
parentbf54afff27cd03ed535859009baa0b4c4fa663e9 (diff)
parent6a22fe4dc257228b28dd67cb35301d44ed6f6060 (diff)
downloadtmwa-0b04c49460a2e0c894c818ae190465fc2607bca8.tar.gz
tmwa-0b04c49460a2e0c894c818ae190465fc2607bca8.tar.bz2
tmwa-0b04c49460a2e0c894c818ae190465fc2607bca8.tar.xz
tmwa-0b04c49460a2e0c894c818ae190465fc2607bca8.zip
Merge pull request #50 from mekolat/heal
remove deprecated percentheal and itemheal
Diffstat (limited to 'src/map')
-rw-r--r--src/map/pc.cpp69
-rw-r--r--src/map/pc.hpp1
-rw-r--r--src/map/script-fun.cpp42
3 files changed, 12 insertions, 100 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 8b0391b..e73d79f 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3717,75 +3717,6 @@ int pc_itemheal_effect(dumb_ptr<map_session_data> sd, int hp, int sp)
}
/*==========================================
- * HP/SP回復
- *------------------------------------------
- */
-int pc_percentheal(dumb_ptr<map_session_data> 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 56f0491..14829d1 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -138,7 +138,6 @@ int pc_useitem(dumb_ptr<map_session_data>, IOff0);
int pc_damage(dumb_ptr<block_list>, dumb_ptr<map_session_data>, int);
int pc_heal(dumb_ptr<map_session_data>, int, int);
int pc_itemheal(dumb_ptr<map_session_data> sd, int hp, int sp);
-int pc_percentheal(dumb_ptr<map_session_data> sd, int, int);
int pc_changelook(dumb_ptr<map_session_data>, LOOK, int);
int pc_readparam(dumb_ptr<map_session_data>, SP);
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 8300d38..3b814aa 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -402,38 +402,22 @@ static
void builtin_heal(ScriptState *st)
{
int hp, sp;
+ dumb_ptr<map_session_data> sd = script_rid2sd(st);
hp = conv_num(st, &AARG(0));
sp = conv_num(st, &AARG(1));
- 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);
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
-void builtin_percentheal(ScriptState *st)
-{
- int 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);
+ }
- hp = conv_num(st, &AARG(0));
- sp = conv_num(st, &AARG(1));
- pc_percentheal(script_rid2sd(st), hp, sp);
+ if(HARG(2) && bool(conv_num(st, &AARG(2))) && hp > 0)
+ pc_itemheal(sd, hp, sp);
+ else
+ pc_heal(sd, hp, sp);
}
/*==========================================
@@ -3126,9 +3110,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(itemheal, "ii"_s, '\0'),
- BUILTIN(percentheal, "ii"_s, '\0'),
+ BUILTIN(heal, "ii?"_s, '\0'),
BUILTIN(input, "N"_s, '\0'),
BUILTIN(if, "iF*"_s, '\0'),
BUILTIN(set, "Ne"_s, '\0'),