summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-16 20:31:49 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-16 20:31:49 +0000
commitd83b15afa188ae4917283ada8aaa32e42810559d (patch)
treea981199dd63ce1f1338e13b4f2756e2e2fce6a71 /crawl-ref/source
parenteb7d5c8d360a5c8ea36e7e504b0f4081eaa24573 (diff)
downloadcrawl-ref-d83b15afa188ae4917283ada8aaa32e42810559d.tar.gz
crawl-ref-d83b15afa188ae4917283ada8aaa32e42810559d.zip
Magic-immune monsters are now "unaffected" by enchantments instead of
"resist"ing them. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1328 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/abl-show.cc3
-rw-r--r--crawl-ref/source/beam.cc20
-rw-r--r--crawl-ref/source/effects.cc3
-rw-r--r--crawl-ref/source/mon-util.cc15
-rw-r--r--crawl-ref/source/mon-util.h3
-rw-r--r--crawl-ref/source/spells2.cc3
-rw-r--r--crawl-ref/source/spells4.cc10
7 files changed, 41 insertions, 16 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 98090b2818..a43a74912f 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -2148,7 +2148,8 @@ static int lugonu_warp_monster(int x, int y, int pow, int)
if (check_mons_resist_magic(&mon, pow * 2))
{
- mprf("%s resists.", mon.name(DESC_CAP_THE).c_str());
+ mprf("%s %s.",
+ mon.name(DESC_CAP_THE).c_str(), mons_resist_string(&mon));
return (1);
}
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 46bbed75a8..d24e07551f 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1813,7 +1813,8 @@ bool mass_enchantment( int wh_enchant, int pow, int origin )
if (check_mons_resist_magic( monster, pow ))
{
- simple_monster_message(monster, " resists.");
+ simple_monster_message(monster, mons_immune_magic(monster) ?
+ " is unaffected." : " resists.");
continue;
}
}
@@ -1821,7 +1822,8 @@ bool mass_enchantment( int wh_enchant, int pow, int origin )
{
if (check_mons_resist_magic( monster, pow ))
{
- simple_monster_message(monster, " resists.");
+ simple_monster_message(monster, mons_immune_magic(monster) ?
+ " is unaffected." : " resists.");
continue;
}
}
@@ -3666,7 +3668,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
if (check_mons_resist_magic( mon, beam.ench_power )
&& !beam.aimed_at_feet)
{
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
}
if (simple_monster_message(mon, " looks slightly unstable."))
@@ -3682,7 +3684,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
if (!beam.aimed_at_feet
&& check_mons_resist_magic( mon, beam.ench_power ))
{
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
}
if (mons_near( mon ) && player_monster_visible( mon ))
@@ -3698,7 +3700,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
return (MON_UNAFFECTED);
if (check_mons_resist_magic( mon, beam.ench_power ))
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
if (monster_polymorph(mon, RANDOM_MONSTER, 100))
beam.obvious_effect = true;
@@ -3709,7 +3711,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
if (beam.flavour == BEAM_BANISH)
{
if (check_mons_resist_magic( mon, beam.ench_power ))
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
if (you.level_type == LEVEL_ABYSS)
{
@@ -3731,7 +3733,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
}
if (check_mons_resist_magic( mon, beam.ench_power ))
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
if (monster_polymorph(mon, MONS_PULSATING_LUMP, 100))
beam.obvious_effect = true;
@@ -3763,7 +3765,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
#endif
if (check_mons_resist_magic( mon, beam.ench_power ))
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
simple_monster_message(mon, " is enslaved.");
beam.obvious_effect = true;
@@ -3807,7 +3809,7 @@ static int affect_monster_enchantment(struct bolt &beam, struct monsters *mon)
&& beam.flavour != BEAM_HEALING
&& beam.flavour != BEAM_INVISIBILITY)
{
- return (MON_RESIST);
+ return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
}
if (beam.flavour == BEAM_PAIN) /* pain/agony */
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 7c51e472d8..b3e4a42f52 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -345,7 +345,8 @@ void mons_direct_effect(struct bolt &pbolt, int i)
break;
case DMNBM_MUTATION:
- if (mons_holiness(monster) != MH_NATURAL)
+ if (mons_holiness(monster) != MH_NATURAL ||
+ mons_immune_magic(monster))
simple_monster_message(monster, " is unaffected.");
else if (check_mons_resist_magic( monster, pbolt.ench_power ))
simple_monster_message(monster, " resists.");
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index e95775b6d8..577cef588a 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -647,8 +647,16 @@ int mons_damage(int mc, int rt)
return smc->attack[rt].damage;
} // end mons_damage()
+bool mons_immune_magic(const monsters *mon)
+{
+ return seekmonster(mon->type)->resist_magic == MAG_IMMUNE;
+}
+
int mons_resist_magic( const monsters *mon )
{
+ if ( mons_immune_magic(mon) )
+ return MAG_IMMUNE;
+
int u = (seekmonster(mon->type))->resist_magic;
// negative values get multiplied with mhd
@@ -671,6 +679,13 @@ int mons_resist_magic( const monsters *mon )
return (u);
} // end mon_resist_magic()
+const char* mons_resist_string(const monsters *mon)
+{
+ if ( mons_immune_magic(mon) )
+ return "is unaffected";
+ else
+ return "resists";
+}
// Returns true if the monster made its save against hostile
// enchantments/some other magics.
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index f8aeb149a2..81ff35b158 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -197,7 +197,8 @@ 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);
// last updated 12may2000 {dlb}
/* ***********************************************************************
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 6e38997f69..f042b7c674 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -745,7 +745,8 @@ void turn_undead(int pow)
{
if (check_mons_resist_magic( monster, pow ))
{
- simple_monster_message( monster, " resists." );
+ simple_monster_message( monster, mons_immune_magic(monster) ?
+ " is unaffected." : " resists." );
continue;
}
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 19a2ff0f22..254428d263 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1447,6 +1447,7 @@ int disperse_monsters(int x, int y, int pow, int message)
}
else if (check_mons_resist_magic(defender, pow))
{
+ // XXX Note that this might affect magic-immunes!
if (coinflip())
{
simple_monster_message(defender, " partially resists.");
@@ -1489,7 +1490,8 @@ static int spell_swap_func(int x, int y, int pow, int message)
if (defender->type == MONS_BLINK_FROG
|| check_mons_resist_magic( defender, pow ))
{
- simple_monster_message( defender, " resists." );
+ simple_monster_message( defender, mons_immune_magic(defender) ?
+ " is unaffected." : " resists." );
}
else
{
@@ -2714,7 +2716,8 @@ void cast_twist(int pow)
// Monster can magically save vs attack.
if (check_mons_resist_magic( &menv[ mons ], pow * 2 ))
{
- simple_monster_message( &menv[ mons ], " resists." );
+ simple_monster_message( &menv[mons], mons_immune_magic(&menv[mons]) ?
+ " is unaffected." : " resists." );
return;
}
@@ -2848,7 +2851,8 @@ void cast_far_strike(int pow)
// augmented with an EV check).
if (check_mons_resist_magic( monster, pow * 2 ))
{
- simple_monster_message( monster, " resists." );
+ simple_monster_message( monster, mons_immune_magic(monster) ?
+ " is unaffected." : " resists." );
return;
}