From b51dc9e9720a5cdb08d240da53948d34bb8a6c5a Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 28 Mar 2009 19:59:33 +0000 Subject: Xom again: * tweak values for tension and amusement * Xom only laughs about "funny" deaths * gift_timeout rerolling after a bad act depends on its severity * replace the blink effect with position swapping git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9561 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/misc.cc | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'crawl-ref/source/misc.cc') diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 36d1bd7b08..7713fd7ca3 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -3110,3 +3110,69 @@ bool is_dragonkind(const actor *act) return (false); } + +// Make the player swap positions with a given monster. +void swap_with_monster(monsters *mon_to_swap) +{ + monsters& mon(*mon_to_swap); + ASSERT(mon.alive()); + const coord_def newpos = mon.pos(); + + // Be nice: no swapping into uninhabitable environments. + if (!you.is_habitable(newpos) || !mon.is_habitable(you.pos())) + { + mpr("You spin around."); + return; + } + + const bool mon_caught = mons_is_caught(&mon); + const bool you_caught = you.attribute[ATTR_HELD]; + + // If it was submerged, it surfaces first. + mon.del_ench(ENCH_SUBMERGED); + + mprf("You swap places with %s.", mon.name(DESC_NOCAP_THE).c_str()); + + // Pick the monster up. + mgrd(newpos) = NON_MONSTER; + mon.moveto(you.pos()); + + // Plunk it down. + mgrd(mon.pos()) = mon_to_swap->mindex(); + + if (you_caught) + { + check_net_will_hold_monster(&mon); + if (!mon_caught) + you.attribute[ATTR_HELD] = 0; + } + + // Move you to its previous location. + move_player_to_grid(newpos, false, true, true, false); + + 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.pos()); + if (net != NON_ITEM) + destroy_item(net); + } + else + { + you.attribute[ATTR_HELD] = 10; + mpr("You become entangled in the net!"); + + // Xom thinks this is hilarious if you trap yourself this way. + if (you_caught) + xom_is_stimulated(16); + else + xom_is_stimulated(255); + } + + if (!you_caught) + mon.del_ench(ENCH_HELD, true); + } +} -- cgit v1.2.3-54-g00ecf