From b16b25683f1733cdea0214e7914218d40b3b518f Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Wed, 2 Dec 2009 13:18:34 +1000 Subject: Wizard-mode controlled teleport (Ctrl-B). Instantaneous, non-contaminating controlled teleport. Bypasses FPROP_NO_CTELE_INTO as well as -TELE artefacts. --- crawl-ref/source/spells3.cc | 47 ++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'crawl-ref/source/spells3.cc') diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index eeadeeb25f..f612a1708b 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1410,13 +1410,17 @@ void you_teleport(void) } } -static bool _teleport_player(bool allow_control, bool new_abyss_area) +static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizard) { bool is_controlled = (allow_control && !you.confused() && player_control_teleport() && allow_control_teleport()); - if (scan_artefacts(ARTP_PREVENT_TELEPORTATION)) + // All wizard teleports are automatically controlled. + if (wizard) + is_controlled = true; + + if (scan_artefacts(ARTP_PREVENT_TELEPORTATION) && !wizard) { mpr("You feel a strange sense of stasis."); return (false); @@ -1456,7 +1460,10 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) mpr("You may choose your destination (press '.' or delete to select)."); mpr("Expect minor deviation."); check_ring_TC = true; - more(); + + // Only have the more prompt for non-wizard. + if (!wizard) + more(); while (true) { @@ -1503,13 +1510,21 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) break; } - pos.x += random2(3) - 1; - pos.y += random2(3) - 1; - - if (one_chance_in(4)) + // Don't randomly walk wizard teleports. + if (!wizard) { pos.x += random2(3) - 1; pos.y += random2(3) - 1; + + if (one_chance_in(4)) + { + pos.x += random2(3) - 1; + pos.y += random2(3) - 1; + } +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, + "Scattered target square (%d, %d)", pos.x, pos.y); +#endif } if (!in_bounds(pos)) @@ -1518,11 +1533,6 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) is_controlled = false; } -#if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, - "Scattered target square (%d, %d)", pos.x, pos.y); -#endif - if (is_controlled) { if (!you.see_cell(pos)) @@ -1536,10 +1546,14 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) || monster_at(pos) || env.cgrid(pos) != EMPTY_CLOUD) { +#if DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, + "Target square (%d, %d) vetoed, now random teleport.", pos.x, pos.y); +#endif is_controlled = false; large_change = false; } - else if (testbits(env.pgrid(pos), FPROP_NO_CTELE_INTO)) + else if (testbits(env.pgrid(pos), FPROP_NO_CTELE_INTO) && !wizard) { is_controlled = false; large_change = false; @@ -1552,7 +1566,8 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) // Controlling teleport contaminates the player. - bwr move_player_to_grid(pos, false, true, true); - contaminate_player(1, true); + if (!wizard) + contaminate_player(1, true); } } } @@ -1653,9 +1668,9 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area) return (!is_controlled); } -void you_teleport_now(bool allow_control, bool new_abyss_area) +void you_teleport_now(bool allow_control, bool new_abyss_area, bool wizard) { - const bool randtele = _teleport_player(allow_control, new_abyss_area); + const bool randtele = _teleport_player(allow_control, new_abyss_area, wizard); // Xom is amused by uncontrolled teleports that land you in a // dangerous place, unless the player is in the Abyss and -- cgit v1.2.3-54-g00ecf