summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-10-06 19:38:14 -0500
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-10-06 19:38:14 -0500
commit700ebc8adcd32370d5cc06beab433210b04e8060 (patch)
tree167aab25a1e298d0689ecf50258e60dff58c18a6 /crawl-ref
parent55ba0f6e4d8fd62ea1011426df0499606401006b (diff)
downloadcrawl-ref-700ebc8adcd32370d5cc06beab433210b04e8060.tar.gz
crawl-ref-700ebc8adcd32370d5cc06beab433210b04e8060.zip
Simplify and display resistances for (very) ugly things.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/describe.cc8
-rw-r--r--crawl-ref/source/ghost.cc117
-rw-r--r--crawl-ref/source/ghost.h3
3 files changed, 55 insertions, 73 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 7c52658f6f..fc76e812e2 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2598,10 +2598,12 @@ static std::string _monster_stat_description(const monsters& mon)
std::ostringstream result;
// Don't leak or duplicate resistance information for ghost demon
- // monsters.
+ // monsters, except for (very) ugly things.
const mon_resist_def resist =
- mons_is_ghost_demon(mon.type) ? get_mons_class_resists(mon.type)
- : get_mons_resists(&mon);
+ (mons_is_ghost_demon(mon.type)
+ && mon.type != MONS_UGLY_THING
+ && mon.type != MONS_VERY_UGLY_THING)
+ ? get_mons_class_resists(mon.type) : get_mons_resists(&mon);
const mon_resist_flags resists[] = {
MR_RES_ELEC, MR_RES_POISON, MR_RES_FIRE,
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 02d882d4b9..11d70a9e22 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -511,17 +511,6 @@ void ghost_demon::init_ugly_thing(bool very_ugly, bool only_mutate,
max_hp = hit_points(xl, 3, 5);
}
- resists.elec = 0;
- resists.poison = 0;
- resists.fire = 0;
- resists.cold = 0;
- resists.acid = 0;
- resists.sticky_flame = false;
- resists.rotting = false;
-
- // An ugly thing gets one random resistance.
- ugly_thing_add_resistance();
-
const mon_attack_type att_types[] =
{
AT_BITE, AT_STING, AT_CLAW, AT_PECK, AT_HEADBUTT, AT_PUNCH, AT_KICK,
@@ -543,6 +532,9 @@ void ghost_demon::init_ugly_thing(bool very_ugly, bool only_mutate,
// If this is a very ugly thing, upgrade it properly.
if (very_ugly)
ugly_thing_to_very_ugly_thing();
+
+ // Pick a compatible resistance for this attack flavour.
+ ugly_thing_add_resistance(very_ugly, att_flav);
}
void ghost_demon::ugly_thing_to_very_ugly_thing()
@@ -565,73 +557,60 @@ void ghost_demon::ugly_thing_to_very_ugly_thing()
colour = make_high_colour(colour);
// A very ugly thing sometimes gets an upgraded attack flavour.
- if (one_chance_in(3))
- att_flav = _ugly_thing_flavour_upgrade(att_flav);
-
- // A very ugly thing gets one more random resistance, and another
- // possible resistance based on its upgraded attack flavour.
- ugly_thing_add_resistance();
+ att_flav = _ugly_thing_flavour_upgrade(att_flav);
}
-void ghost_demon::ugly_thing_add_resistance()
+void ghost_demon::ugly_thing_add_resistance(bool very_ugly,
+ mon_attack_flavour u_att_flav)
{
- int res = 0;
+ resists.elec = 0;
+ resists.poison = 0;
+ resists.fire = 0;
+ resists.sticky_flame = false;
+ resists.cold = 0;
+ resists.acid = 0;
+ resists.rotting = false;
- do
+ switch (u_att_flav)
{
- switch (random2(7))
- {
- case 0:
- resists.elec++;
- res++;
- break;
-
- case 1:
- resists.poison++;
- res++;
- break;
-
- case 2:
- resists.fire++;
- res++;
- break;
-
- case 3:
- resists.cold++;
- res++;
- break;
-
- case 4:
- resists.acid++;
- res++;
- break;
-
- case 5:
- if (!resists.sticky_flame)
- {
- resists.sticky_flame = true;
- res++;
- }
- break;
+ case AF_ELEC:
+ resists.elec = (very_ugly ? 2 : 1);
+ break;
- case 6:
- if (!resists.rotting)
- {
- resists.rotting = true;
- res++;
- }
- break;
- }
- }
- while (res == 0);
+ case AF_POISON_NASTY:
+ resists.poison = 1;
+ break;
+
+ case AF_POISON_MEDIUM:
+ resists.poison = 2;
+ break;
+
+ case AF_FIRE:
+ resists.fire = 1;
+ resists.sticky_flame = true;
+ break;
- // Guarantee certain resistances for upgraded attack flavours.
- if (att_flav == AF_POISON_MEDIUM && !resists.poison)
- resists.poison++;
- else if (att_flav == AF_NAPALM && !resists.sticky_flame)
+ case AF_NAPALM:
+ resists.fire = 2;
resists.sticky_flame = true;
- else if (att_flav == AF_ROT && !resists.rotting)
+ break;
+
+ case AF_COLD:
+ resists.cold = (very_ugly ? 2 : 1);
+ break;
+
+ case AF_DISEASE:
+ case AF_ROT:
resists.rotting = true;
+ break;
+
+ case AF_ACID:
+ resists.acid = (very_ugly ? 2 : 1);
+ break;
+
+ default:
+ break;
+ }
}
static spell_type search_first_list(int ignore_spell)
diff --git a/crawl-ref/source/ghost.h b/crawl-ref/source/ghost.h
index db774701d0..29bb6d6c97 100644
--- a/crawl-ref/source/ghost.h
+++ b/crawl-ref/source/ghost.h
@@ -60,7 +60,8 @@ private:
private:
void add_spells();
spell_type translate_spell(spell_type playerspell) const;
- void ugly_thing_add_resistance();
+ void ugly_thing_add_resistance(bool very_ugly,
+ mon_attack_flavour u_att_flav);
};
unsigned char ugly_thing_random_colour();