nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
monsters.h
Go to the documentation of this file.
1#ifndef NANOMMO_CONTENT_MONSTERS_H_
2#define NANOMMO_CONTENT_MONSTERS_H_
3
4#include <chrono>
5#include <cstdint>
6#include <map>
7#include <string_view>
8#include <vector>
9
10#include "absl/status/statusor.h"
11#include "content/monsters.pb.h"
12#include "terrain/lands.h"
13
14namespace nanommo {
15
16/// The kinds of monster, by id, and where they spawn.
18 std::map<uint32_t, monsters::Kind> kinds;
19 std::vector<monsters::Spawn> spawns;
20 std::vector<monsters::Camps> camps;
21};
22
23/// The shortest a monster's skill shows before it lands: long enough to see
24/// it coming, and step out.
25inline constexpr std::chrono::milliseconds kShortestTelegraph{500};
26
27/// The monsters in text format, or what's wrong with them: a field
28/// monsters.proto doesn't have, a kind with no id or with another's, loot
29/// with a chance of nothing or more than one, or from more to fewer, gold
30/// from more to less, a skill with no id or with another's, with no size, a
31/// range past its size, a telegraph shorter than kShortestTelegraph, or a
32/// cooldown shorter than its telegraph, a boss whose first phase isn't from
33/// full health, or whose phases don't go down its health, use a skill it
34/// doesn't have, or call up a kind that isn't there, or none, a spawn or camps
35/// of a kind or in a land that isn't there, or a spawn whose leash reaches the
36/// middle of its land.
37absl::StatusOr<MonsterTable> ParseMonsters(std::string_view text);
38
39/// Whether the place is in the skill's shape, aimed from where the monster
40/// stood, the way it faced, as a yaw: what it lands on, and what a player
41/// steps out of.
42bool InShape(const monsters::Skill& skill, Place from, float yaw, Place place);
43
44} // namespace nanommo
45
46#endif // NANOMMO_CONTENT_MONSTERS_H_
Definition chat.cc:9
bool InShape(const monsters::Skill &skill, Place from, float yaw, Place place)
Definition monsters.cc:172
absl::StatusOr< MonsterTable > ParseMonsters(std::string_view text)
Definition monsters.cc:103
constexpr std::chrono::milliseconds kShortestTelegraph
Definition monsters.h:25
The kinds of monster, by id, and where they spawn.
Definition monsters.h:17
std::vector< monsters::Spawn > spawns
Definition monsters.h:19
std::map< uint32_t, monsters::Kind > kinds
Definition monsters.h:18
std::vector< monsters::Camps > camps
Definition monsters.h:20