diff --git a/src/arguments.cc b/src/arguments.cc index 6654a60..a55028b 100644 --- a/src/arguments.cc +++ b/src/arguments.cc @@ -235,7 +235,8 @@ Text-based commands:\n\ se : southeast\n\ sw : southwest\n\ In-game commands:\n\ - f : toggles whether or not enemies stop moving\n\ + f : toggles whether or not enemies stop moving (will turn off 'd')\n\ + d : toggles whether or not enemies stop moving and attacking (will turn off 'f')\n\ u [direction] : try to use the potion indicated by direction\n\ a [direction] : try to attack the enemy indicated by direction\n\ i : toggles inventory on and off\n\ @@ -255,7 +256,8 @@ ncurses-based commands:\n\ n : southeast\n\ b : southwest\n\ In-game commands:\n\ - f : toggles whether or not enemies stop moving\n\ + f : toggles whether or not enemies stop moving (will turn off 'd')\n\ + d : toggles whether or not enemies stop moving and attacking (will turn off 'f')\n\ u [direction] : try to use the potion indicated by direction\n\ [direction] : also tries to attack in the indicated direction\n\ i : toggles inventory on and off\n\ diff --git a/src/constants.h b/src/constants.h index d437be2..97f19e4 100644 --- a/src/constants.h +++ b/src/constants.h @@ -10,8 +10,8 @@ static const int INF = 0x3F3F3F3F; enum result : int {NOTHING, DIED, GO_DOWN, GO_UP, HIT, MOVED, MISS, TERMINATE, APPLIED, APPLIED_NOTHING, - TOGGLE_THE_WORLD, RESTART_GAME, UNKNOWN, - INVENTORY, THROWN + TOGGLE_THE_WORLD, TOGGLE_KING_CRIMSON, RESTART_GAME, + UNKNOWN, INVENTORY, THROWN }; struct long_result { @@ -35,7 +35,7 @@ enum game_command : int {GAME_COMMAND_TERMINATE = 0, ATTACK_NORTHEAST, ATTACK_NORTHWEST, ATTACK_SOUTHEAST, ATTACK_SOUTHWEST, UP_STAIRS, DOWN_STAIRS, - THE_WORLD, GAME_RESTART, + THE_WORLD, KING_CRIMSON, GAME_RESTART, GAME_COMMAND_PASS, GAME_COMMAND_PANIC, ENTER, TOGGLE_INVENTORY, THROW_NORTH, THROW_SOUTH, THROW_EAST, THROW_WEST, diff --git a/src/game.cc b/src/game.cc index 8aface6..6608bb7 100644 --- a/src/game.cc +++ b/src/game.cc @@ -14,6 +14,7 @@ game::game(const enum race starting_race, curr_turn{0} { const position nil{0, 0}; the_world = false; + king_crimson = false; // TODO: add the other races player = init_player(rng, enabled_features, starting_race); @@ -80,6 +81,9 @@ character *game::move_enemies() { } } + if (king_crimson) + return nullptr; + for (auto ch : enemies) { if (ch->is_dead()) { levels[curr_level]->erase_enemy(ch); @@ -160,6 +164,23 @@ game_result game::run() { case result::TOGGLE_THE_WORLD: the_world = !the_world; player->start_turn(); + + if (king_crimson) { + msg += "King Crimson is automatically turned off. "; + king_crimson = false; + } + + break; + + case result::TOGGLE_KING_CRIMSON: + king_crimson = !king_crimson; + player->start_turn(); + + if (the_world) { + msg += "The World is automatically turned off. "; + the_world = false; + } + break; case RESTART_GAME: diff --git a/src/game.h b/src/game.h index c358d5d..227b411 100644 --- a/src/game.h +++ b/src/game.h @@ -36,6 +36,7 @@ private: size_t curr_level; bool the_world; + bool king_crimson; bool hostile_merchants; // shrink if over 300 diff --git a/src/input/console_input.cc b/src/input/console_input.cc index d4a8de3..f21c420 100644 --- a/src/input/console_input.cc +++ b/src/input/console_input.cc @@ -18,6 +18,8 @@ game_command console_input::get_command() { return GAME_COMMAND_TERMINATE; else if (cmd == "f") return THE_WORLD; + else if (cmd == "d") + return KING_CRIMSON; else if (cmd == "r") return GAME_RESTART; else if (cmd == "u" || cmd == "a" || cmd == "T") { diff --git a/src/input/curses_input.cc b/src/input/curses_input.cc index e946de8..731f151 100644 --- a/src/input/curses_input.cc +++ b/src/input/curses_input.cc @@ -49,6 +49,9 @@ game_command curses_input::get_command() { case 'f': return game_command::THE_WORLD; + case 'd': + return game_command::KING_CRIMSON; + case 'r': return GAME_RESTART; diff --git a/src/input/file_input.cc b/src/input/file_input.cc index 5935ebb..300a49e 100644 --- a/src/input/file_input.cc +++ b/src/input/file_input.cc @@ -18,6 +18,8 @@ game_command file_input::get_command() { return GAME_COMMAND_TERMINATE; else if (cmd == "f") return THE_WORLD; + else if (cmd == "d") + return KING_CRIMSON; else if (cmd == "r") return GAME_RESTART; else if (cmd == "u" || cmd == "a" || cmd == "T") { diff --git a/src/player.cc b/src/player.cc index 3516e7b..1650967 100644 --- a/src/player.cc +++ b/src/player.cc @@ -267,7 +267,9 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) { return {result::NOTHING, "PC tried to dig through the floor. "}; } else if (cmd == THE_WORLD) { - return{TOGGLE_THE_WORLD, "PC toggled Stand: The World! "}; + return {TOGGLE_THE_WORLD, "PC toggled Stand: The World! "}; + } else if (cmd == KING_CRIMSON) { + return {TOGGLE_KING_CRIMSON, "PC toggled Stand: King Crimson! "}; } else if (cmd == GAME_RESTART) { return {RESTART_GAME, ""}; } else if (cmd == GAME_COMMAND_PASS) {