summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Kozlov <zaba@thorium.homeunix.org>2009-11-07 17:33:57 +0300
committerCharles Otto <ottochar@gmail.com>2009-11-07 10:42:15 -0500
commit2ac4093ff9bbefed1ba51a3865507ac49a419bbd (patch)
tree70540da625559c02abc8094107f6a651c7e26f41
parent96b804bb7a2bdc6ad25c6b45975bc0d4c8f19fbb (diff)
downloadcrawl-ref-2ac4093ff9bbefed1ba51a3865507ac49a419bbd.tar.gz
crawl-ref-2ac4093ff9bbefed1ba51a3865507ac49a419bbd.zip
Replace mons_is_summoned with monsters::is_summoned.
Signed-off-by: Charles Otto <ottochar@gmail.com>
-rw-r--r--crawl-ref/source/attitude-change.cc4
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/decks.cc2
-rw-r--r--crawl-ref/source/describe.cc2
-rw-r--r--crawl-ref/source/directn.cc4
-rw-r--r--crawl-ref/source/mon-util.cc56
-rw-r--r--crawl-ref/source/mon-util.h2
-rw-r--r--crawl-ref/source/monster.cc51
-rw-r--r--crawl-ref/source/monstuff.cc11
-rw-r--r--crawl-ref/source/spells1.cc2
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/traps.cc2
-rw-r--r--crawl-ref/source/xom.cc4
13 files changed, 69 insertions, 77 deletions
diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc
index 5af5a8e753..be4781a81c 100644
--- a/crawl-ref/source/attitude-change.cc
+++ b/crawl-ref/source/attitude-change.cc
@@ -74,7 +74,7 @@ void beogh_follower_convert(monsters *monster, bool orc_hit)
if (you.religion == GOD_BEOGH
&& monster->foe == MHITYOU
&& mons_species(monster->type) == MONS_ORC
- && !mons_is_summoned(monster)
+ && !monster->is_summoned()
&& !mons_is_shapeshifter(monster)
&& !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT)
&& !monster->friendly()
@@ -108,7 +108,7 @@ void beogh_follower_convert(monsters *monster, bool orc_hit)
void slime_convert(monsters* monster)
{
if (you.religion == GOD_JIYVA && mons_is_slime(monster)
- && !mons_is_summoned(monster)
+ && !monster->is_summoned()
&& !mons_is_shapeshifter(monster)
&& !monster->neutral()
&& !monster->friendly()
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index e56f9daf7a..365cf050bd 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -4846,7 +4846,7 @@ void bolt::affect_monster(monsters* mon)
// we might bleed on the floor.
if (!engulfs
&& (flavour == BEAM_MISSILE || flavour == BEAM_MMISSILE)
- && !mons_is_summoned(mon) && !mon->submerged())
+ && !mon->is_summoned() && !mon->submerged())
{
// Using raw_damage instead of the flavoured one!
// assumes DVORP_PIERCING, factor: 0.5
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index b4ab338d39..04c15feea8 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -2546,7 +2546,7 @@ static void _crusade_card(int power, deck_rarity_type rarity)
if (is_good_god(you.religion)
|| you.religion == GOD_BEOGH
&& mons_species(monster->type) == MONS_ORC
- && !mons_is_summoned(monster)
+ && !monster->is_summoned()
&& !mons_is_shapeshifter(monster))
{
// Prevent assertion if the monster was
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 06cec644af..19783947ab 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2886,7 +2886,7 @@ void get_monster_db_desc(const monsters& mons, describe_info &inf,
<< " is incapable of using stairs.$";
}
- if (mons_is_summoned(&mons) && mons.type != MONS_RAKSHASA_FAKE)
+ if (mons.is_summoned() && mons.type != MONS_RAKSHASA_FAKE)
{
inf.body << "$" << "This monster has been summoned, and is thus only "
"temporary. Killing it yields no experience, nutrition "
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 1152999ce0..efd865515b 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -3138,7 +3138,7 @@ static std::string _get_monster_desc(const monsters *mon)
else if (mon->neutral()) // don't differentiate between permanent or not
text += pronoun + " is indifferent to you.\n";
- if (mons_is_summoned(mon) && mon->type != MONS_RAKSHASA_FAKE)
+ if (mon->is_summoned() && mon->type != MONS_RAKSHASA_FAKE)
text += pronoun + " has been summoned.\n";
if (mon->haloed())
@@ -3236,7 +3236,7 @@ std::string get_monster_equipment_desc(const monsters *mon, bool full_desc,
else if (mon->neutral())
str = "neutral";
- if (mons_is_summoned(mon))
+ if (mon->is_summoned())
{
if (!str.empty())
str += ", ";
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index d0c92dd753..c9994f5896 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -917,7 +917,7 @@ bool mons_class_can_be_zombified(int mc)
bool mons_can_be_zombified(const monsters *mon)
{
return (mons_class_can_be_zombified(mon->type)
- && !mons_is_summoned(mon)
+ && !mon->is_summoned()
&& !mons_enslaved_body_and_soul(mon));
}
@@ -1901,58 +1901,6 @@ bool mons_self_destructs(const monsters *m)
return (m->type == MONS_GIANT_SPORE || m->type == MONS_BALL_LIGHTNING);
}
-bool mons_is_summoned(const monsters *m, int *duration, int *summon_type)
-{
- const mon_enchant abj = m->get_ench(ENCH_ABJ);
- if (abj.ench == ENCH_NONE)
- {
- if (duration != NULL)
- *duration = -1;
- if (summon_type != NULL)
- *summon_type = 0;
-
- return (false);
- }
- if (duration != NULL)
- *duration = abj.duration;
-
- const mon_enchant summ = m->get_ench(ENCH_SUMMON);
- if (summ.ench == ENCH_NONE)
- {
- if (summon_type != NULL)
- *summon_type = 0;
-
- return (true);
- }
- if (summon_type != NULL)
- *summon_type = summ.degree;
-
- switch (summ.degree)
- {
- // Temporarily dancing weapons are really there.
- case SPELL_TUKIMAS_DANCE:
-
- // A corpse/skeleton which was temporarily animated.
- case SPELL_ANIMATE_DEAD:
- case SPELL_ANIMATE_SKELETON:
-
- // Fire vortices are made from real fire.
- case SPELL_FIRE_STORM:
-
- // Clones aren't really summoned (though their equipment might be).
- case MON_SUMM_CLONE:
-
- // Nor are body parts.
- case SPELL_KRAKEN_TENTACLES:
-
- // Some object which was animated, and thus not really summoned.
- case MON_SUMM_ANIMATE:
- return (false);
- }
-
- return (true);
-}
-
bool mons_is_shapeshifter(const monsters *m)
{
return (m->has_ench(ENCH_GLOWING_SHAPESHIFTER, ENCH_SHAPESHIFTER));
@@ -2119,7 +2067,7 @@ void mons_pacify(monsters *mon)
mon->attitude = ATT_NEUTRAL;
mon->flags |= MF_WAS_NEUTRAL;
- if (!testbits(mon->flags, MF_GOT_HALF_XP) && !mons_is_summoned(mon))
+ if (!testbits(mon->flags, MF_GOT_HALF_XP) && !mon->is_summoned())
{
// Give the player half of the monster's XP.
unsigned int exp_gain = 0, avail_gain = 0;
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 0e2dcfab7a..6e1728fcfe 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -524,8 +524,6 @@ bool mons_is_demon( int mc );
bool mons_class_wields_two_weapons(int mc);
bool mons_wields_two_weapons(const monsters *m);
bool mons_self_destructs(const monsters *m);
-bool mons_is_summoned(const monsters *m, int* duration = NULL,
- int *summon_info = NULL);
bool mons_is_shapeshifter(const monsters *m);
mon_intel_type mons_class_intel(int mc);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index b5e92c2cf7..aa756c120e 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3703,7 +3703,7 @@ bool monsters::needs_transit() const
|| you.level_type == LEVEL_DUNGEON
&& hit_dice > 8 + random2(25)
&& mons_can_use_stairs(this))
- && !mons_is_summoned(this));
+ && !is_summoned());
}
void monsters::set_transit(const level_id &dest)
@@ -4973,7 +4973,54 @@ void monsters::mark_summoned(int longevity, bool mark_items, int summon_type)
bool monsters::is_summoned(int* duration, int* summon_type) const
{
- return mons_is_summoned(this, duration, summon_type);
+ const mon_enchant abj = get_ench(ENCH_ABJ);
+ if (abj.ench == ENCH_NONE)
+ {
+ if (duration != NULL)
+ *duration = -1;
+ if (summon_type != NULL)
+ *summon_type = 0;
+
+ return (false);
+ }
+ if (duration != NULL)
+ *duration = abj.duration;
+
+ const mon_enchant summ = get_ench(ENCH_SUMMON);
+ if (summ.ench == ENCH_NONE)
+ {
+ if (summon_type != NULL)
+ *summon_type = 0;
+
+ return (true);
+ }
+ if (summon_type != NULL)
+ *summon_type = summ.degree;
+
+ switch (summ.degree)
+ {
+ // Temporarily dancing weapons are really there.
+ case SPELL_TUKIMAS_DANCE:
+
+ // A corpse/skeleton which was temporarily animated.
+ case SPELL_ANIMATE_DEAD:
+ case SPELL_ANIMATE_SKELETON:
+
+ // Fire vortices are made from real fire.
+ case SPELL_FIRE_STORM:
+
+ // Clones aren't really summoned (though their equipment might be).
+ case MON_SUMM_CLONE:
+
+ // Nor are body parts.
+ case SPELL_KRAKEN_TENTACLES:
+
+ // Some object which was animated, and thus not really summoned.
+ case MON_SUMM_ANIMATE:
+ return (false);
+ }
+
+ return (true);
}
void monsters::apply_enchantments()
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index f549758e08..ad93c3e5d1 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -280,7 +280,7 @@ monster_type fill_out_corpse(const monsters* monster, item_def& corpse,
corpse.clear();
int summon_type;
- if (mons_is_summoned(monster, NULL, &summon_type)
+ if (monster->is_summoned(NULL, &summon_type)
|| (monster->flags & (MF_BANISHED | MF_HARD_RESET)))
{
return (MONS_NO_MONSTER);
@@ -743,7 +743,7 @@ static bool _beogh_forcibly_convert_orc(monsters *monster, killer_type killer,
{
if (you.religion == GOD_BEOGH
&& mons_species(monster->type) == MONS_ORC
- && !mons_is_summoned(monster) && !mons_is_shapeshifter(monster)
+ && !monster->is_summoned() && !mons_is_shapeshifter(monster)
&& !player_under_penance() && you.piety >= piety_breakpoint(2)
&& mons_near(monster))
{
@@ -1332,8 +1332,7 @@ int monster_die(monsters *monster, killer_type killer,
int summon_type = 0;
int duration = 0;
- const bool summoned = mons_is_summoned(monster, &duration,
- &summon_type);
+ const bool summoned = monster->is_summoned(&duration, &summon_type);
const int monster_killed = monster_index(monster);
const bool hard_reset = testbits(monster->flags, MF_HARD_RESET);
const bool gives_xp = (!summoned && !mons_class_flag(monster->type,
@@ -1895,7 +1894,7 @@ int monster_die(monsters *monster, killer_type killer,
{
// A banished monster that doesn't go on the transit list
// loses all items.
- if (!mons_is_summoned(monster))
+ if (!monster->is_summoned())
monster->destroy_inventory();
break;
}
@@ -1956,7 +1955,7 @@ int monster_die(monsters *monster, killer_type killer,
"back into the water like the carrion they now are.");
}
}
- else if (!mons_is_summoned(monster))
+ else if (!monster->is_summoned())
{
if (mons_genus(monster->type) == MONS_MUMMY)
_mummy_curse(monster, killer, killer_index);
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 1b067f505c..835030f6eb 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -818,7 +818,7 @@ static int _healing_spell(int healed, bool divine_ability,
did_something = true;
const bool is_holy = mons_is_holy(monster);
- const bool is_summoned = mons_is_summoned(monster);
+ const bool is_summoned = monster->is_summoned();
int pgain = 0;
if (!is_holy && !is_summoned && you.piety < MAX_PIETY)
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 034e891c6c..0ec3313248 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -696,7 +696,7 @@ void drain_life(int pow)
const int hurted = 3 + random2(7) + random2(pow);
behaviour_event(monster, ME_WHACK, MHITYOU, you.pos());
- if (!mons_is_summoned(monster))
+ if (!monster->is_summoned())
hp_gain += hurted;
monster->hurt(&you, hurted);
@@ -775,7 +775,7 @@ bool vampiric_drain(int pow, const dist &vmove)
return (false);
}
- const bool mons_was_summoned = mons_is_summoned(monster);
+ const bool mons_was_summoned = monster->is_summoned();
monster->hurt(&you, hp_gain);
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index b8230dfdff..ed54548df7 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -488,7 +488,7 @@ void trap_def::trigger(actor& triggerer, bool flat_footed)
if (damage_taken < 0)
damage_taken = 0;
- if (!mons_is_summoned(m))
+ if (!m->is_summoned())
bleed_onto_floor(m->pos(), m->type, damage_taken, true);
m->hurt(NULL, damage_taken);
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 4f2fadc827..0edc00cb39 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1551,7 +1551,7 @@ static int _xom_swap_weapons(bool debug = false)
if (!you.see_cell(m->pos()))
continue;
- if (!wpn || mons_wont_attack(m) || mons_is_summoned(m)
+ if (!wpn || mons_wont_attack(m) || m->is_summoned()
|| mons_itemuse(m) < MONUSE_STARTING_EQUIPMENT
|| (m->flags & MF_HARD_RESET))
{
@@ -1751,7 +1751,7 @@ static int _xom_animate_monster_weapon(int sever, bool debug = false)
if (!you.see_cell(m->pos()))
continue;
- if (mons_wont_attack(m) || mons_is_summoned(m)
+ if (mons_wont_attack(m) || m->is_summoned()
|| mons_itemuse(m) < MONUSE_STARTING_EQUIPMENT
|| (m->flags & MF_HARD_RESET))
{