summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.h
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-13 05:17:12 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-13 05:17:12 +0000
commita3ba5a8ee29de19bb37c6718f56f5f184d58be6a (patch)
treee2ee6a6a9fb04218050fafcc263739d34c9a4b16 /crawl-ref/source/mon-util.h
parent79c8875dd3844dcc3a027013d536b6d10ddc8480 (diff)
downloadcrawl-ref-a3ba5a8ee29de19bb37c6718f56f5f184d58be6a.tar.gz
crawl-ref-a3ba5a8ee29de19bb37c6718f56f5f184d58be6a.zip
This change breaks savefile compatibility.
Removed speed_inc field from monsterentry struct and added field energy_usage, which lets a monster take different amounts of time for different types of actions, defaulting to 10 points of energy for everything but picking up an object, which defaults to 100% of the monster's speed (the same as before this change). This is currently only used to make curse toes move at half the speed with which they attack (which was previously hard-coded), but is could be used for a lot of interesting things. A related change is that the manner in which apply_enchantment() deals with a monster moving at a different rate than the player has changed for monsters with non-zero-speed. As an example, giant bats have a speed of 30, which means that apply_enchantments() gets called three times per player move if the player is at normal speed; apply_enchantment() has to compensate for this so that a poisoned bat doesn't suffer three times the damage as a monster with speed 10. Monsters being able to do things in energy increments of other than 10 complicated this, and the easiest way to deal with the complication was to keep track of how much energy a monster had recently expended with the new monsters class member ench_countdown, and use that to call apply_enchantments() once for every normal-speed player move (zero-speed monsters are still dealt with in the same manner as before). Because of this, the "spd" variable in apply_enchantment() and decay_enchantment() is normalized to 10 for all non-zero-speed monsters. This doesn't work for ENCH_HELD, since a fast monster should be able to escape from a net more quickly than a slow monster. I've tried to compensate for this, but I'm not sure if I've done it right. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2450 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mon-util.h')
-rw-r--r--crawl-ref/source/mon-util.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index a519bee1d9..12b5807a8e 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -243,6 +243,23 @@ struct mon_attack_def
}
};
+// Amount of monster->speed_increment used by different actions; defaults
+// to 10.
+struct mon_energy_usage
+{
+ char move;
+ char swim;
+ char attack;
+ char missile; // Arrows/crossbows/etc
+ char spell;
+ char special;
+ char item; // Using an item (i.e., drinking a potion)
+
+ // Percent of monster->speed used when picking up an item; defaults
+ // to 100%
+ char pickup_percent;
+};
+
struct monsterentry
{
short mc; // monster number
@@ -278,17 +295,16 @@ struct monsterentry
// hp will be around 135 each time.
unsigned hpdice[4];
- char AC; // armour class
-
- char ev; // evasion
-
- char speed, speed_inc; // duh!
-
+ char AC; // armour class
+ char ev; // evasion
mon_spellbook_type sec;
corpse_effect_type corpse_thingy;
zombie_size_type zombie_size;
shout_type shouts;
mon_intel_type intel;
+
+ char speed; // How quickly speed_increment increases
+ mon_energy_usage energy_usage; // And how quickly it decreases
mon_itemuse_type gmon_use;
size_type size;
};