summaryrefslogtreecommitdiff
path: root/src/map/pc.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-06-30 22:02:27 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-06-30 22:02:27 -0700
commit0a768e842faf9a69f576fc9ac92bfa1dd2533d5f (patch)
treecccddb6c101f5983f35fde73c0e49e0999978066 /src/map/pc.cpp
parentaa4df026d44bd205f8bfce8a3b8d6a1144332f32 (diff)
downloadtmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.tar.gz
tmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.tar.bz2
tmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.tar.xz
tmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.zip
Invulnerability should not be the default
Diffstat (limited to 'src/map/pc.cpp')
-rw-r--r--src/map/pc.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index fbc64a7..d726df8 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3422,6 +3422,8 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
if (damage > sd->status.max_hp >> 2)
skill_stop_dancing(sd, 0);
+ if (damage > sd->status.hp)
+ damage = sd->status.hp;
sd->status.hp -= damage;
if (sd->status.hp > 0)
@@ -3779,6 +3781,8 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp)
hp = sd->status.max_hp - sd->status.hp;
if (sp + sd->status.sp > sd->status.max_sp)
sp = sd->status.max_sp - sd->status.sp;
+ if (-hp >= sd->status.hp)
+ hp = -sd->status.hp;
sd->status.hp += hp;
if (sd->status.hp <= 0)
{
@@ -3786,6 +3790,8 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp)
pc_damage(nullptr, sd, 1);
hp = 0;
}
+ if (-sp >= sd->status.sp)
+ sp = sd->status.sp;
sd->status.sp += sp;
if (sd->status.sp <= 0)
sd->status.sp = 0;
@@ -3907,6 +3913,8 @@ int pc_itemheal_effect(dumb_ptr<map_session_data> sd, int hp, int sp)
hp = sd->status.max_hp - sd->status.hp;
if (sp + sd->status.sp > sd->status.max_sp)
sp = sd->status.max_sp - sd->status.sp;
+ if (-hp > sd->status.hp)
+ hp = -sd->status.hp;
sd->status.hp += hp;
if (sd->status.hp <= 0)
{
@@ -4755,9 +4763,11 @@ void pc_calc_pvprank_timer(TimerData *, tick_t, BlockId id)
return;
sd->pvp_timer.cancel();
if (pc_calc_pvprank(sd) > 0)
+ {
sd->pvp_timer = Timer(gettick() + PVP_CALCRANK_INTERVAL,
std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2,
id));
+ }
}
/*==========================================