summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-12 18:23:50 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-12 18:24:03 -0800
commit3c1420d0049511a857ff147b6eefdf78b0e1fd0e (patch)
treedd2613a8ddd03e30d2de64778200d8341637c524 /crawl-ref/source
parentb5f8d2289d34d9aca973267ab8234319578b7814 (diff)
downloadcrawl-ref-3c1420d0049511a857ff147b6eefdf78b0e1fd0e.tar.gz
crawl-ref-3c1420d0049511a857ff147b6eefdf78b0e1fd0e.zip
Implement monster swiftness, and give it to Gastronok
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/directn.cc2
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/ghost.cc1
-rw-r--r--crawl-ref/source/item_use.cc1
-rw-r--r--crawl-ref/source/mon-cast.cc6
-rw-r--r--crawl-ref/source/mon-spll.h2
-rw-r--r--crawl-ref/source/mon-util.cc7
-rw-r--r--crawl-ref/source/monster.cc19
8 files changed, 33 insertions, 6 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 78c9f5ce24..3d225bfd6c 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2968,6 +2968,7 @@ static std::string _describe_mons_enchantment(const monsters &mons,
// Suppress silly-looking combinations, even if they're
// internally valid.
if (paralysed && (ench.ench == ENCH_SLOW || ench.ench == ENCH_HASTE
+ || ench.ench == ENCH_SWIFT
|| ench.ench == ENCH_PETRIFIED
|| ench.ench == ENCH_PETRIFYING))
{
@@ -3009,6 +3010,7 @@ static std::string _describe_mons_enchantment(const monsters &mons,
case ENCH_PETRIFIED: return "petrified";
case ENCH_PETRIFYING: return "slowly petrifying";
case ENCH_LOWERED_MR: return "susceptible to magic";
+ case ENCH_SWIFT: return "moving somewhat quickly";
default: return "";
}
}
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 4f0684d1d4..e5f8b56b5d 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1246,6 +1246,7 @@ enum enchant_type
ENCH_AQUATIC_LAND, // Water monsters lose hp while on land.
ENCH_SPORE_PRODUCTION, // 35
ENCH_SLOUCH,
+ ENCH_SWIFT,
// Update enchantment names in mon-util.cc when adding or removing
// enchantments.
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 0bfb9a0938..6cb75f44d0 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -85,6 +85,7 @@ static spell_type search_order_third[] = {
SPELL_DEMONIC_HORDE,
SPELL_HASTE,
SPELL_SUMMON_UGLY_THING,
+ SPELL_SWIFTNESS,
SPELL_SUMMON_ICE_BEAST,
SPELL_ANIMATE_DEAD,
// 10
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 94672df38d..e9a0160bea 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -5065,6 +5065,7 @@ static void _vulnerability_scroll()
const enchant_type lost_enchantments[] = {
ENCH_SLOW,
ENCH_HASTE,
+ ENCH_SWIFT,
ENCH_MIGHT,
ENCH_FEAR,
ENCH_CONFUSION,
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index a07ad8987c..abf7869571 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -784,6 +784,7 @@ bool setup_mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
case SPELL_SUMMON_GREATER_DEMON:
case SPELL_CANTRIP:
case SPELL_BERSERKER_RAGE:
+ case SPELL_SWIFTNESS:
case SPELL_WATER_ELEMENTALS:
case SPELL_FIRE_ELEMENTALS:
case SPELL_AIR_ELEMENTALS:
@@ -1600,6 +1601,11 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast,
monster->go_berserk(true);
return;
+ case SPELL_SWIFTNESS:
+ monster->add_ench(ENCH_SWIFT);
+ simple_monster_message(monster, " seems to move somewhat quicker.");
+ return;
+
case SPELL_SUMMON_SMALL_MAMMALS:
case SPELL_VAMPIRE_SUMMON:
if (spell_cast == SPELL_SUMMON_SMALL_MAMMALS)
diff --git a/crawl-ref/source/mon-spll.h b/crawl-ref/source/mon-spll.h
index e246092c2a..118410f0ab 100644
--- a/crawl-ref/source/mon-spll.h
+++ b/crawl-ref/source/mon-spll.h
@@ -1100,7 +1100,7 @@
{
SPELL_AIRSTRIKE,
SPELL_SLOW,
- SPELL_AIRSTRIKE,
+ SPELL_SWIFTNESS,
SPELL_SUMMON_SMALL_MAMMALS,
SPELL_CANTRIP,
SPELL_AIRSTRIKE,
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 06ec8b7a61..d070c47b98 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2209,6 +2209,7 @@ bool ms_useful_fleeing_out_of_sight( const monsters *mon, spell_type monspell )
switch (monspell)
{
case SPELL_HASTE:
+ case SPELL_SWIFTNESS:
case SPELL_INVISIBILITY:
case SPELL_MINOR_HEALING:
case SPELL_MAJOR_HEALING:
@@ -2369,6 +2370,11 @@ bool ms_waste_of_time( const monsters *mon, spell_type monspell )
ret = true;
break;
+ case SPELL_SWIFTNESS:
+ if (mon->has_ench(ENCH_SWIFT))
+ ret = true;
+ break;
+
case SPELL_INVISIBILITY:
if (mon->has_ench(ENCH_INVIS)
|| mon->friendly() && !you.can_see_invisible(false))
@@ -2522,6 +2528,7 @@ static bool _ms_ranged_spell(spell_type monspell, bool attack_only = false,
case SPELL_INVISIBILITY:
case SPELL_BLINK:
case SPELL_BERSERKER_RAGE:
+ case SPELL_SWIFTNESS:
return (false);
// The animation spells don't work through transparent walls and thus
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 29d192cfd3..0c963631c7 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4207,6 +4207,11 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
simple_monster_message(this, " is no longer moving quickly.");
break;
+ case ENCH_SWIFT:
+ if (!quiet)
+ simple_monster_message(this, " is no longer moving somewhat quickly.");
+ break;
+
case ENCH_MIGHT:
if (!quiet)
simple_monster_message(this, " no longer looks unusually strong.");
@@ -4519,7 +4524,7 @@ void monsters::timeout_enchantments(int levels)
case ENCH_SLOW: case ENCH_HASTE: case ENCH_MIGHT: case ENCH_FEAR:
case ENCH_INVIS: case ENCH_CHARM: case ENCH_SLEEP_WARY:
case ENCH_SICK: case ENCH_SLEEPY: case ENCH_PARALYSIS:
- case ENCH_PETRIFYING: case ENCH_PETRIFIED:
+ case ENCH_PETRIFYING: case ENCH_PETRIFIED: case ENCH_SWIFT:
case ENCH_BATTLE_FRENZY: case ENCH_NEUTRAL:
case ENCH_LOWERED_MR: case ENCH_SOUL_RIPE:
lose_ench_levels(i->second, levels);
@@ -4653,6 +4658,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
case ENCH_SLOW:
case ENCH_HASTE:
+ case ENCH_SWIFT:
case ENCH_MIGHT:
case ENCH_FEAR:
case ENCH_PARALYSIS:
@@ -5616,12 +5622,14 @@ const monsterentry *monsters::find_monsterentry() const
int monsters::action_energy(energy_use_type et) const
{
+ bool swift = has_ench(ENCH_SWIFT);
+
if (const monsterentry *me = find_monsterentry())
{
const mon_energy_usage &mu = me->energy_usage;
switch (et)
{
- case EUT_MOVE: return mu.move;
+ case EUT_MOVE: return mu.move - (swift ? 2 : 0);
case EUT_SWIM:
// [ds] Amphibious monsters get a significant speed boost
// when swimming, as discussed with dpeg. We do not
@@ -5630,9 +5638,9 @@ int monsters::action_energy(energy_use_type et) const
// favour water (HT_AMPHIBIOUS_WATER, such as merfolk), but
// that's something we can think about.
if (mons_amphibious(this))
- return div_rand_round(mu.swim * 7, 10);
+ return div_rand_round(mu.swim * 7, 10) - (swift ? 2 : 0);
else
- return mu.swim;
+ return mu.swim - (swift ? 2 : 0);
case EUT_MISSILE: return mu.missile;
case EUT_ITEM: return mu.item;
case EUT_SPECIAL: return mu.special;
@@ -5885,7 +5893,7 @@ static const char *enchant_names[] =
"short-lived", "paralysis", "sick", "sleep", "fatigue", "held",
"blood-lust", "neutral", "petrifying", "petrified", "magic-vulnerable",
"soul-ripe", "decay", "hungry", "flopping", "spore-producing",
- "downtrodden", "bug"
+ "downtrodden", "swift", "bug"
};
static const char *_mons_enchantment_name(enchant_type ench)
@@ -5986,6 +5994,7 @@ int mon_enchant::calc_duration(const monsters *mons,
switch (ench)
{
case ENCH_HASTE:
+ case ENCH_SWIFT:
case ENCH_MIGHT:
case ENCH_INVIS:
cturn = 1000 / _mod_speed(25, mons->speed);