diff options
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 15 |
1 files changed, 15 insertions, 0 deletions
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. |