summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monplace.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-09 14:24:11 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-09 14:24:11 +0000
commitf2a95ba0d453ba6685ed29201beda8a2f703ab79 (patch)
treee7201beb995472236921334a363644e5782d648b /crawl-ref/source/monplace.cc
parent447bc8ac9d8557be01da02c40349e4301f42c089 (diff)
downloadcrawl-ref-f2a95ba0d453ba6685ed29201beda8a2f703ab79.tar.gz
crawl-ref-f2a95ba0d453ba6685ed29201beda8a2f703ab79.zip
Monsters get multilevel resists (incomplete). Monster data needs to be
adjusted per monster to hand out the right resists. The current MR_RES_FIRE gives one level of resistance only. Added a real ghost structure, discarded the old ghost values array. Adjusted bones file format so bones will work out-of-the-box with Hearse. Breaks bones format, older bones will be rejected. Fixed some maps with bad DEPTHs. Added more safe answers in Y/N prompts, added a check to make it less likely that Crawl will spin in a tight loop reading input from a closed tty. (Experimental) !a will override existing foe of friendlies in LOS. Blademasters no longer pick up stuff to throw (Erik). Zombies of swimming things are also swimming things. Currently applies only to zombies explicitly placed in .des files, since fish zombies cannot be generated otherwise (can of worms). Morgue is now saved before showing the inventory and other boring end-of-game stuff. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3231 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monplace.cc')
-rw-r--r--crawl-ref/source/monplace.cc41
1 files changed, 22 insertions, 19 deletions
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index c2485d3824..ceec4e4890 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -15,6 +15,7 @@
#include "branch.h"
#include "externs.h"
+#include "ghost.h"
#include "lev-pand.h"
#include "makeitem.h"
#include "monstuff.h"
@@ -77,7 +78,9 @@ bool grid_compatible(dungeon_feature_type grid_wanted,
bool monster_habitable_grid(const monsters *m,
dungeon_feature_type actual_grid)
{
- return (monster_habitable_grid(m->type, actual_grid, mons_flies(m),
+ // Zombified monsters enjoy the same habitat as their original.
+ const int type = mons_is_zombified(m)? mons_zombie_base(m) : m->type;
+ return (monster_habitable_grid(type, actual_grid, mons_flies(m),
m->paralysed()));
}
@@ -101,7 +104,7 @@ bool monster_habitable_grid(int monster_class,
bool paralysed)
{
const dungeon_feature_type preferred_habitat =
- habitat2grid( mons_habitat(monster_class) );
+ habitat2grid( mons_habitat_by_type(monster_class) );
return (grid_compatible(preferred_habitat, actual_grid)
// [dshaligram] Flying creatures are all DNGN_FLOOR, so we
// only have to check for the additional valid grids of deep
@@ -124,22 +127,20 @@ bool monster_habitable_grid(int monster_class,
}
// Returns true if the monster can submerge in the given grid
-bool monster_can_submerge(int monster_class, int grid)
+bool monster_can_submerge(const monsters *mons, dungeon_feature_type grid)
{
- const habitat_type habitat = mons_habitat(monster_class);
-
- if (habitat == HT_WATER &&
- (grid == DNGN_DEEP_WATER || grid == DNGN_BLUE_FOUNTAIN))
+ switch (mons_habitat(mons))
{
- return true;
- }
+ case HT_WATER:
+ // Monsters can submerge in shallow water - this is intentional.
+ return grid_is_watery(grid);
- if (habitat == HT_LAVA && grid == DNGN_LAVA)
- {
- return true;
- }
+ case HT_LAVA:
+ return (grid == DNGN_LAVA);
- return false;
+ default:
+ return false;
+ }
}
static bool need_super_ood(int lev_mons)
@@ -485,7 +486,8 @@ bool place_monster(int &id, int mon_type, int power, beh_type behaviour,
// a) not occupied
// b) compatible
// c) in the 'correct' proximity to the player
- dungeon_feature_type grid_wanted = habitat2grid( mons_habitat(mon_type) );
+ dungeon_feature_type grid_wanted =
+ habitat2grid( mons_habitat_by_type(mon_type) );
while(true)
{
// handled above, won't change anymore
@@ -689,7 +691,7 @@ static int place_monster_aux( int mon_type, beh_type behaviour, int target,
}
else
{
- grid_wanted = habitat2grid( mons_habitat(mon_type) );
+ grid_wanted = habitat2grid( mons_habitat_by_type(mon_type) );
// we'll try 1000 times for a good spot
for (i = 0; i < 1000; i++)
@@ -773,7 +775,7 @@ static int place_monster_aux( int mon_type, beh_type behaviour, int target,
menv[id].flags |= MF_BATTY;
}
- if (monster_can_submerge(mon_type, grd[fx][fy])
+ if (monster_can_submerge(&menv[id], grd[fx][fy])
&& !one_chance_in(5))
menv[id].add_ench(ENCH_SUBMERGED);
@@ -1570,8 +1572,9 @@ coord_def find_newmons_square(int mons_class, int x, int y)
if (mons_class == WANDERING_MONSTER)
mons_class = RANDOM_MONSTER;
- dungeon_feature_type spcw = ((mons_class == RANDOM_MONSTER) ? DNGN_FLOOR
- : habitat2grid( mons_habitat(mons_class) ));
+ dungeon_feature_type spcw =
+ ((mons_class == RANDOM_MONSTER) ? DNGN_FLOOR
+ : habitat2grid( mons_habitat_by_type(mons_class) ));
// Might be better if we chose a space and tried to match the monster
// to it in the case of RANDOM_MONSTER, that way if the target square