don't allow dead players to surrender in ep3
This commit is contained in:
@@ -2476,6 +2476,11 @@ static void server_command_surrender(shared_ptr<Client> c, const std::string&) {
|
||||
send_text_message(c, "$C6Battle has not\nyet started");
|
||||
return;
|
||||
}
|
||||
auto ps = l->ep3_server->get_player_state(c->lobby_client_id);
|
||||
if (!ps || !ps->is_alive()) {
|
||||
send_text_message(c, "$C6Defeated players\ncannot surrender");
|
||||
return;
|
||||
}
|
||||
string name = remove_color(c->character()->disp.name.decode(c->language()));
|
||||
send_text_message_printf(l, "$C6%s has\nsurrendered", name.c_str());
|
||||
for (const auto& watcher_l : l->watcher_lobbies) {
|
||||
|
||||
@@ -132,6 +132,11 @@ shared_ptr<const Server> PlayerState::server() const {
|
||||
return s;
|
||||
}
|
||||
|
||||
bool PlayerState::is_alive() const {
|
||||
auto sc_card = this->get_sc_card();
|
||||
return (sc_card && !(sc_card->card_flags & 2));
|
||||
}
|
||||
|
||||
bool PlayerState::draw_cards_allowed() const {
|
||||
if (this->assist_flags & AssistFlag::IS_SKIPPING_TURN) {
|
||||
return false;
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
std::shared_ptr<Server> server();
|
||||
std::shared_ptr<const Server> server() const;
|
||||
|
||||
bool is_alive() const;
|
||||
|
||||
bool draw_cards_allowed() const;
|
||||
void apply_assist_card_effect_on_set(std::shared_ptr<PlayerState> setter_ps);
|
||||
void apply_dice_effects();
|
||||
|
||||
Reference in New Issue
Block a user