From 0a768e842faf9a69f576fc9ac92bfa1dd2533d5f Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 30 Jun 2014 22:02:27 -0700 Subject: Invulnerability should not be the default --- src/map/pc.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/map/pc.cpp') 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 src, dumb_ptr 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 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 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 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)); + } } /*========================================== -- cgit v1.2.3-60-g2f50