载入中...
搜索中...
未找到
eve::rts::RTSUnitAttributeAdapter类 参考final

Defines the small set of RTS unit stats eligible for attributes. 更多...

#include <RTSAttributes.h>

静态 Public 成员函数

static eve::Result< void > ensure (Unit &unit)
 Bind and seed default optional combat stats exactly once.
 
static eve::Result< double > read (Unit &unit, std::string_view attribute)
 Read one selected combat stat.
 
static eve::Result< void > setBase (Unit &unit, std::string_view attribute, double value)
 Set one selected canonical base stat.
 
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.
 
static eve::Result< eve::attributes::AttributeProjectionSnapshot > snapshot (Unit &unit)
 Capture selected unit combat stats with owner generation and revision.
 
static eve::Result< void > restore (Unit &unit, const eve::attributes::AttributeProjectionSnapshot &snapshot, eve::Revision expectedRevision)
 Restore selected unit combat stats after owner/revision checks.
 

静态 Public 属性

static constexpr std::string_view attackAttribute = "attack"
 
static constexpr std::string_view healthAttribute = "health"
 
static constexpr std::string_view maxHealthAttribute = "max_health"
 
static constexpr std::string_view armorAttribute = "armor"
 

详细描述

Defines the small set of RTS unit stats eligible for attributes.

Attack, health, max_health and armor are optional combat facts. Unit position, speed, arrival radius, formation coordinates and order state stay in their dedicated components and are never copied into AttributeSet.

在文件 RTSAttributes.h 第 26 行定义.

成员函数说明

◆ addModifier()

eve::Result< eve::attributes::ModifierId > eve::rts::RTSUnitAttributeAdapter::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 
)
static

Add a modifier using the shared operation/priority/sequence contract.

在文件 RTSAttributes.cpp 第 65 行定义.

引用了 ensure(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Status::failure(), eve::InvalidArgument, operation, priority, source, unit , 以及 value.

◆ ensure()

eve::Result< void > eve::rts::RTSUnitAttributeAdapter::ensure ( Unit &  unit)
static

◆ read()

eve::Result< double > eve::rts::RTSUnitAttributeAdapter::read ( Unit &  unit,
std::string_view  attribute 
)
static

Read one selected combat stat.

在文件 RTSAttributes.cpp 第 42 行定义.

引用了 ensure(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Status::failure(), unit , 以及 eve::Unsupported.

◆ restore()

eve::Result< void > eve::rts::RTSUnitAttributeAdapter::restore ( Unit &  unit,
const eve::attributes::AttributeProjectionSnapshot &  snapshot,
eve::Revision  expectedRevision 
)
static

Restore selected unit combat stats after owner/revision checks.

在文件 RTSAttributes.cpp 第 91 行定义.

引用了 ensure(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Status::failure() , 以及 unit.

被这些函数引用 eve::rts::RTS::restoreState().

◆ setBase()

eve::Result< void > eve::rts::RTSUnitAttributeAdapter::setBase ( Unit &  unit,
std::string_view  attribute,
double  value 
)
static

Set one selected canonical base stat.

在文件 RTSAttributes.cpp 第 55 行定义.

引用了 ensure(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Status::failure(), unit, eve::Unsupported , 以及 value.

◆ snapshot()

eve::Result< eve::attributes::AttributeProjectionSnapshot > eve::rts::RTSUnitAttributeAdapter::snapshot ( Unit &  unit)
static

Capture selected unit combat stats with owner generation and revision.

在文件 RTSAttributes.cpp 第 81 行定义.

引用了 ensure(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::Status::failure() , 以及 unit.

被这些函数引用 eve::rts::RTS::restoreState().

类成员变量说明

◆ armorAttribute

constexpr std::string_view eve::rts::RTSUnitAttributeAdapter::armorAttribute = "armor"
staticconstexpr

在文件 RTSAttributes.h 第 31 行定义.

被这些函数引用 ensure().

◆ attackAttribute

constexpr std::string_view eve::rts::RTSUnitAttributeAdapter::attackAttribute = "attack"
staticconstexpr

在文件 RTSAttributes.h 第 28 行定义.

被这些函数引用 ensure().

◆ healthAttribute

constexpr std::string_view eve::rts::RTSUnitAttributeAdapter::healthAttribute = "health"
staticconstexpr

在文件 RTSAttributes.h 第 29 行定义.

被这些函数引用 ensure().

◆ maxHealthAttribute

constexpr std::string_view eve::rts::RTSUnitAttributeAdapter::maxHealthAttribute = "max_health"
staticconstexpr

在文件 RTSAttributes.h 第 30 行定义.

被这些函数引用 ensure().


该类的文档由以下文件生成: