MCPcopy Create free account
hub / github.com/davemoore22/sorcery / _parse_attacks

Method _parse_attacks

src/resources/monsterstore.cpp:251–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249auto Sorcery::MonsterStore::_parse_attacks(const std::string value) const
250 -> std::vector<Dice> {
251
252 std::vector<Dice> attacks;
253 attacks.clear();
254
255 const std::regex regex(R"([,]+)");
256 std::sregex_token_iterator it{value.begin(), value.end(), regex, -1};
257 std::vector<std::string> split{it, {}};
258 split.erase(std::remove_if(split.begin(), split.end(),
259 [](std::string_view s) {
260 return s.size() == 0;
261 }),
262 split.end());
263
264 for (const auto &each : split) {
265
266 Dice atk{each};
267 attacks.emplace_back(atk);
268 }
269
270 return attacks;
271}
272
273auto Sorcery::MonsterStore::_parse_breath_weapons(const std::string value) const
274 -> Enums::Monsters::Breath {
275
276 using enum Enums::Monsters::Breath;

Callers

nothing calls this directly

Calls 2

clearMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected