| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2024 | ||
| 3 | ** zappy/ai | ||
| 4 | ** File description: | ||
| 5 | ** ListenIncantationResponse.cpp | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "../../bots/ABot.hpp" | ||
| 9 | |||
| 10 | ✗ | void ABot::listenIncantationResponse(const std::string &response) | |
| 11 | { | ||
| 12 | ✗ | if (response == "Elevation underway") | |
| 13 | { | ||
| 14 | ✗ | _state.state = WAIT_FOR_SERVER_RESPONSE; | |
| 15 | } | ||
| 16 | ✗ | } | |
| 17 | |||
| 18 | ✗ | void ABot::listenIncantationReturnResponse(const std::string &response) | |
| 19 | { | ||
| 20 | ✗ | if (response.find("Current level") != std::string::npos) | |
| 21 | { | ||
| 22 | ✗ | _state.level++; | |
| 23 | ✗ | _state.state = STANDARD; | |
| 24 | ✗ | _state.metadata["wait_incant"] = "false"; | |
| 25 | } | ||
| 26 | ✗ | if (response.find("ko") != std::string::npos) | |
| 27 | { | ||
| 28 | ✗ | PRINT_ALERT("Incantation failed\n"); | |
| 29 | ✗ | _state.state = STANDARD; | |
| 30 | ✗ | _state.metadata["should_incant"] = "false"; | |
| 31 | ✗ | _state.metadata["wait_incant"] = "false"; | |
| 32 | } | ||
| 33 | ✗ | _state.nbAlly = 0; | |
| 34 | // TODO: remove it | ||
| 35 | ✗ | if (_state.level == 8) | |
| 36 | { | ||
| 37 | ✗ | printColor("👑 WIN 👑", BRIGHT_GREEN); | |
| 38 | ✗ | exit(0); | |
| 39 | } | ||
| 40 | ✗ | } | |
| 41 |