summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc6
-rw-r--r--crawl-ref/source/effects.cc3
-rw-r--r--crawl-ref/source/fight.cc10
-rw-r--r--crawl-ref/source/makeitem.cc4
-rw-r--r--crawl-ref/source/mon-data.h9
-rw-r--r--crawl-ref/source/mon-util.cc53
-rw-r--r--crawl-ref/source/mon-util.h1
-rw-r--r--crawl-ref/source/monstuff.cc39
-rw-r--r--crawl-ref/source/religion.cc25
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/view.cc10
11 files changed, 74 insertions, 90 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 991179529f..0a84c56902 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2123,7 +2123,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
{
// A casting of invisibility erases backlight.
monster->del_ench(ENCH_BACKLIGHT);
-
+
// Can't use simple_monster_message here, since it checks
// for visibility of the monster (and its now invisible) -- bwr
if (mons_near( monster ))
@@ -2140,7 +2140,7 @@ int mons_ench_f2(monsters *monster, bolt &pbolt)
}
case BEAM_CHARM: /* 9 = charm */
if (you.religion == GOD_SHINING_ONE
- && is_mons_evil_demonic_or_undead(monster))
+ && mons_is_evil_or_unholy(monster))
{
simple_monster_message(monster, " is repulsed!");
return (MON_OTHER);
@@ -4216,7 +4216,7 @@ static int affect_monster_enchantment(bolt &beam, monsters *mon)
death_check = true;
}
- if (beam.flavour == BEAM_ENSLAVE_UNDEAD
+ if (beam.flavour == BEAM_ENSLAVE_UNDEAD
&& mons_holiness(mon) == MH_UNDEAD)
{
#if DEBUG_DIAGNOSTICS
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 4e7a8e51f9..22428a647f 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -112,8 +112,7 @@ bool holy_word(int pow, int caster, bool silent)
if (monster->type == -1 || !mons_near(monster))
continue;
- if (mons_holiness(monster) == MH_UNDEAD
- || mons_holiness(monster) == MH_DEMONIC)
+ if (mons_is_unholy(monster))
{
holy_influenced = true;
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index edb1071324..c9537034ff 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -1918,16 +1918,12 @@ bool melee_attack::apply_damage_brand()
break;
case SPWPN_HOLY_WRATH:
- switch (defender->holiness())
+ if (defender->holiness() == MH_UNDEAD ||
+ defender->holiness() == MH_DEMONIC)
{
- case MH_UNDEAD:
- case MH_DEMONIC:
special_damage = 1 + (random2(damage_done * 15) / 10);
- break;
-
- default:
- break;
}
+
if (special_damage && defender_visible)
{
special_damage_message =
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 1003780b43..ff1af54244 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2853,10 +2853,8 @@ static void give_monster_item(
mthing.link = NON_ITEM;
unset_ident_flags(mthing, ISFLAG_IDENT_MASK);
- const mon_holy_type mholy = mons_holiness(mon);
-
if (get_weapon_brand(mthing) == SPWPN_HOLY_WRATH
- && (mholy == MH_UNDEAD || mholy == MH_DEMONIC))
+ && mons_is_unholy(mon))
{
set_item_ego_type( mthing, OBJ_WEAPONS, SPWPN_NORMAL );
}
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index 9a1a2427cd..c0cc38e97f 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -43,16 +43,15 @@
- mass: if zero, the monster never leaves a corpse (also corpse_thingy)
- genus: base monster "type" for a classed monsters (i.e. jackal as hound)
- species: corpse type of monster (i.e. orc for orc wizard)
- - holiness:
+ - holiness:
MH_HOLY - irritates some gods when killed, immunity from
holy wrath weapons
MH_NATURAL - baseline monster type
MH_UNDEAD - immunity from draining, pain, torment; extra
damage from holy wrath/disruption; affected by
repel undead and holy word
- MH_DEMONIC - similar to undead, but holy wrath does even more
- damage and repel undead effects are ignored -- *no*
- automatic hellfire resistance
+ MH_DEMONIC - similar to undead, but repel undead effects are
+ ignored -- *no* automatic hellfire resistance
MH_NONLIVING - golems and other constructs
MH_PLANT - plants
@@ -82,7 +81,7 @@
CE_CLEAN, can be healthily eaten by non-Ghoul characters
CE_CONTAMINATED, occasionally causes sickness
CE_POISONOUS, hazardous to characters without poison resistance
- CE_HCL, causes rotting
+ CE_HCL, causes rotting in non-Ghoul characters
CE_MUTAGEN_RANDOM, mutagenous
CE_MUTAGEN_GOOD, // may be worth implementing {dlb}
CE_MUTAGEN_BAD, // may be worth implementing {dlb}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 77595aea39..104de1f101 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -879,9 +879,9 @@ int mons_res_elec( const monsters *mon )
bool mons_res_asphyx( const monsters *mon )
{
- const int holiness = mons_holiness( mon );
- return (holiness == MH_UNDEAD
- || holiness == MH_DEMONIC
+ const mon_holy_type holiness = mons_holiness( mon );
+
+ return (mons_is_unholy(mon)
|| holiness == MH_NONLIVING
|| holiness == MH_PLANT
|| get_mons_resists(mon).asphyx > 0);
@@ -1005,18 +1005,18 @@ int mons_res_cold( const monsters *mon )
int mons_res_miasma( const monsters *mon )
{
- return (mons_holiness(mon) != MH_NATURAL
+ return (mons_holiness(mon) != MH_NATURAL
|| mon->type == MONS_DEATH_DRAKE ? 3 : 0);
}
int mons_res_negative_energy( const monsters *mon )
{
int mc = mon->type;
+ const mon_holy_type holiness = mons_holiness( mon );
- if (mons_holiness(mon) == MH_UNDEAD
- || mons_holiness(mon) == MH_DEMONIC
- || mons_holiness(mon) == MH_NONLIVING
- || mons_holiness(mon) == MH_PLANT
+ if (mons_is_unholy(mon)
+ || holiness == MH_NONLIVING
+ || holiness == MH_PLANT
|| mon->type == MONS_SHADOW_DRAGON
|| mon->type == MONS_DEATH_DRAKE
// TSO protects his warriors' life force
@@ -1051,16 +1051,21 @@ bool mons_is_evil( const monsters *mon )
bool mons_is_unholy( const monsters *mon )
{
- const mon_holy_type holy = mons_holiness( mon );
+ const mon_holy_type holiness = mons_holiness( mon );
+
+ return (holiness == MH_UNDEAD || holiness == MH_DEMONIC);
+}
- return (holy == MH_UNDEAD || holy == MH_DEMONIC);
+bool mons_is_evil_or_unholy( const monsters *mons )
+{
+ return (mons_is_evil(mons) || mons_is_unholy(mons));
}
bool mons_has_lifeforce( const monsters *mon )
{
- const int holy = mons_holiness( mon );
+ const mon_holy_type holiness = mons_holiness( mon );
- return (holy == MH_NATURAL || holy == MH_PLANT);
+ return (holiness == MH_NATURAL || holiness == MH_PLANT);
// && !mon->has_ench(ENCH_PETRIFY));
}
@@ -2016,9 +2021,9 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
{
return (true);
}
-
- // Eventually, we'll probably want to be able to have monsters
- // learn which of their elemental bolts were resisted and have those
+
+ // Eventually, we'll probably want to be able to have monsters
+ // learn which of their elemental bolts were resisted and have those
// handled here as well. -- bwr
switch (monspell)
{
@@ -2033,9 +2038,9 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
// We can't just use foe->res_negative_energy() because
// that'll mean monsters can just "know" the player is fully
// life-protected if he has triple life protection.
- const mon_holy_type holy = foe->holiness();
- return (holy == MH_UNDEAD || holy == MH_DEMONIC
- || holy == MH_NONLIVING || holy == MH_PLANT);
+ const mon_holy_type holiness = foe->holiness();
+ return (holiness == MH_UNDEAD || holiness == MH_DEMONIC
+ || holiness == MH_NONLIVING || holiness == MH_PLANT);
}
case SPELL_DISPEL_UNDEAD:
@@ -3143,7 +3148,7 @@ bool monsters::wants_weapon(const item_def &weap) const
{
return (false);
}
-
+
// XXX: Make this check dependent on creature size.
// wimpy monsters (Kob, gob) shouldn't pick up halberds etc
// of course, this also block knives {dlb}:
@@ -3161,16 +3166,10 @@ bool monsters::wants_weapon(const item_def &weap) const
return (false);
}
- const int brand = get_weapon_brand(weap);
- const int holy = holiness();
-
- if (brand == SPWPN_HOLY_WRATH
- && (holy == MH_DEMONIC || holy == MH_UNDEAD))
- {
+ if (get_weapon_brand(weap) == SPWPN_HOLY_WRATH && mons_is_unholy(this))
return (false);
- }
- return (true);
+ return (true);
}
bool monsters::wants_armour(const item_def &item) const
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index e568018f20..183c6be382 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -633,6 +633,7 @@ bool mons_was_seen(const monsters *m);
bool mons_is_known_mimic(const monsters *m);
bool mons_is_evil( const monsters *mon );
bool mons_is_unholy( const monsters *mon );
+bool mons_is_evil_or_unholy( const monsters *mons );
bool mons_is_icy(const monsters *mon);
bool mons_is_icy(int mtype);
bool mons_has_lifeforce( const monsters *mon );
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index c030aa2b15..8a4ffc4942 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -470,7 +470,7 @@ static bool monster_avoided_death(monsters *monster, killer_type killer, int i)
monster->hit_dice,
you.experience_level);
#endif
- if (random2(you.piety) > 30
+ if (random2(you.piety) > piety_breakpoint(0)
&& random2(you.experience_level) >= random2(monster->hit_dice)
// bias beaten-up-conversion towards the stronger orcs.
&& random2(monster->hit_dice) > 2)
@@ -482,13 +482,6 @@ static bool monster_avoided_death(monsters *monster, killer_type killer, int i)
return (false);
}
-bool is_mons_evil_demonic_or_undead(monsters *mons)
-{
- return (mons_holiness(mons) == MH_UNDEAD
- || mons_holiness(mons) == MH_DEMONIC
- || mons_is_evil(mons));
-}
-
static bool is_mons_mutator_or_rotter(monsters *mons)
{
if (mons->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER))
@@ -710,7 +703,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
|| (!created_friendly && gives_xp
&& (you.religion == GOD_MAKHLEB
|| you.religion == GOD_SHINING_ONE
- && is_mons_evil_demonic_or_undead(monster))
+ && mons_is_evil_or_unholy(monster))
&& (!player_under_penance() &&
random2(you.piety) >= piety_breakpoint(0))))
{
@@ -725,7 +718,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
if (!created_friendly && gives_xp
&& (you.religion == GOD_MAKHLEB || you.religion == GOD_VEHUMET
|| you.religion == GOD_SHINING_ONE
- && is_mons_evil_demonic_or_undead(monster))
+ && mons_is_evil_or_unholy(monster))
&& (!player_under_penance()
&& random2(you.piety) >= piety_breakpoint(0)))
{
@@ -807,15 +800,15 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
if (mons_class_flag( monster->type, M_EVIL ))
{
- notice |=
- did_god_conduct(
+ notice |=
+ did_god_conduct(
DID_NATURAL_EVIL_KILLED_BY_SERVANT,
monster->hit_dice );
}
}
else if (targ_holy == MH_DEMONIC)
{
- notice |= did_god_conduct( DID_DEMON_KILLED_BY_SERVANT,
+ notice |= did_god_conduct( DID_DEMON_KILLED_BY_SERVANT,
monster->hit_dice );
}
else if (targ_holy == MH_UNDEAD)
@@ -828,17 +821,18 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
// Angel kills are always noticed.
if (targ_holy == MH_HOLY)
{
- notice |= did_god_conduct( DID_ANGEL_KILLED_BY_SERVANT,
+ notice |= did_god_conduct( DID_ANGEL_KILLED_BY_SERVANT,
monster->hit_dice );
}
- if (you.religion == GOD_VEHUMET
+ if (you.religion == GOD_VEHUMET
&& notice
- && (!player_under_penance() && random2(you.piety) >= 30))
+ && (!player_under_penance()
+ && random2(you.piety) >= piety_breakpoint(0)))
{
- /* Vehumet - only for non-undead servants (coding
- convenience, no real reason except that Vehumet
- prefers demons) */
+ // Vehumet - only for non-undead servants (coding
+ // convenience, no real reason except that Vehumet
+ // prefers demons)
if (you.magic_points < you.max_magic_points)
{
mpr("You feel your power returning.");
@@ -847,8 +841,9 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent)
}
if (you.religion == GOD_SHINING_ONE
- && is_mons_evil_demonic_or_undead(monster)
- && (!player_under_penance() && random2(you.piety) >= 30)
+ && mons_is_evil_or_unholy(monster)
+ && (!player_under_penance()
+ && random2(you.piety) >= piety_breakpoint(0))
&& i != ANON_FRIENDLY_MONSTER
&& i >= 0 && i < MAX_MONSTERS)
{
@@ -5150,7 +5145,7 @@ static bool is_native_in_branch(const monsters *monster,
// randomize potential damage
static int estimated_trap_damage(trap_type trap)
{
- switch (trap)
+ switch (trap)
{
case TRAP_BLADE:
return (10 + random2(30));
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 7cb079748f..f6b737fd25 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1667,7 +1667,7 @@ bool did_god_conduct( conduct_type thing_done, int level, bool known,
#if DEBUG_DIAGNOSTICS
if (ret)
{
- static const char *conducts[] =
+ static const char *conducts[] =
{
"",
"Necromancy", "Unholy", "Attack Holy", "Attack Friend",
@@ -3532,7 +3532,7 @@ void altar_prayer(void)
&& you.piety > 160)
{
const int wpn = get_player_wielded_weapon();
-
+
if (wpn != -1 && get_weapon_brand(you.inv[wpn]) != SPWPN_DISTORTION)
bless_weapon(GOD_LUGONU, SPWPN_DISTORTION, RED);
}
@@ -3544,20 +3544,19 @@ bool god_hates_attacking_friend(god_type god, const actor *fr)
{
if (!fr || fr->kill_alignment() != KC_FRIENDLY)
return (false);
-
+
switch (god)
{
- case GOD_ZIN:
- case GOD_SHINING_ONE:
- case GOD_ELYVILON:
- case GOD_OKAWARU:
- return (true);
-
- case GOD_BEOGH: // added penance to avoid killings for loot
- return (fr && mons_species(fr->id()) == MONS_ORC);
+ case GOD_ZIN:
+ case GOD_SHINING_ONE:
+ case GOD_ELYVILON:
+ case GOD_OKAWARU:
+ return (true);
+ case GOD_BEOGH: // added penance to avoid killings for loot
+ return (mons_species(fr->id()) == MONS_ORC);
- default:
- return (false);
+ default:
+ return (false);
}
}
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 152f8e61ab..2605aa2de5 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1070,9 +1070,7 @@ int vampiric_drain(int pow, const dist &vmove)
monster = &menv[mgr];
- const int holy = mons_holiness(monster);
-
- if (holy == MH_UNDEAD || holy == MH_DEMONIC)
+ if (mons_is_unholy(monster))
{
mpr("Aaaarggghhhhh!");
dec_hp(random2avg(39, 2) + 10, false, "vampiric drain backlash");
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 6703b11f27..305b66777e 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -1215,11 +1215,11 @@ bool check_awaken(monsters* monster)
if (you.duration[DUR_BERSERKER])
return (true);
- // Repel undead is a holy aura, to which evil creatures are sensitive.
- // Note that even though demons aren't affected by repel undead, they
- // do sense this type of divine aura. -- bwr
- if (you.duration[DUR_REPEL_UNDEAD]
- && (mon_holy == MH_UNDEAD || mon_holy == MH_DEMONIC))
+ // Repel undead is a holy aura, to which undead and demonic
+ // creatures are sensitive. Note that even though demons aren't
+ // affected by repel undead, they do sense this type of divine aura.
+ // -- bwr
+ if (you.duration[DUR_REPEL_UNDEAD] && mons_is_unholy(monster))
{
return (true);
}