summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-08 23:34:58 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-08 23:34:58 +0000
commitf25770a09d5b82dedaf3cd21f93d797e4debf7cc (patch)
tree18d750e9b01be1fab2751d40ad2794157200fe24 /crawl-ref
parent65fe4389269de4c14c9b9adbc6ef0308f2059dbd (diff)
downloadcrawl-ref-f25770a09d5b82dedaf3cd21f93d797e4debf7cc.tar.gz
crawl-ref-f25770a09d5b82dedaf3cd21f93d797e4debf7cc.zip
Clean up rotting routines again.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8341 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/externs.h6
-rw-r--r--crawl-ref/source/mon-util.cc20
-rw-r--r--crawl-ref/source/player.cc13
-rw-r--r--crawl-ref/source/spl-cast.cc4
4 files changed, 17 insertions, 26 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index ea5e82a2e2..1956e6bd76 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -334,7 +334,7 @@ public:
virtual bool can_mutate() const = 0;
virtual bool can_safely_mutate() const = 0;
virtual bool mutate() = 0;
- virtual void rot(actor *attacker, int rotlevel, int immed_rot) = 0;
+ virtual void rot(actor *agent, int amount, int immediate = 0) = 0;
virtual int hurt(const actor *attacker, int amount,
beam_type flavour = BEAM_MISSILE,
bool cleanup_dead = true) = 0;
@@ -1071,7 +1071,7 @@ public:
void slow_down(actor *, int str);
void confuse(actor *, int strength);
void heal(int amount, bool max_too = false);
- void rot(actor *attacker, int rotlevel, int immed_rot);
+ void rot(actor *, int amount, int immediate = 0);
int hurt(const actor *attacker, int amount,
beam_type flavour = BEAM_MISSILE,
bool cleanup_dead = true);
@@ -1499,7 +1499,7 @@ public:
void petrify(actor *, int str);
void slow_down(actor *, int str);
void confuse(actor *, int strength);
- void rot(actor *, int rotlevel, int immed_rot);
+ void rot(actor *, int amount, int immediate = 0);
int hurt(const actor *attacker, int amount,
beam_type flavour = BEAM_MISSILE,
bool cleanup_dead = true);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index cc6270add5..43da96b512 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5788,37 +5788,33 @@ god_type monsters::deity() const
return (god);
}
-void monsters::rot(actor *atk, int rotlevel, int immed_rot)
+void monsters::rot(actor *agent, int amount, int immediate)
{
- if (res_rotting() > 0)
+ if (res_rotting() > 0 || amount <= 0)
return;
// Apply immediate damage because we can't handle rotting for
// monsters yet.
- const int damage = immed_rot;
- if (damage > 0)
+ if (immediate > 0)
{
if (mons_near(this) && player_monster_visible(this))
{
mprf("%s %s!", name(DESC_CAP_THE).c_str(),
- rotlevel == 0 ? "looks less resilient" : "rots");
+ amount > 0 ? "rots" : "looks less resilient");
}
- hurt(atk, damage);
+ hurt(agent, immediate);
if (alive())
{
- max_hit_points -= immed_rot * 2;
+ max_hit_points -= immediate * 2;
if (hit_points > max_hit_points)
hit_points = max_hit_points;
}
}
- if (rotlevel > 0)
- {
- add_ench(mon_enchant(ENCH_ROT, std::min(rotlevel, 4),
- atk->kill_alignment()));
- }
+ add_ench(mon_enchant(ENCH_ROT, std::min(amount, 4),
+ agent->kill_alignment()));
}
int monsters::hurt(const actor *agent, int amount, beam_type flavour,
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 866da1261e..e4f94a9a71 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6871,18 +6871,15 @@ void player::drain_stat(int stat, int amount, actor* attacker)
lose_stat(stat, amount, false, "");
}
-void player::rot(actor *who, int rotlevel, int immed_rot)
+void player::rot(actor *who, int amount, int immediate)
{
- if (res_rotting() > 0)
+ if (res_rotting() > 0 || amount <= 0)
return;
- if (rotlevel)
- rot_player(rotlevel);
+ if (immediate)
+ rot_hp(immediate);
- if (immed_rot)
- rot_hp(immed_rot);
-
- if (rotlevel && one_chance_in(4))
+ if (one_chance_in(4))
disease_player(50 + random2(100));
}
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index e62c1a69f5..b024b30525 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -3884,13 +3884,11 @@ void MiscastEffect::_necromancy(int severity)
do_msg();
}
else
- {
torment_monsters(target->pos(), 0, TORMENT_GENERIC);
- }
break;
case 1:
- target->rot(act_source, random2avg(7, 2) + 1, 0);
+ target->rot(act_source, random2avg(7, 2) + 1);
break;
case 2: