summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-10-24 18:34:36 -0400
committerCharles Otto <ottochar@gmail.com>2009-10-30 20:31:27 -0400
commitd0f35e86de825119d5fa255f6075a55a89f2f20b (patch)
tree577616aaf6a9dc4e6a3f8f3e632a095343ef8551 /crawl-ref/source/mon-util.cc
parent387e5d2db125d6306f6eed6901ce3b504ce44072 (diff)
downloadcrawl-ref-d0f35e86de825119d5fa255f6075a55a89f2f20b.tar.gz
crawl-ref-d0f35e86de825119d5fa255f6075a55a89f2f20b.zip
Preliminary support for slime creatures merging and splitting.
A slime creatures will merge onto an adjacent slime creature if the merge brings it closer to its target, merging only happens when slime creatures aren't wandering, sleeping, or fleeing. A slime creature will split (if it merged previously) if it is at full hp and is resting or wandering. I added a hack to make the experienced gained for merged slime creatures approximately equal to killing however many were merged individually, exp from merged slimes may be too low now. For now the number of slime creatures merged into one J is given explicitly in their description (one-blob slime creature), that should get changed at some point. Damage and maxHP for merged slime creatures are linear with the number merged, an arbitrary cap of 8 is currently in place.
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc40
1 files changed, 38 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 7e8785814b..3e8ab4d865 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1144,6 +1144,12 @@ mon_attack_def mons_attack_spec(const monsters *mon, int attk_number)
attk.flavour = RANDOM_ELEMENT(flavours);
}
+ // Slime creature attacks are multiplied by the number merged.
+ if(mon->mons_species() == MONS_SLIME_CREATURE)
+ {
+ attk.damage *= mon->number;
+ }
+
return (zombified ? downscale_zombie_attack(mon, attk) : attk);
}
@@ -1621,8 +1627,18 @@ int exper_value(const monsters *monster)
// These four are the original arguments.
const int mclass = monster->type;
- const int mHD = monster->hit_dice;
- const int maxhp = monster->max_hit_points;
+ int mHD = monster->hit_dice;
+ int maxhp = monster->max_hit_points;
+
+ // Hacks to make merged slime creatures not worth so much
+ // exp. We will calculate the experience we would get for 1
+ // blob then just multiply it so that exp is linear with blobs
+ // merged. -cao
+ if(monster->mons_species() == MONS_SLIME_CREATURE)
+ {
+ mHD /= monster->number;
+ maxhp /= monster->number;
+ }
// These are some values we care about.
const int speed = mons_base_speed(monster);
@@ -1737,6 +1753,13 @@ int exper_value(const monsters *monster)
x_val /= 10;
}
+ // Slime creature exp hack part 2, scale exp back up by the
+ // number of blobs merged. -cao
+ if(monster->mons_species() == MONS_SLIME_CREATURE)
+ {
+ x_val *= monster->number;
+ }
+
// Reductions for big values. -- bwr
if (x_val > 100)
x_val = 100 + ((x_val - 100) * 3) / 4;
@@ -2182,6 +2205,19 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
break;
}
+ if(mon.mons_species() == MONS_SLIME_CREATURE && desc != DESC_DBNAME)
+ {
+ if (mon.number < 11)
+ {
+ const char* cardinals[] = {"one", "two", "three", "four", "five",
+ "six", "seven", "eight", "nine", "ten"};
+ result += cardinals[mon.number - 1];
+ }
+ else
+ result += make_stringf("%d", mon.number);
+
+ result += "-blob ";
+ }
// Done here to cover cases of undead versions of hydras.
if (mons_species(nametype) == MONS_HYDRA
&& mon.number > 0 && desc != DESC_DBNAME)