| 7 | namespace objectives { |
| 8 | |
| 9 | std::string Component::getString() { |
| 10 | // This will hold our return value |
| 11 | std::string sentence; |
| 12 | |
| 13 | int componentId = _type.getId(); |
| 14 | |
| 15 | if (isInverted()) { |
| 16 | sentence += "do NOT "; |
| 17 | } |
| 18 | |
| 19 | SpecifierPtr sp1 = getSpecifier(Specifier::FIRST_SPECIFIER); |
| 20 | SpecifierPtr sp2 = getSpecifier(Specifier::SECOND_SPECIFIER); |
| 21 | |
| 22 | if (componentId == ComponentType::COMP_KILL().getId()) { |
| 23 | // First add the verb |
| 24 | sentence += "kill"; |
| 25 | |
| 26 | // Add the Specifier details, if any |
| 27 | sentence += (sp1) ? (" " + sp1->getSentence(*this)) : ""; |
| 28 | } |
| 29 | else if (componentId == ComponentType::COMP_KO().getId()) { |
| 30 | // First add the verb |
| 31 | sentence += "knockout"; |
| 32 | |
| 33 | // Add the Specifier details, if any |
| 34 | sentence += (sp1) ? (" " + sp1->getSentence(*this)) : ""; |
| 35 | } |
| 36 | else if (componentId == ComponentType::COMP_AI_FIND_ITEM().getId()) { |
| 37 | // First add the verb |
| 38 | sentence += "let AI find item:"; |
| 39 | |
| 40 | // Add the Specifier details, if any |
| 41 | sentence += (sp1) ? (" " + sp1->getSentence(*this)) : ""; |
| 42 | } |
| 43 | else if (componentId == ComponentType::COMP_AI_FIND_BODY().getId()) { |
| 44 | sentence += "let AI find body:"; |
| 45 | |
| 46 | // Add the Specifier details, if any |
| 47 | sentence += (sp1) ? (" " + sp1->getSentence(*this)) : ""; |
| 48 | |
| 49 | sentence += " (amount: " + getArgument(0) + ")"; |
| 50 | } |
| 51 | else if (componentId == ComponentType::COMP_ALERT().getId()) { |
| 52 | sentence += "alert"; |
| 53 | |
| 54 | // Add the Specifier details, if any |
| 55 | sentence += (sp1) ? (" " + sp1->getSentence(*this)) : ""; |
| 56 | |
| 57 | // Add the alert level info |
| 58 | sentence += " " + getArgument(0) + " times to a minimum alert level of " + getArgument(1); |
| 59 | } |
| 60 | else if (componentId == ComponentType::COMP_DESTROY().getId()) { |
| 61 | sentence += "destroy"; |
| 62 | |
| 63 | // Add the Specifier details, if any |
| 64 | sentence += (sp1) ? (" " + sp1->getSentence(*this)) : ""; |
| 65 | } |
| 66 | else if (componentId == ComponentType::COMP_ITEM().getId()) { |
no test coverage detected