diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-09-20 14:19:42 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-09-20 14:19:42 +0000 |
commit | 1db426b1b8d3fcfa2122dee47290597bcd63ee91 (patch) | |
tree | 360ef66174eed525363b0b5b07a59d9ba2be2831 /crawl-ref | |
parent | 913179f028b4a254eb5034ef6ce945d07ac5925a (diff) | |
download | crawl-ref-1db426b1b8d3fcfa2122dee47290597bcd63ee91.tar.gz crawl-ref-1db426b1b8d3fcfa2122dee47290597bcd63ee91.zip |
Add monster-specific rotting resistance.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10740 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/debug.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 6 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 8 | ||||
-rw-r--r-- | crawl-ref/source/tags.cc | 15 | ||||
-rw-r--r-- | crawl-ref/source/tags.h | 3 |
6 files changed, 43 insertions, 18 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 0077837804..83d5c00ddc 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -2681,14 +2681,15 @@ void debug_stethoscope(int mon) // Print resistances. mprf(MSGCH_DIAGNOSTICS, "resist: fire=%d cold=%d elec=%d pois=%d neg=%d " - "acid=%d sticky=%s", + "acid=%d sticky=%s rot=%s", mons_res_fire( &mons ), mons_res_cold( &mons ), mons_res_elec( &mons ), mons_res_poison( &mons ), mons_res_negative_energy( &mons ), mons_res_acid( &mons ), - mons_res_sticky_flame( &mons ) ? "yes" : "no"); + mons_res_sticky_flame( &mons ) ? "yes" : "no", + mons_res_rotting( &mons ) ? "yes" : "no"); mprf(MSGCH_DIAGNOSTICS, "ench: %s", mons.describe_enchantments().c_str()); diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index df0fadf14d..069d5d81b8 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -388,9 +388,9 @@ public: virtual int res_asphyx() const = 0; virtual int res_poison() const = 0; virtual int res_sticky_flame() const = 0; + virtual int res_rotting() const = 0; virtual int res_holy_energy(const actor *attacker) const = 0; virtual int res_negative_energy() const = 0; - virtual int res_rotting() const = 0; virtual int res_torment() const = 0; virtual flight_type flight_mode() const = 0; @@ -1115,9 +1115,9 @@ public: int res_asphyx() const; int res_poison() const; int res_sticky_flame() const; + int res_rotting() const; int res_holy_energy(const actor *) const; int res_negative_energy() const; - int res_rotting() const; int res_torment() const; bool confusable() const; bool slowable() const; @@ -1476,9 +1476,9 @@ public: int res_asphyx() const; int res_poison() const; int res_sticky_flame() const; + int res_rotting() const; int res_holy_energy(const actor *) const; int res_negative_energy() const; - int res_rotting() const; int res_torment() const; flight_type flight_mode() const; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index a4394ac806..8bc73d39f9 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1368,6 +1368,14 @@ int mons_res_sticky_flame(const monsters *mon) return (res); } +int mons_res_rotting(const monsters *mon) +{ + int res = get_mons_resists(mon).rotting; + if (mons_holiness(mon) != MH_NATURAL) + res += 1; + return (res); +} + int mons_res_steam(const monsters *mon) { int res = get_mons_resists(mon).steam; @@ -6055,6 +6063,11 @@ int monsters::res_sticky_flame() const return (mons_res_sticky_flame(this)); } +int monsters::res_rotting() const +{ + return (mons_res_rotting(this)); +} + int monsters::res_holy_energy(const actor *attacker) const { if (mons_is_evil(this)) @@ -6080,11 +6093,6 @@ int monsters::res_negative_energy() const return (mons_res_negative_energy(this)); } -int monsters::res_rotting() const -{ - return (mons_holiness(this) == MH_NATURAL ? 0 : 1); -} - int monsters::res_torment() const { const mon_holy_type holy = mons_holiness(this); @@ -9265,7 +9273,7 @@ std::string get_mon_shape_str(const mon_body_shape shape) mon_resist_def::mon_resist_def() : elec(0), poison(0), fire(0), steam(0), cold(0), hellfire(0), - asphyx(0), acid(0), sticky_flame(false), pierce(0), + asphyx(0), acid(0), sticky_flame(false), rotting(false), pierce(0), slice(0), bludgeon(0) { } @@ -9288,7 +9296,7 @@ short mon_resist_def::get_default_res_level(int resist, short level) const mon_resist_def::mon_resist_def(int flags, short level) : elec(0), poison(0), fire(0), steam(0), cold(0), hellfire(0), - asphyx(0), acid(0), sticky_flame(false), pierce(0), + asphyx(0), acid(0), sticky_flame(false), rotting(false), pierce(0), slice(0), bludgeon(0) { for (int i = 0; i < 32; ++i) @@ -9323,6 +9331,7 @@ mon_resist_def::mon_resist_def(int flags, short level) case MR_VUL_BLUDGEON: bludgeon = -nl; break; case MR_RES_STICKY_FLAME: sticky_flame = true; break; + case MR_RES_ROTTING: rotting = true; break; default: break; } @@ -9342,6 +9351,7 @@ const mon_resist_def &mon_resist_def::operator |= (const mon_resist_def &o) slice += o.slice; bludgeon += o.bludgeon; sticky_flame = sticky_flame || o.sticky_flame; + rotting = rotting || o.rotting; return (*this); } diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 7c1664294d..f871a05e5b 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -244,7 +244,11 @@ enum mon_resist_flags // Immune to stickiness of sticky flame. MR_RES_STICKY_FLAME = (1<<17), - MR_RES_STEAM = (1<<18) + + // Immune to rotting. + MR_RES_ROTTING = (1<<18), + + MR_RES_STEAM = (1<<19) }; enum shout_type @@ -383,6 +387,7 @@ struct mon_resist_def short acid; bool sticky_flame; + bool rotting; // Physical damage resists (currently unused) short pierce; @@ -614,6 +619,7 @@ int mons_res_fire(const monsters *mon); int mons_res_steam(const monsters *mon); int mons_res_poison(const monsters *mon); int mons_res_sticky_flame(const monsters *mon); +int mons_res_rotting(const monsters *mon); int mons_res_acid(const monsters *mon); int mons_res_negative_energy(const monsters *mon); int mons_res_miasma(const monsters *mon); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 4d133247f1..c60de53eec 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -190,8 +190,9 @@ static void tag_read_ghost(reader &th, char minorVersion); static void marshallGhost(writer &th, const ghost_demon &ghost); static ghost_demon unmarshallGhost(reader &th, char minorVersion); -static void marshallResists(writer &, const mon_resist_def &); -static void unmarshallResists(reader &, mon_resist_def &); +static void marshallResists(writer &th, const mon_resist_def &res); +static void unmarshallResists(reader &th, mon_resist_def &res, + char minorVersion); static void marshallSpells(writer &, const monster_spells &); static void unmarshallSpells(reader &, monster_spells &); @@ -2403,12 +2404,14 @@ static void marshallResists(writer &th, const mon_resist_def &res) marshallByte(th, res.asphyx); marshallByte(th, res.acid); marshallByte(th, res.sticky_flame); + marshallByte(th, res.rotting); marshallByte(th, res.pierce); marshallByte(th, res.slice); marshallByte(th, res.bludgeon); } -static void unmarshallResists(reader &th, mon_resist_def &res) +static void unmarshallResists(reader &th, mon_resist_def &res, + char minorVersion) { res.elec = unmarshallByte(th); res.poison = unmarshallByte(th); @@ -2419,6 +2422,10 @@ static void unmarshallResists(reader &th, mon_resist_def &res) res.asphyx = unmarshallByte(th); res.acid = unmarshallByte(th); res.sticky_flame = unmarshallByte(th); + + if (minorVersion >= TAG_MINOR_ROTTING) + res.rotting = unmarshallByte(th); + res.pierce = unmarshallByte(th); res.slice = unmarshallByte(th); res.bludgeon = unmarshallByte(th); @@ -2495,7 +2502,7 @@ static ghost_demon unmarshallGhost(reader &th, char minorVersion) ghost.att_flav = static_cast<mon_attack_flavour>( unmarshallShort(th) ); } - unmarshallResists(th, ghost.resists); + unmarshallResists(th, ghost.resists, minorVersion); ghost.spellcaster = unmarshallByte(th); ghost.cycle_colours = unmarshallByte(th); diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index 4828196753..441e3e97bf 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -71,7 +71,8 @@ enum tag_minor_version TAG_MINOR_JELLY = 19, // Remember whether the royal jelly is dead. TAG_ANNOTATE_EXCL = 20, // Store exclusion information for annotations. TAG_MINOR_UGLY = 21, // More ghost bits for (very) ugly things. - TAG_MINOR_VERSION = 21 // Current version. (Keep equal to max.) + TAG_MINOR_ROTTING = 22, // Added monster-specific rotting resistance. + TAG_MINOR_VERSION = 22 // Current version. (Keep equal to max.) }; |