summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorVsevolod Kozlov <zaba@thorium.homeunix.org>2009-11-05 19:58:50 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-05 19:58:50 +1000
commitb9def0122143459c4d1fd0721384028f3974dc69 (patch)
treef7b26f422d93b6f6769a45cb757c9075279a7c6a /crawl-ref
parent313465bf23382559f7c26c63849b64266c8d939f (diff)
downloadcrawl-ref-b9def0122143459c4d1fd0721384028f3974dc69.tar.gz
crawl-ref-b9def0122143459c4d1fd0721384028f3974dc69.zip
Move *_res(ist)_magic to relevant classes, provide actor interface.
Signed-off-by: Jude Brown <bookofjude@users.sourceforge.net>
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/actor.h2
-rw-r--r--crawl-ref/source/beam.cc8
-rw-r--r--crawl-ref/source/debug.cc2
-rw-r--r--crawl-ref/source/delay.cc2
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/godabil.cc4
-rw-r--r--crawl-ref/source/mon-abil.cc26
-rw-r--r--crawl-ref/source/mon-util.cc78
-rw-r--r--crawl-ref/source/mon-util.h3
-rw-r--r--crawl-ref/source/monster.cc72
-rw-r--r--crawl-ref/source/monster.h2
-rw-r--r--crawl-ref/source/output.cc2
-rw-r--r--crawl-ref/source/player.cc172
-rw-r--r--crawl-ref/source/player.h6
-rw-r--r--crawl-ref/source/spells4.cc6
15 files changed, 190 insertions, 197 deletions
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index a80459a23a..2f46aff6aa 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -180,6 +180,8 @@ public:
virtual int res_holy_energy(const actor *attacker) const = 0;
virtual int res_negative_energy() const = 0;
virtual int res_torment() const = 0;
+ virtual int res_magic() const = 0;
+ virtual bool check_res_magic(int power) = 0;
virtual flight_type flight_mode() const = 0;
virtual bool is_levitating() const = 0;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 5cc2752ab7..5bd71a2898 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2561,7 +2561,7 @@ static bool _monster_resists_mass_enchantment(monsters *monster,
if (monster->holiness() != MH_UNDEAD)
return (true);
- if (check_mons_resist_magic(monster, pow))
+ if (monster->check_res_magic(pow))
{
simple_monster_message(monster,
mons_immune_magic(monster)? " is unaffected."
@@ -2578,7 +2578,7 @@ static bool _monster_resists_mass_enchantment(monsters *monster,
return (true);
}
- if (check_mons_resist_magic(monster, pow))
+ if (monster->check_res_magic(pow))
{
simple_monster_message(monster,
mons_immune_magic(monster)? " is unaffected."
@@ -3705,7 +3705,7 @@ bool bolt::misses_player()
void bolt::affect_player_enchantment()
{
if (flavour != BEAM_POLYMORPH && has_saving_throw()
- && you_resist_magic(ench_power))
+ && you.check_res_magic(ench_power))
{
// You resisted it.
@@ -5005,7 +5005,7 @@ mon_resist_type bolt::try_enchant_monster(monsters *mon)
}
else
{
- if (check_mons_resist_magic(mon, ench_power))
+ if (mon->check_res_magic(ench_power))
return (MON_RESIST);
}
}
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index d2c57506a9..5356ecf878 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -2639,7 +2639,7 @@ void debug_stethoscope(int mon)
mons.experience,
mons.hit_points, mons.max_hit_points,
mons.ac, mons.ev,
- mons_resist_magic( &mons ),
+ mons.res_magic(),
mons.speed, mons.speed_increment,
mons.base_monster != MONS_NO_MONSTER ? " base=" : "",
mons.base_monster != MONS_NO_MONSTER ?
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 5914aa4e5d..c5854a5fad 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -105,7 +105,7 @@ static int _recite_to_monsters(coord_def where, int pow, int, actor *)
resist = std::max(0, 7 - random2(you.skills[SK_INVOCATIONS]));
else
{
- resist = mons_resist_magic(mon);
+ resist = mon->res_magic();
if (holiness == MH_UNDEAD)
pow -= 2 + random2(3);
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 94c765a305..a0edf2bc37 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -4150,7 +4150,7 @@ bool melee_attack::mons_attack_warded_off()
const int warding = defender->warding();
if (warding
&& attacker->is_summoned()
- && !check_mons_resist_magic(attacker_as_monster(), warding))
+ && !attacker_as_monster()->check_res_magic(warding))
{
if (needs_message)
{
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index 3f010cd2ef..3aec727fec 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -524,7 +524,7 @@ static int _lugonu_warp_monster(coord_def where, int pow, int, actor *)
if (!mons_friendly(mon))
behaviour_event(mon, ME_ANNOY, MHITYOU);
- if (check_mons_resist_magic(mon, pow * 2))
+ if (mon->check_res_magic(pow * 2))
{
mprf("%s %s.",
mon->name(DESC_CAP_THE).c_str(), mons_resist_string(mon));
@@ -534,7 +534,7 @@ static int _lugonu_warp_monster(coord_def where, int pow, int, actor *)
const int damage = 1 + random2(pow / 6);
if (mon->type == MONS_BLINK_FROG)
mon->heal(damage, false);
- else if (!check_mons_resist_magic(mon, pow))
+ else if (!mon->check_res_magic(pow))
{
mon->hurt(&you, damage);
if (!mon->alive())
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 93a79b534b..094e64abef 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -455,7 +455,7 @@ bool slime_split_merge(monsters *thing)
// Returns true if you resist the siren's call.
static bool _siren_movement_effect(const monsters *monster)
{
- bool do_resist = (you.attribute[ATTR_HELD] || you_resist_magic(70));
+ bool do_resist = (you.attribute[ATTR_HELD] || you.check_res_magic(70));
if (!do_resist)
{
@@ -1250,7 +1250,7 @@ bool mon_special_ability(monsters *monster, bolt & beem)
// Once mesmerised by a particular monster, you cannot resist
// anymore.
if (!already_mesmerised
- && (you.species == SP_MERFOLK || you_resist_magic(100)))
+ && (you.species == SP_MERFOLK || you.check_res_magic(100)))
{
if (!did_resist)
canned_msg(MSG_YOU_RESIST);
@@ -1390,23 +1390,19 @@ void mon_nearby_ability(monsters *monster)
foe->name(DESC_NOCAP_THE).c_str());
int confuse_power = 2 + random2(3);
-
- if (foe->atype() == ACT_PLAYER
- && you_resist_magic((monster->hit_dice * 5) * confuse_power))
- {
- canned_msg(MSG_YOU_RESIST);
- break;
- }
- else if (foe->atype() == ACT_MONSTER)
+
+ if (foe->check_res_magic((monster->hit_dice * 5) * confuse_power))
{
- const monsters* foe_mons = dynamic_cast<const monsters*>(foe);
- if (check_mons_resist_magic(foe_mons, (monster->hit_dice * 5) * confuse_power))
+ if (foe->atype() == ACT_PLAYER)
+ canned_msg(MSG_YOU_RESIST);
+ else if (foe->atype() == ACT_MONSTER)
{
+ const monsters *foe_mons = dynamic_cast<const monsters*>(foe);
simple_monster_message(foe_mons, mons_resist_string(foe_mons));
- break;
- }
+ }
+ break;
}
-
+
foe->confuse(monster, 2 + random2(3));
}
break;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 52befdeb7f..ca915daeba 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1096,43 +1096,6 @@ bool mons_immune_magic(const monsters *mon)
return (get_monster_data(mon->type)->resist_magic == MAG_IMMUNE);
}
-int mons_resist_magic( const monsters *mon )
-{
- if (mons_immune_magic(mon))
- return MAG_IMMUNE;
-
- int u = (get_monster_data(mon->type))->resist_magic;
-
- // Negative values get multiplied with monster hit dice.
- if (u < 0)
- u = mon->hit_dice * -u * 4 / 3;
-
- // Randarts have a multiplicative effect.
- u *= (scan_mon_inv_randarts( mon, ARTP_MAGIC ) + 100);
- u /= 100;
-
- // ego armour resistance
- const int armour = mon->inv[MSLOT_ARMOUR];
- const int shield = mon->inv[MSLOT_SHIELD];
-
- if (armour != NON_ITEM
- && get_armour_ego_type( mitm[armour] ) == SPARM_MAGIC_RESISTANCE )
- {
- u += 30;
- }
-
- if (shield != NON_ITEM
- && get_armour_ego_type( mitm[shield] ) == SPARM_MAGIC_RESISTANCE )
- {
- u += 30;
- }
-
- if (mon->has_ench(ENCH_LOWERED_MR))
- u /= 2;
-
- return (u);
-}
-
const char* mons_resist_string(const monsters *mon)
{
if ( mons_immune_magic(mon) )
@@ -1141,43 +1104,6 @@ const char* mons_resist_string(const monsters *mon)
return "resists";
}
-// Returns true if the monster made its save against hostile
-// enchantments/some other magics.
-bool check_mons_resist_magic( const monsters *monster, int pow )
-{
- int mrs = mons_resist_magic(monster);
-
- if (mrs == MAG_IMMUNE)
- return (true);
-
- // Evil, evil hack to make weak one hd monsters easier for first
- // level characters who have resistable 1st level spells. Six is
- // a very special value because mrs = hd * 2 * 3 for most monsters,
- // and the weak, low level monsters have been adjusted so that the
- // "3" is typically a 1. There are some notable one hd monsters
- // that shouldn't fall under this, so we do < 6, instead of <= 6...
- // or checking monster->hit_dice. The goal here is to make the
- // first level easier for these classes and give them a better
- // shot at getting to level two or three and spells that can help
- // them out (or building a level or two of their base skill so they
- // aren't resisted as often). -- bwr
- if (mrs < 6 && coinflip())
- return (false);
-
- pow = stepdown_value( pow, 30, 40, 100, 120 );
-
- const int mrchance = (100 + mrs) - pow;
- const int mrch2 = random2(100) + random2(101);
-
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Power: %d, monster's MR: %d, target: %d, roll: %d",
- pow, mrs, mrchance, mrch2 );
-#endif
-
- return (mrch2 < mrchance);
-}
-
bool mons_is_holy(const monsters *mon)
{
return (mon->holiness() == MH_HOLY);
@@ -2580,9 +2506,9 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
if (mon->foe != MHITNOT)
{
if (mon->foe == MHITYOU)
- est_magic_resist = player_res_magic();
+ est_magic_resist = you.res_magic();
else
- est_magic_resist = mons_resist_magic(&menv[mon->foe]);
+ est_magic_resist = menv[mon->foe].res_magic();
// now randomise (normal intels less accurate than high):
if (intel == I_NORMAL)
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 73f46da35d..9e9770eadd 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -500,7 +500,6 @@ int hit_points(int hit_dice, int min_hp, int rand_hp);
int mons_type_hit_dice( int type );
-int mons_resist_magic( const monsters *mon );
int mons_resist_turn_undead( const monsters *mon );
bool mons_immune_magic( const monsters *mon );
const char* mons_resist_string(const monsters *mon);
@@ -662,8 +661,6 @@ void mons_stop_fleeing_from_sanctuary(monsters *monster);
bool mons_has_smite_attack(const monsters *monster);
-bool check_mons_resist_magic(const monsters *monster, int pow);
-
bool mons_class_is_confusable(int mc);
bool mons_class_is_slowable(int mc);
bool mons_class_is_stationary(int mc);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 64c71a0486..705e689ce8 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3154,6 +3154,78 @@ int monsters::res_acid() const
return (get_mons_resists(this).acid);
}
+int monsters::res_magic() const
+{
+ if (mons_immune_magic(this))
+ return MAG_IMMUNE;
+
+ int u = (get_monster_data(this->type))->resist_magic;
+
+ // Negative values get multiplied with monster hit dice.
+ if (u < 0)
+ u = this->hit_dice * -u * 4 / 3;
+
+ // Randarts have a multiplicative effect.
+ u *= (scan_mon_inv_randarts(this, ARTP_MAGIC) + 100);
+ u /= 100;
+
+ // ego armour resistance
+ const int armour = this->inv[MSLOT_ARMOUR];
+ const int _shield = this->inv[MSLOT_SHIELD];
+
+ if (armour != NON_ITEM
+ && get_armour_ego_type( mitm[armour] ) == SPARM_MAGIC_RESISTANCE )
+ {
+ u += 30;
+ }
+
+ if (_shield != NON_ITEM
+ && get_armour_ego_type( mitm[_shield] ) == SPARM_MAGIC_RESISTANCE )
+ {
+ u += 30;
+ }
+
+ if (this->has_ench(ENCH_LOWERED_MR))
+ u /= 2;
+
+ return (u);
+}
+
+bool monsters::check_res_magic(int pow)
+{
+ int mrs = this->res_magic();
+
+ if (mrs == MAG_IMMUNE)
+ return (true);
+
+ // Evil, evil hack to make weak one hd monsters easier for first
+ // level characters who have resistable 1st level spells. Six is
+ // a very special value because mrs = hd * 2 * 3 for most monsters,
+ // and the weak, low level monsters have been adjusted so that the
+ // "3" is typically a 1. There are some notable one hd monsters
+ // that shouldn't fall under this, so we do < 6, instead of <= 6...
+ // or checking monster->hit_dice. The goal here is to make the
+ // first level easier for these classes and give them a better
+ // shot at getting to level two or three and spells that can help
+ // them out (or building a level or two of their base skill so they
+ // aren't resisted as often). -- bwr
+ if (mrs < 6 && coinflip())
+ return (false);
+
+ pow = stepdown_value( pow, 30, 40, 100, 120 );
+
+ const int mrchance = (100 + mrs) - pow;
+ const int mrch2 = random2(100) + random2(101);
+
+#if DEBUG_DIAGNOSTICS
+ mprf(MSGCH_DIAGNOSTICS,
+ "Power: %d, monster's MR: %d, target: %d, roll: %d",
+ pow, mrs, mrchance, mrch2 );
+#endif
+
+ return (mrch2 < mrchance);
+}
+
flight_type monsters::flight_mode() const
{
return (mons_flies(this));
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index 26667a280c..0528163fe4 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -307,6 +307,8 @@ public:
int res_negative_energy() const;
int res_torment() const;
int res_acid() const;
+ int res_magic() const;
+ bool check_res_magic(int power);
flight_type flight_mode() const;
bool is_levitating() const;
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 6447463859..a940e5e870 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2270,7 +2270,7 @@ std::string _status_mut_abilities()
if (you.attribute[ATTR_HELD])
status.push_back("held");
- const int mr = player_res_magic();
+ const int mr = you.res_magic();
snprintf(info, INFO_SIZE, "%s resistant to magic",
(mr < 10) ? "not" :
(mr < 30) ? "slightly" :
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 34ca28d9f9..8dc89b70b7 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -1295,69 +1295,6 @@ bool player_knows_spell(int spell)
return (false);
}
-int player_res_magic(void)
-{
- int rm = 0;
-
- switch (you.species)
- {
- case SP_MOUNTAIN_DWARF:
- case SP_HILL_ORC:
- rm = you.experience_level * 2;
- break;
- default:
- rm = you.experience_level * 3;
- break;
- case SP_HIGH_ELF:
- case SP_SLUDGE_ELF:
- case SP_DEEP_ELF:
- case SP_VAMPIRE:
- case SP_DEMIGOD:
- case SP_OGRE:
- rm = you.experience_level * 4;
- break;
- case SP_NAGA:
- rm = you.experience_level * 5;
- break;
- case SP_PURPLE_DRACONIAN:
- case SP_DEEP_DWARF:
- rm = you.experience_level * 6;
- break;
- case SP_SPRIGGAN:
- rm = you.experience_level * 7;
- break;
- }
-
- // randarts
- rm += scan_artefacts(ARTP_MAGIC);
-
- // armour
- rm += 30 * player_equip_ego_type(EQ_ALL_ARMOUR, SPARM_MAGIC_RESISTANCE);
-
- // rings of magic resistance
- rm += 40 * player_equip(EQ_RINGS, RING_PROTECTION_FROM_MAGIC);
-
- // Enchantment skill
- rm += 2 * you.skills[SK_ENCHANTMENTS];
-
- // Mutations
- rm += 30 * player_mutation_level(MUT_MAGIC_RESISTANCE);
-
- // transformations
- if (you.attribute[ATTR_TRANSFORMATION] == TRAN_LICH)
- rm += 50;
-
- // Trog's Hand
- if (you.attribute[ATTR_DIVINE_REGENERATION])
- rm += 70;
-
- // Enchantment effect
- if (you.duration[DUR_LOWERED_MR])
- rm /= 2;
-
- return (rm);
-}
-
bool player_can_smell()
{
return (you.species != SP_MUMMY);
@@ -2882,28 +2819,6 @@ int burden_change(void)
return (you.burden);
}
-bool you_resist_magic(int power)
-{
- int ench_power = stepdown_value( power, 30, 40, 100, 120 );
-
- int mrchance = 100 + player_res_magic();
-
- mrchance -= ench_power;
-
- int mrch2 = random2(100) + random2(101);
-
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Power: %d, player's MR: %d, target: %d, roll: %d",
- ench_power, player_res_magic(), mrchance, mrch2 );
-#endif
-
- if (mrch2 < mrchance)
- return (true); // ie saved successfully
-
- return (false);
-}
-
// force is true for forget_map command on level map.
void forget_map(unsigned char chance_forgotten, bool force)
{
@@ -4231,7 +4146,7 @@ void display_char_status()
*/
// magic resistance
- const int mr = player_res_magic();
+ const int mr = you.res_magic();
mprf("You are %s resistant to magic.",
(mr < 10) ? "not" :
(mr < 30) ? "slightly" :
@@ -6846,6 +6761,91 @@ int player::res_torment() const
return (player_res_torment());
}
+int player::res_magic() const
+{
+ int rm = 0;
+
+ switch (you.species)
+ {
+ case SP_MOUNTAIN_DWARF:
+ case SP_HILL_ORC:
+ rm = you.experience_level * 2;
+ break;
+ default:
+ rm = you.experience_level * 3;
+ break;
+ case SP_HIGH_ELF:
+ case SP_SLUDGE_ELF:
+ case SP_DEEP_ELF:
+ case SP_VAMPIRE:
+ case SP_DEMIGOD:
+ case SP_OGRE:
+ rm = you.experience_level * 4;
+ break;
+ case SP_NAGA:
+ rm = you.experience_level * 5;
+ break;
+ case SP_PURPLE_DRACONIAN:
+ case SP_DEEP_DWARF:
+ rm = you.experience_level * 6;
+ break;
+ case SP_SPRIGGAN:
+ rm = you.experience_level * 7;
+ break;
+ }
+
+ // randarts
+ rm += scan_artefacts(ARTP_MAGIC);
+
+ // armour
+ rm += 30 * player_equip_ego_type(EQ_ALL_ARMOUR, SPARM_MAGIC_RESISTANCE);
+
+ // rings of magic resistance
+ rm += 40 * player_equip(EQ_RINGS, RING_PROTECTION_FROM_MAGIC);
+
+ // Enchantment skill
+ rm += 2 * you.skills[SK_ENCHANTMENTS];
+
+ // Mutations
+ rm += 30 * player_mutation_level(MUT_MAGIC_RESISTANCE);
+
+ // transformations
+ if (you.attribute[ATTR_TRANSFORMATION] == TRAN_LICH)
+ rm += 50;
+
+ // Trog's Hand
+ if (you.attribute[ATTR_DIVINE_REGENERATION])
+ rm += 70;
+
+ // Enchantment effect
+ if (you.duration[DUR_LOWERED_MR])
+ rm /= 2;
+
+ return (rm);
+}
+
+bool player::check_res_magic(int power)
+{
+ int ench_power = stepdown_value( power, 30, 40, 100, 120 );
+
+ int mrchance = 100 + this->res_magic();
+
+ mrchance -= ench_power;
+
+ int mrch2 = random2(100) + random2(101);
+
+#if DEBUG_DIAGNOSTICS
+ mprf(MSGCH_DIAGNOSTICS,
+ "Power: %d, player's MR: %d, target: %d, roll: %d",
+ ench_power, this->res_magic(), mrchance, mrch2);
+#endif
+
+ if (mrch2 < mrchance)
+ return (true); // ie saved successfully
+
+ return (false);
+}
+
bool player::confusable() const
{
return (player_mental_clarity() == 0);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index f11168d436..fe8940f033 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -424,6 +424,8 @@ public:
int res_holy_energy(const actor *) const;
int res_negative_energy() const;
int res_torment() const;
+ int res_magic() const;
+ bool check_res_magic(int power);
bool confusable() const;
bool slowable() const;
@@ -547,8 +549,6 @@ int player_wielded_item();
bool extrinsic_amulet_effect(jewellery_type amulet);
bool wearing_amulet(jewellery_type which_am, bool calc_unid = true);
-bool you_resist_magic(int power);
-
int burden_change(void);
int carrying_capacity(burden_state_type bs = BS_OVERLOADED);
@@ -610,8 +610,6 @@ int player_res_rotting();
bool player_control_teleport(bool calc_unid = true, bool temp = true,
bool items = true);
-int player_res_magic(void);
-
int player_res_asphyx();
int player_shield_class(void);
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 863acda3d5..84af39d6f3 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -398,7 +398,7 @@ static int _sleep_monsters(coord_def where, int pow, int, actor *)
if (monster->holiness() != MH_NATURAL)
return (0);
- if (check_mons_resist_magic(monster, pow))
+ if (monster->check_res_magic(pow))
return (0);
// Works on friendlies too, so no check for that.
@@ -464,7 +464,7 @@ static int _tame_beast_monsters(coord_def where, int pow, int, actor *)
if (you.species == SP_HILL_ORC && monster->type == MONS_WARG)
pow += (pow / 2);
- if (check_mons_resist_magic(monster, pow))
+ if (monster->check_res_magic(pow))
return 0;
simple_monster_message(monster, " is tamed!");
@@ -872,7 +872,7 @@ int disperse_monsters(coord_def where, int pow, int, actor *)
simple_monster_message(defender, " resists.");
return 1;
}
- else if (check_mons_resist_magic(defender, pow))
+ else if (defender->check_res_magic(pow))
{
// XXX Note that this might affect magic-immunes!
if (coinflip())