summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-18 00:52:30 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-18 00:52:30 +0000
commitd9a793b72258ceb8f5465161acf8ba743ca26d89 (patch)
treea701f49d650bae28e019e511e0ba385a7c27606d /crawl-ref
parent6817824379462ee5a1aab8267eb437d2b543504e (diff)
downloadcrawl-ref-d9a793b72258ceb8f5465161acf8ba743ca26d89.tar.gz
crawl-ref-d9a793b72258ceb8f5465161acf8ba743ca26d89.zip
Move cleansing flame (BEAM_HOLY) resistance to the actor interface.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8523 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/beam.cc27
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/mon-util.cc21
-rw-r--r--crawl-ref/source/ouch.cc9
-rw-r--r--crawl-ref/source/player.cc14
5 files changed, 51 insertions, 23 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 938ab464f3..5d0cb96c04 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1789,7 +1789,7 @@ void bolt::hit_wall()
{
// Affect a creature in the wall, if any.
if (!invalid_monster_index(mgrd(pos())))
- affect_monster( &menv[mgrd(pos())] );
+ affect_monster(&menv[mgrd(pos())]);
// Regress for explosions: blow up in an open grid (if regressing
// makes any sense). Also regress when dropping items.
@@ -2248,21 +2248,14 @@ int mons_adjust_flavoured(monsters *monster, bolt &pbolt, int hurted,
}
break;
- case BEAM_HOLY: // flame of cleansing
- // Cleansing flame doesn't hurt holy monsters or monsters your
- // god wouldn't like to be hurt.
- if (mons_is_holy(monster)
- || you.religion == GOD_SHINING_ONE
- && is_unchivalric_attack(&you, monster)
- || is_good_god(you.religion)
- && (is_follower(monster) || mons_neutral(monster)))
- {
+ case BEAM_HOLY:
+ // Cleansing flame.
+ if (monster->res_cleansing_flame() > 0)
hurted = 0;
- }
- else if (mons_is_unholy(monster))
- hurted = (hurted * 3) / 2;
- else if (!mons_is_evil(monster))
+ else if (monster->res_cleansing_flame() == 0)
hurted /= 2;
+ else if (monster->res_cleansing_flame() < -1)
+ hurted = (hurted * 3) / 2;
if (doFlavouredEffects)
{
@@ -3202,11 +3195,8 @@ bool bolt::is_harmless(const monsters *mon) const
case BEAM_DIGGING:
return (true);
- // Cleansing flame doesn't affect player's followers.
case BEAM_HOLY:
- return (mons_is_holy(mon)
- || is_good_god(you.religion)
- && (is_follower(mon) || mons_neutral(mon)));
+ return (mon->res_cleansing_flame() > 0);
case BEAM_STEAM:
return (mons_res_steam(mon) >= 3);
@@ -4061,7 +4051,6 @@ void bolt::handle_stop_attack_prompt(monsters* mon)
}
}
-
void bolt::tracer_nonenchantment_affect_monster(monsters* mon)
{
std::vector<std::string> messages;
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 747c733956..aaadbca58b 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -386,6 +386,7 @@ public:
virtual int res_asphyx() const = 0;
virtual int res_poison() const = 0;
virtual int res_sticky_flame() const = 0;
+ virtual int res_cleansing_flame() const = 0;
virtual int res_negative_energy() const = 0;
virtual int res_rotting() const = 0;
virtual int res_torment() const = 0;
@@ -1093,6 +1094,7 @@ public:
int res_asphyx() const;
int res_poison() const;
int res_sticky_flame() const;
+ int res_cleansing_flame() const;
int res_negative_energy() const;
int res_rotting() const;
int res_torment() const;
@@ -1467,6 +1469,7 @@ public:
int res_asphyx() const;
int res_poison() const;
int res_sticky_flame() const;
+ int res_cleansing_flame() const;
int res_negative_energy() const;
int res_rotting() const;
int res_torment() const;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 88774b1f85..255256d988 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5795,6 +5795,27 @@ int monsters::res_sticky_flame() const
return (mons_res_sticky_flame(this));
}
+int monsters::res_cleansing_flame() const
+{
+ if (mons_is_unholy(this))
+ return (-2);
+
+ if (mons_is_evil(this))
+ return (-1);
+
+ if (mons_is_holy(this)
+ || is_good_god(this->god)
+ || you.religion == GOD_SHINING_ONE
+ && is_unchivalric_attack(&you, this)
+ || is_good_god(you.religion)
+ && (is_follower(this) || mons_neutral(this)))
+ {
+ return (1);
+ }
+
+ return (0);
+}
+
int monsters::res_negative_energy() const
{
return (mons_res_negative_energy(this));
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index d746ef8bf9..53c0021c81 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -218,12 +218,13 @@ int check_your_resists(int hurted, beam_type flavour)
break;
case BEAM_HOLY:
- if (is_good_god(you.religion))
+ // Cleansing flame.
+ if (you.res_cleansing_flame() > 0)
hurted = 0;
- else if (player_is_unholy())
- hurted = (hurted * 3) / 2;
- else if (!is_evil_god(you.religion))
+ else if (you.res_cleansing_flame() == 0)
hurted /= 2;
+ else if (you.res_cleansing_flame() < -1)
+ hurted = (hurted * 3) / 2;
if (hurted == 0)
canned_msg(MSG_YOU_RESIST);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index e567735c3a..4cdf592454 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6829,6 +6829,20 @@ int player::res_sticky_flame() const
return (player_res_sticky_flame());
}
+int player::res_cleansing_flame() const
+{
+ if (player_is_unholy())
+ return (-2);
+
+ if (is_evil_god(you.religion))
+ return (-1);
+
+ if (is_good_god(you.religion))
+ return (1);
+
+ return (0);
+}
+
int player::res_negative_energy() const
{
return (player_prot_life());