From 388fa4e558e71b1455cce865c1a8b62ace0aaba9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 18 Jun 2008 13:14:51 +0000 Subject: Fix 1996770: shafts being capable of disarming. Fix 1996304: the Swap card incorrectly swapping monsters/player caught in a net git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5941 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/changes.stone_soup | 5 ++-- crawl-ref/source/decks.cc | 33 +++++++++++++++++++++++-- crawl-ref/source/monstuff.cc | 41 +------------------------------ crawl-ref/source/traps.cc | 51 ++++++++++++++++++++++++++++++++++++++- crawl-ref/source/traps.h | 1 + 5 files changed, 86 insertions(+), 45 deletions(-) diff --git a/crawl-ref/docs/changes.stone_soup b/crawl-ref/docs/changes.stone_soup index aa08c3704d..47ab394a72 100644 --- a/crawl-ref/docs/changes.stone_soup +++ b/crawl-ref/docs/changes.stone_soup @@ -49,6 +49,7 @@ Gods * Overhauled the good gods: Zin/TSO completely new, Elyvilon more interesting. * Greatly improved Beogh and Nemelex. * Vehumet isn't evil anymore, and all boosts apply without prayer. +* Increase cost for Lugonu's self-banishment. * Removed autoprayer and option to stop prayer. * Upon failed sacrifice hint on accepted item types. * Divine summons will leave on penance, or turn hostile on abandonment. @@ -138,7 +139,7 @@ Levels * Fixed some levels having the wrong amount of stairs. * Fixed wonky vaults on lava etc. * Treat adjacent doors as one (large) gate, opening/closing together. -* Minotaurs may map labyrinths. +* Player minotaurs will now map labyrinths. * Removed amnesia traps. * Introduced shafts. * Added blood spattering. @@ -164,7 +165,7 @@ Miscellaneous * New scoring system. * Train Stealth by sneaking around sleeping monsters. * Train Traps & Doors by setting off traps. -* Increase cost for self-banishment, and nerf Banishment spell. +* Disallow self-banishment via Banishment spell. * Replace Paralyse spell with new spell Petrify. * Better feedback on Detect Traps. * Identify post-mortem inventory in morgue.txt. diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 395e2032eb..9a4b1a25d5 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -1354,6 +1354,8 @@ static void _swap_monster_card(int power, deck_rarity_type rarity) { monsters& mon(*mon_to_swap); const coord_def newpos = mon.pos(); + bool mon_caught = mons_is_caught(&mon); + bool you_caught = you.attribute[ATTR_HELD]; // Pick the monster up. mgrd(newpos) = NON_MONSTER; @@ -1361,11 +1363,38 @@ static void _swap_monster_card(int power, deck_rarity_type rarity) mon.x = you.x_pos; mon.y = you.y_pos; - // plunk it down + // Plunk it down mgrd(mon.pos()) = monster_index(mon_to_swap); - // move you to its previous location + if (you_caught) + { + check_net_will_hold_monster(&mon); + if (!mon_caught) + you.attribute[ATTR_HELD] = 0; + } + + // Move you to its previous location. you.moveto(newpos); + + if (mon_caught) + { + if (you.body_size(PSIZE_BODY) >= SIZE_GIANT) + { + mpr("The net rips apart!"); + you.attribute[ATTR_HELD] = 0; + int net = get_trapping_net(you.x_pos, you.y_pos); + if (net != NON_ITEM) + destroy_item(net); + } + else + { + you.attribute[ATTR_HELD] = 10; + mpr("You become entangled in the net!"); + } + + if (!you_caught) + mon.del_ench(ENCH_HELD, true); + } } } diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 95a53a14ad..d738cf66c8 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1626,46 +1626,7 @@ bool monster_polymorph( monsters *monster, monster_type targetc, seen_monster(monster); if (old_mon_caught) - { - if (monster->body_size(PSIZE_BODY) >= SIZE_GIANT) - { - int net = get_trapping_net(monster->x, monster->y); - if (net != NON_ITEM) - destroy_item(net); - - if (see_grid(monster->x, monster->y)) - { - if (player_monster_visible(monster)) - { - mprf("The net rips apart, and %s comes free!", - monster->name(DESC_NOCAP_THE).c_str()); - } - else - mpr("All of a sudden the net rips apart!"); - } - } - else if (mons_is_insubstantial(monster->type) - || monster->type == MONS_OOZE - || monster->type == MONS_PULSATING_LUMP) - { - const int net = get_trapping_net(monster->x, monster->y); - if (net != NON_ITEM) - remove_item_stationary(mitm[net]); - - if (mons_is_insubstantial(monster->type)) - { - simple_monster_message(monster, - " drifts right through the net!"); - } - else - { - simple_monster_message(monster, - " oozes right through the net!"); - } - } - else - monster->add_ench(ENCH_HELD); - } + check_net_will_hold_monster(monster); player_angers_monster(monster); diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index d399ae7cd1..c1f5c76023 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -179,6 +179,48 @@ void player_caught_in_net() } } +void check_net_will_hold_monster(monsters *mons) +{ + if (mons->body_size(PSIZE_BODY) >= SIZE_GIANT) + { + int net = get_trapping_net(mons->x, mons->y); + if (net != NON_ITEM) + destroy_item(net); + + if (see_grid(mons->x, mons->y)) + { + if (player_monster_visible(mons)) + { + mprf("The net rips apart, and %s comes free!", + mons->name(DESC_NOCAP_THE).c_str()); + } + else + mpr("All of a sudden the net rips apart!"); + } + } + else if (mons_is_insubstantial(mons->type) + || mons->type == MONS_OOZE + || mons->type == MONS_PULSATING_LUMP) + { + const int net = get_trapping_net(mons->x, mons->y); + if (net != NON_ITEM) + remove_item_stationary(mitm[net]); + + if (mons_is_insubstantial(mons->type)) + { + simple_monster_message(mons, + " drifts right through the net!"); + } + else + { + simple_monster_message(mons, + " oozes right through the net!"); + } + } + else + mons->add_ench(ENCH_HELD); +} + static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison) { int damage_taken = 0; @@ -509,10 +551,17 @@ void disarm_trap( struct dist &disa ) } } - if (trap_category(env.trap[i].type) == DNGN_TRAP_MAGICAL) + switch (trap_category(env.trap[i].type)) { + case DNGN_TRAP_MECHANICAL: mpr("You can't disarm that trap."); return; + case DNGN_TRAP_NATURAL: + // Only shafts for now. + mpr("You can't disarm a shaft."); + return; + default: + break; } if (random2(you.skills[SK_TRAPS_DOORS] + 2) <= random2(you.your_level + 5)) diff --git a/crawl-ref/source/traps.h b/crawl-ref/source/traps.h index 935ad72629..2604e3de28 100644 --- a/crawl-ref/source/traps.h +++ b/crawl-ref/source/traps.h @@ -41,6 +41,7 @@ void mark_net_trapping(int x, int y); void monster_caught_in_net(monsters *mon, bolt &pbolt); void player_caught_in_net(void); void clear_trapping_net(void); +void check_net_will_hold_monster(monsters *mon); void itrap(struct bolt &pbolt, int trapped); void destroy_trap( const coord_def& pos ); -- cgit v1.2.3-54-g00ecf