载入中...
搜索中...
未找到
RTSAttributes.cpp
浏览该文件的文档.
13 return name == RTSUnitAttributeAdapter::attackAttribute || name == RTSUnitAttributeAdapter::healthAttribute ||
14 name == RTSUnitAttributeAdapter::maxHealthAttribute || name == RTSUnitAttributeAdapter::armorAttribute;
27 eve::Status::failure(bound.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attribute owner could not be bound", "owner", {}, "rts.attributes")));
37 eve::Status::failure(initialized.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attribute state could not be initialized", "attributes", {}, "rts.attributes")));
45 eve::DiagnosticCode::Unsupported, "RTS unit attribute is outside the selective combat projection",
50 ready.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attributes are not available",
55eve::Result<void> RTSUnitAttributeAdapter::setBase(Unit& unit, std::string_view attribute, double value) {
58 eve::Diagnostic::error(eve::DiagnosticCode::Unsupported, "RTS unit attribute is outside the selective combat projection", "attribute", {}, "rts.attributes"));
61 eve::Status::failure(ready.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attributes are not available", "attributes", {}, "rts.attributes")));
67 eve::attributes::AttributeOperation operation, double value, eve::attributes::ModifierPriority priority) {
71 "RTS unit modifier requires a selected attribute and non-empty source", "modifier", {}, "rts.attributes"));
75 ready.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attributes are not available",
81eve::Result<eve::attributes::AttributeProjectionSnapshot> RTSUnitAttributeAdapter::snapshot(Unit& unit) {
85 ready.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attributes are not available",
96 eve::Status::failure(ready.code(), eve::Diagnostic::error(eve::DiagnosticCode::Failed, "RTS unit attributes are not available", "attributes", {}, "rts.attributes")));
Selective combat-stat adapter for RTS units.
RTS domain roots and composition-only components.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.h:84
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
static eve::Result< void > setBase(Unit &unit, std::string_view attribute, double value)
Set one selected canonical base stat.
Definition RTSAttributes.cpp:55
static eve::Result< void > restore(Unit &unit, const eve::attributes::AttributeProjectionSnapshot &snapshot, eve::Revision expectedRevision)
Restore selected unit combat stats after owner/revision checks.
Definition RTSAttributes.cpp:91
static eve::Result< void > ensure(Unit &unit)
Bind and seed default optional combat stats exactly once.
Definition RTSAttributes.cpp:24
static eve::Result< eve::attributes::ModifierId > addModifier(Unit &unit, std::string id, std::string_view attribute, std::string source, eve::attributes::AttributeOperation operation, double value, eve::attributes::ModifierPriority priority=eve::attributes::priority::runtime)
Add a modifier using the shared operation/priority/sequence contract.
Definition RTSAttributes.cpp:65
static constexpr std::string_view armorAttribute
Definition RTSAttributes.h:31
static eve::Result< double > read(Unit &unit, std::string_view attribute)
Read one selected combat stat.
Definition RTSAttributes.cpp:42
static eve::Result< eve::attributes::AttributeProjectionSnapshot > snapshot(Unit &unit)
Capture selected unit combat stats with owner generation and revision.
Definition RTSAttributes.cpp:81
static constexpr std::string_view healthAttribute
Definition RTSAttributes.h:29
static constexpr std::string_view maxHealthAttribute
Definition RTSAttributes.h:30
static constexpr std::string_view attackAttribute
Definition RTSAttributes.h:28
AttributeOperation
Built-in calculation operation for an attribute modifier.
Definition AttributeSet.h:25
Definition RTS.cpp:24
@ InvalidArgument
@ Unsupported
@ Failed
@ NoOp
One canonical runtime modifier applied to one named attribute.
Definition AttributeSet.h:96
Transaction-safe snapshot of selected attributes and their modifiers.
Definition AttributeProjection.h:40
One base value captured by an attribute projection snapshot.
Definition AttributeProjection.h:28