summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorevktalo <evktalo@users.sourceforge.net>2009-10-03 17:37:02 +0300
committerevktalo <evktalo@users.sourceforge.net>2009-10-03 17:37:02 +0300
commite359cd2b949ed082a68cf346eb8441cd1b483f76 (patch)
tree457af384b9a0a8a8e6d9f57e5f8a6b8e3da48090 /crawl-ref/source
parent0a2a247a5a443328add0b03d5eabf61511d4baf9 (diff)
downloadcrawl-ref-e359cd2b949ed082a68cf346eb8441cd1b483f76.tar.gz
crawl-ref-e359cd2b949ed082a68cf346eb8441cd1b483f76.zip
Generalize the hydra targetting into multitargetting a bit. Extend it to two-headed ogres, ettins, deep elf blademasters, tentacled monstrosities and electric golems. (Thanks, ##crawl!)
Signed-off-by: evktalo <evktalo@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/externs.h1
-rw-r--r--crawl-ref/source/fight.cc2
-rw-r--r--crawl-ref/source/mon-util.cc11
3 files changed, 13 insertions, 1 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 1141e1134f..1649cc383f 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1321,6 +1321,7 @@ public:
// Has a hydra-like variable number of attacks based on mons->number.
bool has_hydra_multi_attack() const;
+ bool has_multitargeting() const;
bool has_ench(enchant_type ench) const;
bool has_ench(enchant_type ench, enchant_type ench2) const;
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 7f5e45feb7..5ccd23b886 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -4965,7 +4965,7 @@ void melee_attack::mons_perform_attack_rounds()
if (!defender->alive() || defender->pos() != pos)
{
if (attacker == defender
- || !attacker_as_monster()->has_hydra_multi_attack())
+ || !attacker_as_monster()->has_multitargeting())
{
break;
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 9f6e384654..fdf3449d45 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -6566,6 +6566,17 @@ bool monsters::has_hydra_multi_attack() const
|| mons_is_zombified(this) && base_monster == MONS_HYDRA);
}
+bool monsters::has_multitargeting() const
+{
+ // Hacky little list for now. evk
+ return (mons_species() == MONS_HYDRA
+ || mons_species() == MONS_ETTIN
+ || mons_species() == MONS_TWO_HEADED_OGRE
+ || mons_species() == MONS_DEEP_ELF_BLADEMASTER
+ || mons_species() == MONS_TENTACLED_MONSTROSITY
+ || mons_species() == MONS_ELECTRIC_GOLEM);
+}
+
bool monsters::has_ench(enchant_type ench) const
{
return (enchantments.find(ench) != enchantments.end());