added King Crimson to commands
This commit is contained in:
@ -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\
|
||||
|
@ -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,
|
||||
|
21
src/game.cc
21
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:
|
||||
|
@ -36,6 +36,7 @@ private:
|
||||
size_t curr_level;
|
||||
|
||||
bool the_world;
|
||||
bool king_crimson;
|
||||
bool hostile_merchants;
|
||||
|
||||
// shrink if over 300
|
||||
|
@ -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") {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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") {
|
||||
|
@ -268,6 +268,8 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
|
||||
"PC tried to dig through the floor. "};
|
||||
} else if (cmd == 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) {
|
||||
|
Reference in New Issue
Block a user