summaryrefslogtreecommitdiff
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
parentaa4df026d44bd205f8bfce8a3b8d6a1144332f32 (diff)
downloadtmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.tar.gz
tmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.tar.bz2
tmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.tar.xz
tmwa-0a768e842faf9a69f576fc9ac92bfa1dd2533d5f.zip
Invulnerability should not be the default
-rw-r--r--src/map/magic-stmt.cpp4
-rw-r--r--src/map/mob.cpp7
-rw-r--r--src/map/pc.cpp10
3 files changed, 21 insertions, 0 deletions
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<env_t>, Slice<val_t> 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<mob_data> 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<block_list> src, dumb_ptr<mob_data> 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<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));
+ }
}
/*==========================================