diff options
-rw-r--r-- | crawl-ref/source/monstuff.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.cc | 19 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.h | 1 |
3 files changed, 21 insertions, 10 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 3c3fcb49b3..7088423fde 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -478,11 +478,8 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) return; if (mons_is_caught(monster)) - { - int net = get_trapping_net(monster->x,monster->y); - if (net != NON_ITEM) - remove_item_stationary(mitm[net]); - } + mons_clear_trapping_net(monster); + // update list of monsters beholding player update_beholders(monster, true); @@ -1346,8 +1343,8 @@ bool monster_blink(monsters *monster) false, false)) return (false); - if (monster->has_ench(ENCH_HELD)) - monster->del_ench(ENCH_HELD, true); + if (mons_is_caught(monster)) + mons_clear_trapping_net(monster); mgrd[monster->x][monster->y] = NON_MONSTER; diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 12de2729d2..dbe5413395 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -940,9 +940,13 @@ void monster_teleport(struct monsters *monster, bool instan, bool silent) simple_monster_message(monster, " disappears!"); const coord_def oldplace = monster->pos(); + // pick the monster up mgrd(oldplace) = NON_MONSTER; + if (mons_is_caught(monster)) + mons_clear_trapping_net(monster); + int newx, newy; while(true) { @@ -988,9 +992,6 @@ void monster_teleport(struct monsters *monster, bool instan, bool silent) monster->check_redraw(oldplace); monster->apply_location_effects(); - if (monster->has_ench(ENCH_HELD)) - monster->del_ench(ENCH_HELD, true); - // Teleporting mimics change form - if they reappear out of LOS, they are // no longer known. if (mons_is_mimic(monster->type)) @@ -2401,3 +2402,15 @@ bool moth_incite_monsters(const monsters *mon) return (false); } + +void mons_clear_trapping_net(monsters *mons) +{ + if (!mons_is_caught(mons)) + return; + + const int net = get_trapping_net(mons->x, mons->y); + if (net != NON_ITEM) + remove_item_stationary(mitm[net]); + + mons->del_ench(ENCH_HELD, true); +} diff --git a/crawl-ref/source/mstuff2.h b/crawl-ref/source/mstuff2.h index ac2877a041..26fc063909 100644 --- a/crawl-ref/source/mstuff2.h +++ b/crawl-ref/source/mstuff2.h @@ -99,5 +99,6 @@ bool orc_battle_cry(monsters *chief); bool orange_statue_effects(monsters *mons); bool silver_statue_effects(monsters *mons); bool moth_incite_monsters(const monsters *mon); +void mons_clear_trapping_net(monsters *mons); #endif |