diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-28 19:59:33 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-28 19:59:33 +0000 |
commit | b51dc9e9720a5cdb08d240da53948d34bb8a6c5a (patch) | |
tree | 907ba1c3a10ce86c5a2b7b06c1a1cacc0da3657f /crawl-ref/source/misc.cc | |
parent | f7eda5bc39c5971efb204d29b2bf155eda36ce26 (diff) | |
download | crawl-ref-b51dc9e9720a5cdb08d240da53948d34bb8a6c5a.tar.gz crawl-ref-b51dc9e9720a5cdb08d240da53948d34bb8a6c5a.zip |
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
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r-- | crawl-ref/source/misc.cc | 66 |
1 files changed, 66 insertions, 0 deletions
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); + } +} |