summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/misc.cc2
-rw-r--r--crawl-ref/source/mon-abil.cc4
-rw-r--r--crawl-ref/source/mon-act.cc8
-rw-r--r--crawl-ref/source/mon-behv.cc6
-rw-r--r--crawl-ref/source/mon-cast.cc8
-rw-r--r--crawl-ref/source/mon-util.cc5
-rw-r--r--crawl-ref/source/mon-util.h1
-rw-r--r--crawl-ref/source/monster.cc9
-rw-r--r--crawl-ref/source/monster.h1
-rw-r--r--crawl-ref/source/monstuff.cc4
11 files changed, 25 insertions, 25 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index f2b0635406..d00e4eec61 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -4183,7 +4183,7 @@ void update_level(double elapsedTime)
#endif
// Pacified monsters often leave the level now.
- if (mons_is_pacified(mon) && turns > random2(40) + 21)
+ if (mon->pacified() && turns > random2(40) + 21)
{
make_mons_leave_level(mon);
continue;
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 55a02e4e43..96081d555e 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2775,7 +2775,7 @@ bool mons_is_safe(const monsters *mon, bool want_move,
bool is_safe = (mon->wont_attack()
|| mons_class_flag(mon->type, M_NO_EXP_GAIN)
&& mon->type != MONS_KRAKEN_TENTACLE
- || mons_is_pacified(mon) && dist > 1
+ || mon->pacified() && dist > 1
#ifdef WIZARD
// Wizmode skill setting enforces hiddenness.
|| you.skills[SK_STEALTH] > 27 && dist > 2
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index ab5c2669b2..11a32b6d45 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -1181,7 +1181,7 @@ bool mon_special_ability(monsters *monster, bolt & beem)
// confused, fleeing, or leaving the level.
if (monster->has_ench(ENCH_CONFUSION)
|| mons_is_fleeing(monster)
- || mons_is_pacified(monster)
+ || monster->pacified()
|| monster->friendly()
|| !player_can_hear(monster->pos()))
{
@@ -1283,7 +1283,7 @@ bool _eyeball_will_use_ability (monsters *monster)
return (coinflip()
&& !mons_is_wandering(monster)
&& !mons_is_fleeing(monster)
- && !mons_is_pacified(monster)
+ && !monster->pacified()
&& !player_or_mon_in_sanct(monster));
}
diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc
index b60dbea05f..dd0036c2f4 100644
--- a/crawl-ref/source/mon-act.cc
+++ b/crawl-ref/source/mon-act.cc
@@ -825,7 +825,7 @@ static bool _handle_scroll(monsters *monster)
if (!monster->has_ench(ENCH_TP))
{
if (monster->caught() || mons_is_fleeing(monster)
- || mons_is_pacified(monster))
+ || monster->pacified())
{
simple_monster_message(monster, " reads a scroll.");
monster_teleport(monster, false);
@@ -837,7 +837,7 @@ static bool _handle_scroll(monsters *monster)
case SCR_BLINKING:
if (monster->caught() || mons_is_fleeing(monster)
- || mons_is_pacified(monster))
+ || monster->pacified())
{
if (mons_near(monster))
{
@@ -1484,7 +1484,7 @@ static bool _handle_throw(monsters *monster, bolt & beem)
// Greatly lowered chances if the monster is fleeing or pacified and
// leaving the level.
- if ((mons_is_fleeing(monster) || mons_is_pacified(monster))
+ if ((mons_is_fleeing(monster) || monster->pacified())
&& !one_chance_in(8))
{
return (false);
@@ -2557,7 +2557,7 @@ static bool _is_trap_safe(const monsters *monster, const coord_def& where,
if (trap.type == TRAP_SHAFT && monster->will_trigger_shaft())
{
if (mons_is_fleeing(monster) && intel >= I_NORMAL
- || mons_is_pacified(monster))
+ || monster->pacified())
{
return (true);
}
diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc
index 62cf3b992c..812a796fb7 100644
--- a/crawl-ref/source/mon-behv.cc
+++ b/crawl-ref/source/mon-behv.cc
@@ -1105,7 +1105,7 @@ void handle_behaviour(monsters *mon)
bool isSmart = (mons_intel(mon) > I_ANIMAL);
bool isScared = mon->has_ench(ENCH_FEAR);
bool isMobile = !mons_is_stationary(mon);
- bool isPacified = mons_is_pacified(mon);
+ bool isPacified = mon->pacified();
bool patrolling = mon->is_patrolling();
static std::vector<level_exit> e;
static int e_index = -1;
@@ -1848,7 +1848,7 @@ void behaviour_event(monsters *mon, mon_event_type event, int src,
break;
// Pacified monsters shouldn't change their behaviour.
- if (mons_is_pacified(mon))
+ if (mon->pacified())
break;
// Just set behaviour... foe doesn't change.
@@ -1898,7 +1898,7 @@ void behaviour_event(monsters *mon, mon_event_type event, int src,
const bool wasLurking =
(old_behaviour == BEH_LURK && !mons_is_lurking(mon));
- const bool isPacified = mons_is_pacified(mon);
+ const bool isPacified = mon->pacified();
if ((wasLurking || isPacified)
&& (event == ME_DISTURB || event == ME_ALERT || event == ME_EVAL))
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 2da19d2b8f..c69a029b4a 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1030,7 +1030,7 @@ bool handle_mon_spell(monsters *monster, bolt &beem)
SPELL_MAJOR_HEALING : SPELL_MINOR_HEALING;
finalAnswer = true;
}
- else if (mons_is_fleeing(monster) || mons_is_pacified(monster))
+ else if (mons_is_fleeing(monster) || monster->pacified())
{
// Since the player isn't around, we'll extend the monster's
// normal choices to include the self-enchant slot.
@@ -1074,7 +1074,7 @@ bool handle_mon_spell(monsters *monster, bolt &beem)
// get here... even if the monster is on its last HP. That
// way we don't have to worry about monsters infinitely casting
// Healing on themselves (e.g. orc high priests).
- if ((mons_is_fleeing(monster) || mons_is_pacified(monster))
+ if ((mons_is_fleeing(monster) || monster->pacified())
&& ms_low_hitpoint_cast(monster, hspell_pass[5]))
{
spell_cast = hspell_pass[5];
@@ -1141,7 +1141,7 @@ bool handle_mon_spell(monsters *monster, bolt &beem)
// Setup spell - monsters that are fleeing or pacified
// and leaving the level will always try to choose their
// emergency spell.
- if (mons_is_fleeing(monster) || mons_is_pacified(monster))
+ if (mons_is_fleeing(monster) || monster->pacified())
{
spell_cast = (one_chance_in(5) ? SPELL_NO_SPELL
: hspell_pass[5]);
@@ -1149,7 +1149,7 @@ bool handle_mon_spell(monsters *monster, bolt &beem)
// Pacified monsters leaving the level won't choose
// emergency spells harmful to the area.
if (spell_cast != SPELL_NO_SPELL
- && mons_is_pacified(monster)
+ && monster->pacified()
&& spell_harms_area(spell_cast))
{
spell_cast = SPELL_NO_SPELL;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 64e6e167ff..6c36113b11 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1951,11 +1951,6 @@ int mons_base_damage_brand(const monsters *m)
return (SPWPN_NORMAL);
}
-bool mons_is_pacified(const monsters *m)
-{
- return (m->attitude == ATT_NEUTRAL && testbits(m->flags, MF_GOT_HALF_XP));
-}
-
bool mons_att_wont_attack(mon_attitude_type fr)
{
return (fr == ATT_FRIENDLY || fr == ATT_GOOD_NEUTRAL || fr == ATT_STRICT_NEUTRAL);
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 969c283e78..2520792e7c 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -605,7 +605,6 @@ const char *mons_pronoun(monster_type mon_type, pronoun_type variant,
bool mons_aligned(int m1, int m2);
bool mons_atts_aligned(mon_attitude_type fr1, mon_attitude_type fr2);
-bool mons_is_pacified(const monsters *m);
bool mons_att_wont_attack(mon_attitude_type fr);
mon_attitude_type mons_attitude(const monsters *m);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index b237a8ace3..6610a457a8 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -2871,6 +2871,11 @@ bool monsters::wont_attack() const
return (friendly() || good_neutral() || strict_neutral());
}
+bool monsters::pacified() const
+{
+ return (attitude == ATT_NEUTRAL && testbits(flags, MF_GOT_HALF_XP));
+}
+
int monsters::shield_bonus() const
{
const item_def *shld = const_cast<monsters*>(this)->shield();
@@ -3972,7 +3977,7 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet)
}
// Pacified monsters leave the level when they submerge.
- if (mons_is_pacified(this))
+ if (pacified())
make_mons_leave_level(this);
break;
@@ -5480,7 +5485,7 @@ bool monsters::do_shaft()
// If a pacified monster is leaving the level via a shaft trap, and
// has reached its goal, handle it here.
- if (!mons_is_pacified(this))
+ if (!pacified())
set_transit(lev);
const bool reveal =
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index 9b8742e3c2..a10c3ef2b2 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -343,6 +343,7 @@ public:
bool good_neutral() const;
bool strict_neutral() const;
bool wont_attack() const;
+ bool pacified() const;
bool has_spells() const;
bool has_spell(spell_type spell) const;
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index e9e42685a3..a36b349a03 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1967,7 +1967,7 @@ int monster_die(monsters *monster, killer_type killer,
// KILL_RESET monsters no longer lose their whole inventory, only
// items they were generated with.
- if (mons_is_pacified(monster) || !monster->needs_transit())
+ if (monster->pacified() || !monster->needs_transit())
{
// A banished monster that doesn't go on the transit list
// loses all items.
@@ -2899,7 +2899,7 @@ static void _mons_indicate_level_exit(const monsters *mon)
void make_mons_leave_level(monsters *mon)
{
- if (mons_is_pacified(mon))
+ if (mon->pacified())
{
if (you.can_see(mon))
_mons_indicate_level_exit(mon);