allow $unset to remove assist cards too

This commit is contained in:
Martin Michelsen
2025-10-04 09:53:26 -07:00
parent d5f0c6aceb
commit d61cb1106d
3 changed files with 15 additions and 4 deletions
+6 -2
View File
@@ -2697,8 +2697,12 @@ ChatCommandDefinition cc_unset(
throw precondition_failed("$C6Battle has not\nyet begun");
}
size_t index = stoull(a.text) - 1;
l->ep3_server->force_destroy_field_character(a.c->lobby_client_id, index);
size_t index = stoull(a.text);
if (index == 0) {
l->ep3_server->force_replace_assist_card(a.c->lobby_client_id, 0xFFFF);
} else {
l->ep3_server->force_destroy_field_character(a.c->lobby_client_id, index - 1);
}
co_return;
});
+8 -1
View File
@@ -592,7 +592,14 @@ void Server::force_replace_assist_card(uint8_t client_id, uint16_t card_id) {
if (!ps) {
throw runtime_error("player does not exist");
}
ps->replace_assist_card_by_id(card_id);
if (card_id == 0xFFFF) {
ps->discard_set_assist_card();
this->check_for_destroyed_cards_and_send_6xB4x05_6xB4x02();
this->check_for_battle_end();
} else {
ps->replace_assist_card_by_id(card_id);
}
}
void Server::force_destroy_field_character(uint8_t client_id, size_t visible_index) {