added throwing

This commit is contained in:
2024-07-17 21:39:10 -04:00
parent ea381c24f6
commit dbae34e3a2
10 changed files with 258 additions and 37 deletions

View File

@ -10,7 +10,6 @@ console_input::console_input(std::istream &cin):
game_command console_input::get_command() {
std::string cmd;
in >> cmd;
game_command tmp;
if (in.eof())
return game_command_terminate;
@ -21,20 +20,25 @@ game_command console_input::get_command() {
return the_world;
else if (cmd == "r")
return game_restart;
else if (cmd == "u" || cmd == "a") {
bool use = cmd == "u";
else if (cmd == "u" || cmd == "a" || cmd == "t") {
auto cmdtmp = cmd;
in >> cmd;
if (in.eof())
return game_command_panic;
return (game_command)((tmp = get_direction(cmd)) ==
game_command_panic
? tmp : tmp +
(use ? apply_north : attack_north));
auto tmp = get_direction(cmd);
if (cmdtmp == "u")
return (game_command)(tmp + apply_north);
else if (cmdtmp == "a")
return (game_command)(tmp + attack_north);
else
return (game_command)(tmp + throw_north);
} else if (cmd == "yes") {
return game_command::enter;
} else if (cmd == "i") {
return toggle_inventory;
} else {
auto tmp = get_direction(cmd);