From d83b15afa188ae4917283ada8aaa32e42810559d Mon Sep 17 00:00:00 2001 From: haranp Date: Mon, 16 Apr 2007 20:31:49 +0000 Subject: 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 --- crawl-ref/source/mon-util.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crawl-ref/source/mon-util.cc') 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. -- cgit v1.2.3-54-g00ecf