From a7015583f900105e73b7dd65e0f7ee850bffbb24 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 6 Dec 2008 19:03:47 +0000 Subject: Try harder to make rock worms stay in rock until you actually lure them out into the open. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7758 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/fight.cc | 12 +++++--- crawl-ref/source/monstuff.cc | 71 +++++++++++++++++++++++++++++++++++++++----- crawl-ref/source/spl-cast.cc | 4 +-- crawl-ref/source/tilesdl.cc | 5 ++-- 4 files changed, 77 insertions(+), 15 deletions(-) diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index ae21356345..83e1c6a377 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -1852,7 +1852,7 @@ bool melee_attack::player_monattk_hit_effects(bool mondied) void melee_attack::_monster_die(monsters* monster, killer_type killer, int killer_index) { - const bool chaos = damage_brand == SPWPN_CHAOS; + const bool chaos = (damage_brand == SPWPN_CHAOS); // Copy defender before it gets reset by monster_die() monsters* def_copy = NULL; @@ -2431,7 +2431,7 @@ int melee_attack::random_chaos_brand() int brands[] = {SPWPN_FLAMING, SPWPN_FREEZING, SPWPN_ELECTROCUTION, SPWPN_VENOM, SPWPN_DRAINING, SPWPN_VAMPIRICISM, SPWPN_PAIN, SPWPN_DISTORTION, SPWPN_CONFUSE, - SPWPN_CHAOS}; + SPWPN_CHAOS, SPWPN_NORMAL}; return (RANDOM_ELEMENT(brands)); } @@ -2448,11 +2448,12 @@ bool melee_attack::apply_damage_brand() bool brand_was_known = false; if (weapon) + { if (is_random_artefact(*weapon)) brand_was_known = randart_known_wpn_property(*weapon, RAP_BRAND); else brand_was_known = item_type_known(*weapon); - + } bool ret = false; // Monster resistance to the brand. @@ -2467,6 +2468,8 @@ bool melee_attack::apply_damage_brand() else brand = damage_brand; + mprf(MSGCH_DIAGNOSTICS, "brand = %d", brand); + switch (brand) { case SPWPN_FLAMING: @@ -2703,11 +2706,12 @@ bool melee_attack::apply_damage_brand() } if (attacker->atype() == ACT_PLAYER && damage_brand == SPWPN_CHAOS) + { // If your god objects to using chaos then it makes the // brand obvious. if (did_god_conduct(DID_CHAOS, 2 + random2(3), brand_was_known)) obvious_effect = true; - + } if (!obvious_effect) obvious_effect = !special_damage_message.empty(); diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 259dfc95f6..a9cc692af0 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -3020,7 +3020,7 @@ static bool _find_wall_target(monsters *mon) ri; ++ri) { if (!grid_is_solid(*ri) - || monster_habitable_grid(mon, grd(*ri))) + || !monster_habitable_grid(mon, grd(*ri))) { continue; } @@ -4148,14 +4148,15 @@ static void _handle_movement(monsters *monster) if (mmov.origin()) return; - // Reproduced here is some semi-legacy code that makes monsters - // move somewhat randomly along oblique paths. It is an exceedingly - // good idea, given crawl's unique line of sight properties. - // - // Added a check so that oblique movement paths aren't used when - // close to the target square. -- bwr if (delta.rdist() > 3) { + // Reproduced here is some semi-legacy code that makes monsters + // move somewhat randomly along oblique paths. It is an exceedingly + // good idea, given crawl's unique line of sight properties. + // + // Added a check so that oblique movement paths aren't used when + // close to the target square. -- bwr + // Sometimes we'll just move parallel the x axis. if (abs(delta.x) > abs(delta.y) && coinflip()) mmov.y = 0; @@ -4185,6 +4186,62 @@ static void _handle_movement(monsters *monster) _mon_can_move_to_pos(monster, coord_def(count_x-1, count_y-1)); } + if (mons_wall_shielded(monster)) + { + if (mmov.x != 0 && mmov.y != 0) + { + bool updown = false; + bool leftright = false; + + coord_def t = monster->pos() + coord_def(mmov.x, 0); + if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + updown = true; + + t = monster->pos() + coord_def(0, mmov.y); + if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + leftright = true; + + if (updown && (!leftright || coinflip())) + mmov.y = 0; + else if (leftright) + mmov.x = 0; + } + else if (mmov.x == 0 && monster->target.x == monster->pos().x) + { + bool left = false; + bool right = false; + coord_def t = monster->pos() + coord_def(-1, mmov.y); + if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + left = true; + + t = monster->pos() + coord_def(1, mmov.y); + if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + right = true; + + if (left && (!right || coinflip())) + mmov.x = -1; + else if (right) + mmov.x = 1; + } + else if (mmov.y == 0 && monster->target.y == monster->pos().y) + { + bool up = false; + bool down = false; + coord_def t = monster->pos() + coord_def(mmov.x, -1); + if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + up = true; + + t = monster->pos() + coord_def(mmov.x, 1); + if (in_bounds(t) && grid_is_rock(grd(t)) && !grid_is_permarock(grd(t))) + down = true; + + if (up && (!down || coinflip())) + mmov.y = -1; + else if (down) + mmov.y = 1; + } + } + // If the monster is moving in your direction, whether to attack or protect // you, or towards a monster it intends to attack, check whether we first // need to take a step to the side to make sure the reinforcement can diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index c1ac0e90ad..b78045eea0 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -2430,7 +2430,7 @@ void MiscastEffect::do_miscast() sp_type = school; if (sp_type == SPTYP_RANDOM) { - // XXX: Monsters currently have no divintation miscasts. + // XXX: Monsters currently have no divination miscasts. do { int exp = (random2(SPTYP_LAST_EXPONENT)); @@ -2803,7 +2803,7 @@ void MiscastEffect::_conjuration(int severity) break; case 1: you_msg = "You are caught in a violent explosion!"; - mon_msg_seen = "@The_monster@ is caugh in a violent explosion!"; + mon_msg_seen = "@The_monster@ is caught in a violent explosion!"; mon_msg_unseen = "A violent explosion happens from " "out of thin air!"; diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 26de585f68..039a542321 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1049,9 +1049,7 @@ static void _fill_item_info(InventoryTile &desc, const item_def &item) desc.quantity = item.plus; } else - { desc.quantity = -1; - } if (item.base_type == OBJ_WEAPONS) { @@ -1080,6 +1078,9 @@ static void _fill_item_info(InventoryTile &desc, const item_def &item) case SPMSL_RETURNING: desc.special = TILE_BRAND_RETURNING; break; + case SPMSL_CHAOS: + desc.special = TILE_BRAND_CHAOS; + break; default: break; } -- cgit v1.2.3-54-g00ecf