diff --git a/README.md b/README.md index c5d17cfc..dbed1518 100644 --- a/README.md +++ b/README.md @@ -308,9 +308,12 @@ Some commands only work on the game server and not on the proxy server. The chat * `$maxlevel `: Sets the maximum level for players to join the current game. (This only applies when joining; if a player joins and then levels up past this level during the game, they are not kicked out, but won't be able to rejoin if they leave.) * `$minlevel `: Sets the minimum level for players to join the current game. * `$password `: Sets the game's join password. To unlock the game, run `$password` with nothing after it. + +* Episode 3 commands (game server only) * `$spec`: Toggles the allow spectators flag for Episode 3 games. If any players are spectating when this flag is disabled, they will be sent back to the lobby. - * `$surrender`: Causes your team to immediately lose the current battle. (Episode 3 only) - * `$saverec `: Saves the recording of the last Episode 3 battle. + * `$inftime`: Toggles infinite-time mode. Must be used before starting a battle. If infinite-time mode is enabled, the overall and per-phase time limits will be disabled regardless of the values chosen during battle setup. After completing a battle, infinite-time mode is reset to the server's default value (which can be set in Episode3BehaviorFlags in config.json). + * `$surrender`: Causes your team to immediately lose the current battle. + * `$saverec `: Saves the recording of the last battle. * `$playrec `: Plays a battle recording. This command creates a spectator team and replays the specified battle log within it. There is a known issue which causes spectators to crash in some cases, so use of this command is currently not recommended. * Cheat mode commands diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 8cd0317c..880069f5 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -1242,12 +1242,12 @@ static void server_command_enable_ep3_battle_debug_menu( } auto base = l->ep3_server_base; if (!base) { - send_text_message(l, u"$C6Episode 3 server\nis not initialized"); + send_text_message(c, u"$C6Episode 3 server\nis not initialized"); return; } auto server = base->server; if (!server) { - send_text_message(l, u"$C6Episode 3 server\nis not initialized"); + send_text_message(c, u"$C6Episode 3 server\nis not initialized"); return; } @@ -1263,6 +1263,34 @@ static void server_command_enable_ep3_battle_debug_menu( } } +static void server_command_ep3_infinite_time( + shared_ptr, shared_ptr l, shared_ptr c, const std::u16string&) { + check_is_game(l, true); + check_is_ep3(c, true); + check_is_leader(l, c); + if (l->episode != Episode::EP3) { + throw logic_error("non-Ep3 client in Ep3 game"); + } + auto base = l->ep3_server_base; + if (!base) { + send_text_message(c, u"$C6Episode 3 server\nis not initialized"); + return; + } + auto server = base->server; + if (!server) { + send_text_message(c, u"$C6Episode 3 server\nis not initialized"); + return; + } + if (server->setup_phase != Episode3::SetupPhase::REGISTRATION) { + send_text_message(c, u"$C6Battle is already\nin progress"); + return; + } + + base->behavior_flags ^= Episode3::BehaviorFlag::DISABLE_TIME_LIMITS; + bool infinite_time_enabled = (base->behavior_flags & Episode3::BehaviorFlag::DISABLE_TIME_LIMITS); + send_text_message(l, infinite_time_enabled ? u"$C6Infinite time enabled" : u"$C6Infinite time disabled"); +} + static void server_command_surrender( shared_ptr, shared_ptr l, shared_ptr c, const std::u16string&) { check_is_game(l, true); @@ -1316,6 +1344,7 @@ static const unordered_map chat_commands({ {u"$exit", {server_command_exit, proxy_command_exit}}, {u"$gc", {server_command_get_self_card, proxy_command_get_player_card}}, {u"$infhp", {server_command_infinite_hp, proxy_command_infinite_hp}}, + {u"$inftime", {server_command_ep3_infinite_time, nullptr}}, {u"$inftp", {server_command_infinite_tp, proxy_command_infinite_tp}}, {u"$item", {server_command_item, proxy_command_item}}, {u"$i", {server_command_item, proxy_command_item}},