nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
skills.h
Go to the documentation of this file.
1#ifndef NANOMMO_CONTENT_SKILLS_H_
2#define NANOMMO_CONTENT_SKILLS_H_
3
4#include <cstdint>
5#include <map>
6#include <set>
7#include <string_view>
8
9#include "absl/status/statusor.h"
10#include "content/skills.pb.h"
11
12namespace nanommo {
13
14/// The skills in the skills file, by id, the ones each new player knows, and
15/// the swing on Space, which is one of them.
16struct SkillTable {
17 std::map<uint32_t, skills::Skill> by_id;
18 std::set<uint32_t> starting;
19 uint32_t attack = 0;
20};
21
22/// The skills in text format, or what's wrong with them: a field skills.proto
23/// doesn't have, a skill with no id or with another's, one with no level, one
24/// that lands after it's over, blows, strides or a move whose keys go back in
25/// time or run on after it's over, or a starting skill, a swing or a swing it
26/// goes on into that isn't there.
27absl::StatusOr<SkillTable> ParseSkills(std::string_view text);
28
29/// How far from one key to the next the ease has got, `t` of the way there in
30/// time, both from 0 to 1.
31float Eased(skills::Ease ease, float t);
32
33/// How far the skill's strides have taken the player, in metres, `ms` into
34/// it: from none at its start, eased towards each stride in turn, and the
35/// last's once it's done.
36float AheadAt(const skills::Effect& effect, float ms);
37
38} // namespace nanommo
39
40#endif // NANOMMO_CONTENT_SKILLS_H_
Definition chat.cc:9
float AheadAt(const skills::Effect &effect, float ms)
Definition skills.cc:115
float Eased(skills::Ease ease, float t)
Definition skills.cc:104
absl::StatusOr< SkillTable > ParseSkills(std::string_view text)
Definition skills.cc:15
std::set< uint32_t > starting
Definition skills.h:18
uint32_t attack
Definition skills.h:19
std::map< uint32_t, skills::Skill > by_id
Definition skills.h:17