summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-02 13:18:34 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-02 13:18:34 +1000
commitb16b25683f1733cdea0214e7914218d40b3b518f (patch)
treea549720015bc73f3f3b2924312343faf02565602 /crawl-ref/source
parentbd1ceb7e5828fd5f550ed66d82088689741035fc (diff)
downloadcrawl-ref-b16b25683f1733cdea0214e7914218d40b3b518f.tar.gz
crawl-ref-b16b25683f1733cdea0214e7914218d40b3b518f.zip
Wizard-mode controlled teleport (Ctrl-B).
Instantaneous, non-contaminating controlled teleport. Bypasses FPROP_NO_CTELE_INTO as well as -TELE artefacts.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/actor.h4
-rw-r--r--crawl-ref/source/command.cc1
-rw-r--r--crawl-ref/source/main.cc1
-rw-r--r--crawl-ref/source/monster.cc2
-rw-r--r--crawl-ref/source/monster.h4
-rw-r--r--crawl-ref/source/player.cc4
-rw-r--r--crawl-ref/source/player.h4
-rw-r--r--crawl-ref/source/spells3.cc47
-rw-r--r--crawl-ref/source/spells3.h2
9 files changed, 46 insertions, 23 deletions
diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h
index a4d76ef56e..4d2fa2834d 100644
--- a/crawl-ref/source/actor.h
+++ b/crawl-ref/source/actor.h
@@ -153,7 +153,9 @@ public:
virtual bool heal(int amount, bool max_too = false) = 0;
virtual void banish(const std::string &who = "") = 0;
virtual void blink(bool allow_partial_control = true) = 0;
- virtual void teleport(bool right_now = false, bool abyss_shift = false) = 0;
+ virtual void teleport(bool right_now = false,
+ bool abyss_shift = false,
+ bool wizard = false) = 0;
virtual void poison(actor *attacker, int amount = 1) = 0;
virtual bool sicken(int amount) = 0;
virtual void paralyse(actor *attacker, int strength) = 0;
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 28218e61c0..6a8298359b 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -2473,6 +2473,7 @@ int list_wizard_commands(bool do_redraw_screen)
"<yellow>Other level related commands</yellow>\n"
"<w>Ctrl-A</w> : generate new Abyss area\n"
"<w>b</w> : controlled blink\n"
+ "<w>Ctrl-B</w> : controlled teleport\n"
"<w>B</w> : banish yourself to the Abyss\n"
"<w>R</w> : change monster spawn rate\n"
"<w>k</w> : shift section of a labyrinth\n"
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 1ea36c2d5f..73a7efb002 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -496,6 +496,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail)
case CONTROL('I'): debug_item_statistics(); break;
case CONTROL('L'): wizard_set_xl(); break;
case CONTROL('T'): debug_terp_dlua(); break;
+ case CONTROL('B'): you.teleport(true, false, true); break;
case 'O': debug_test_explore(); break;
case 'S': wizard_set_skill_level(); break;
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index f61b8dd4f8..ff9a0134c4 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -3515,7 +3515,7 @@ void monsters::blink(bool)
monster_blink(this);
}
-void monsters::teleport(bool now, bool)
+void monsters::teleport(bool now, bool, bool)
{
monster_teleport(this, now, false);
}
diff --git a/crawl-ref/source/monster.h b/crawl-ref/source/monster.h
index c5c95f0550..8a34cba2e1 100644
--- a/crawl-ref/source/monster.h
+++ b/crawl-ref/source/monster.h
@@ -382,7 +382,9 @@ public:
bool cleanup_dead = true);
bool heal(int amount, bool max_too = false);
void blink(bool allow_partial_control = true);
- void teleport(bool right_now = false, bool abyss_shift = false);
+ void teleport(bool right_now = false,
+ bool abyss_shift = false,
+ bool wizard = false);
void hibernate(int power = 0);
void check_awaken(int disturbance);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 7ca84864c4..fbb5d402e0 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6651,12 +6651,12 @@ void player::blink(bool allow_partial_control)
random_blink(allow_partial_control);
}
-void player::teleport(bool now, bool abyss_shift)
+void player::teleport(bool now, bool abyss_shift, bool wizard)
{
ASSERT(!crawl_state.arena);
if (now)
- you_teleport_now(true, abyss_shift);
+ you_teleport_now(true, abyss_shift, wizard);
else
you_teleport();
}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index b255150950..0e1376bd78 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -426,7 +426,9 @@ public:
void backlight();
void banish(const std::string &who = "");
void blink(bool allow_partial_control = true);
- void teleport(bool right_now = false, bool abyss_shift = false);
+ void teleport(bool right_now = false,
+ bool abyss_shift = false,
+ bool wizard = false);
void drain_stat(int stat, int amount, actor* attacker);
void expose_to_element(beam_type element, int strength = 0);
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
diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h
index 394df3e9fe..0721dc9b83 100644
--- a/crawl-ref/source/spells3.h
+++ b/crawl-ref/source/spells3.h
@@ -63,7 +63,7 @@ bool cast_haunt(int pow, const coord_def& where, god_type god = GOD_NO_GOD);
bool cast_death_channel(int pow, god_type god = GOD_NO_GOD);
void you_teleport();
-void you_teleport_now(bool allow_control, bool new_abyss_area = false);
+void you_teleport_now(bool allow_control, bool new_abyss_area = false, bool wizard = false);
#endif