summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2009-11-04 21:36:26 -0800
committerStefan O'Rear <stefanor@cox.net>2009-11-04 21:36:26 -0800
commit1c4f4dd987fdfe1462aef78550f46ac1f46adf26 (patch)
tree66da0cdfb301dfe28624716b75d31509619bc497 /crawl-ref/source
parent48ab3b1a8d6b8849ffc90bde7ffa2ee0c7ba0aeb (diff)
downloadcrawl-ref-1c4f4dd987fdfe1462aef78550f46ac1f46adf26.tar.gz
crawl-ref-1c4f4dd987fdfe1462aef78550f46ac1f46adf26.zip
Allow each dancing weapon to have its own stats
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/ghost.cc29
-rw-r--r--crawl-ref/source/ghost.h1
-rw-r--r--crawl-ref/source/mon-util.cc1
-rw-r--r--crawl-ref/source/monplace.cc13
-rw-r--r--crawl-ref/source/monster.cc13
-rw-r--r--crawl-ref/source/monster.h1
6 files changed, 57 insertions, 1 deletions
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 60362b318a..2f4825dc52 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -601,6 +601,35 @@ void ghost_demon::ugly_thing_add_resistance(bool very_ugly,
}
}
+void ghost_demon::init_dancing_weapon(const item_def& weapon, int)
+{
+ speed = 15;
+
+ ev = 20;
+
+ ac = 10;
+
+ damage = 30;
+
+ xl = 15;
+
+ max_hp = 15;
+
+ att_type = AT_HIT;
+
+ colour = weapon.colour;
+
+ att_flav = AF_PLAIN;
+
+ fly = FL_LEVITATE;
+
+ resists.hellfire = 3;
+ resists.fire = 3;
+ resists.cold = 3;
+ resists.poison = 3;
+ resists.elec = 1;
+}
+
static spell_type search_first_list(int ignore_spell)
{
for (unsigned i = 0;
diff --git a/crawl-ref/source/ghost.h b/crawl-ref/source/ghost.h
index a2ca84a600..007b1a6ae7 100644
--- a/crawl-ref/source/ghost.h
+++ b/crawl-ref/source/ghost.h
@@ -46,6 +46,7 @@ public:
void init_player_ghost();
void init_ugly_thing(bool very_ugly, bool only_mutate = false,
unsigned char force_colour = BLACK);
+ void init_dancing_weapon(const item_def& weapon, int power);
void ugly_thing_to_very_ugly_thing();
public:
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 4c44cc83b1..f8fedade1a 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -818,6 +818,7 @@ bool mons_is_ghost_demon(int mc)
return (mc == MONS_UGLY_THING
|| mc == MONS_VERY_UGLY_THING
|| mc == MONS_PLAYER_GHOST
+ || mc == MONS_DANCING_WEAPON
|| mc == MONS_PANDEMONIUM_DEMON);
}
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index c461144c9a..b703147753 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -1191,7 +1191,7 @@ static int _place_monster_aux(const mgen_data &mg,
// Dancing weapons *always* have a weapon. Fail to create them
// otherwise.
- const item_def* wpn = mons.weapon();
+ const item_def* wpn = mons.mslot_item(MSLOT_WEAPON);
if (!wpn)
{
mons.destroy_inventory();
@@ -1283,6 +1283,17 @@ static int _place_monster_aux(const mgen_data &mg,
mons.set_ghost(ghost);
mons.pandemon_init();
}
+ else if (mons.type == MONS_DANCING_WEAPON)
+ {
+ ghost_demon ghost;
+ // We can't use monsters::weapon here because it wants to look
+ // at attack types, which are in the ghost structure we're
+ // building.
+ ASSERT( mons.mslot_item(MSLOT_WEAPON) );
+ ghost.init_dancing_weapon(*(mons.mslot_item(MSLOT_WEAPON)), 100);
+ mons.set_ghost(ghost);
+ mons.dancing_weapon_init();
+ }
mark_interesting_monst(&mons, mg.behaviour);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 376e660b81..58b4f53462 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3424,6 +3424,19 @@ void monsters::uglything_init(bool only_mutate)
colour = ghost->colour;
}
+void monsters::dancing_weapon_init()
+{
+ hit_dice = ghost->xl;
+ max_hit_points = ghost->max_hp;
+
+ hit_points = max_hit_points;
+ ac = ghost->ac;
+ ev = ghost->ev;
+ speed = ghost->speed;
+ speed_increment = 70;
+ colour = ghost->colour;
+}
+
void monsters::uglything_mutate(unsigned char force_colour)
{
ghost->init_ugly_thing(type == MONS_VERY_UGLY_THING, true, force_colour);
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index 537320b614..26667a280c 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -188,6 +188,7 @@ public:
void set_ghost(const ghost_demon &ghost, bool has_name = true);
void ghost_init();
void pandemon_init();
+ void dancing_weapon_init();
void uglything_init(bool only_mutate = false);
void uglything_mutate(unsigned char force_colour = BLACK);
void uglything_upgrade();