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/magic-stmt.cpp | 4 ++++ src/map/mob.cpp | 7 +++++++ src/map/pc.cpp | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp index cbd97a8..9aca511 100644 --- a/src/map/magic-stmt.cpp +++ b/src/map/magic-stmt.cpp @@ -919,12 +919,16 @@ int op_drop_item_for (dumb_ptr, Slice args) GET_ARG_ITEM(1, item, stackable); if (stackable) + { map_addflooritem_any(&item, count, loc->m, loc->x, loc->y, owners, delaytime, interval, 0); + } else + { while (count-- > 0) map_addflooritem_any(&item, 1, loc->m, loc->x, loc->y, owners, delaytime, interval, 0); + } return 0; } diff --git a/src/map/mob.cpp b/src/map/mob.cpp index fad3083..f73dc89 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -272,12 +272,16 @@ void mob_mutate(dumb_ptr md, mob_stat stat, int intensity) int real_intensity2 = (((new_stat - old_stat) << 8) / mut_base); if (real_intensity < 0) + { if (real_intensity2 > real_intensity) real_intensity = real_intensity2; + } if (real_intensity > 0) + { if (real_intensity2 < real_intensity) real_intensity = real_intensity2; + } } real_intensity *= sign; @@ -2457,6 +2461,9 @@ int mob_damage(dumb_ptr src, dumb_ptr md, int damage, } } + if (damage > md->hp) + damage = md->hp; + md->hp -= damage; if (md->hp > 0) 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-70-g09d2