载入中...
搜索中...
未找到
RTSAttributes.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
11
12#include <string>
13#include <string_view>
14
15namespace eve::rts {
16
17class Unit;
18
27public:
28 static constexpr std::string_view attackAttribute = "attack";
29 static constexpr std::string_view healthAttribute = "health";
30 static constexpr std::string_view maxHealthAttribute = "max_health";
31 static constexpr std::string_view armorAttribute = "armor";
32
34 [[nodiscard]] static eve::Result<void> ensure(Unit& unit);
35
37 [[nodiscard]] static eve::Result<double> read(Unit& unit, std::string_view attribute);
38
40 [[nodiscard]] static eve::Result<void> setBase(Unit& unit, std::string_view attribute, double value);
41
43 [[nodiscard]] static eve::Result<eve::attributes::ModifierId> addModifier(
44 Unit& unit, std::string id, std::string_view attribute, std::string source,
46 eve::attributes::ModifierPriority priority = eve::attributes::priority::runtime);
47
50
52 [[nodiscard]] static eve::Result<void> restore(Unit& unit,
54 eve::Revision expectedRevision);
55};
56
57} // namespace eve::rts
ActionParameterOperation operation
double value
Owner-aware canonical attribute state shared by gameplay adapters.
int priority
#define EVENGINE_API_DOMAINS
Definition Export.h:110
TacticalUnit * unit
const UnitySourceAsset & source
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Defines the small set of RTS unit stats eligible for attributes.
RTS unit domain root.
Definition RTSTypes.h:495
AttributeOperation
Built-in calculation operation for an attribute modifier.
std::int32_t ModifierPriority
Transaction-safe snapshot of selected attributes and their modifiers.