载入中...
搜索中...
未找到
AttributeSystem.cpp
浏览该文件的文档.
15 return eve::Result<ModifierId>::failure(invalidArgument("attribute operation requires an actor", "actor"));
19 return eve::Result<void>::failure(invalidArgument("attribute operation requires an actor", "actor"));
23 return eve::Result<int>::failure(invalidArgument("attribute operation requires an actor", "actor"));
49eve::Result<ModifierId> AttributeSystem::addModifier(RPGActor* actor, AttributeModifier modifier) {
54std::string AttributeSystem::addModifier(RPGActor* actor, const std::string& attribute, const std::string& source,
81eve::Result<void> AttributeSystem::removeModifier(RPGActor* actor, const ModifierId& modifierId) {
86bool AttributeSystem::removeModifier(RPGActor* actor, const std::string& attribute, const std::string& modifierId) {
92eve::Result<int> AttributeSystem::removeModifiersBySource(RPGActor* actor, const std::string& attribute,
99 auto result = actor ? actor->attributes()->values.removeBySource(source) : actorRequiredCount(actor);
RPG's thin compatibility facade over the attributes module.
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
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
Registry for explicitly named custom attribute policies.
Definition AttributeSet.h:67
static void setBase(RPGActor *actor, const std::string &attribute, double value)
Set a base value; invalid actor or attribute is a compatibility no-op.
Definition AttributeSystem.cpp:33
static bool hasAttribute(RPGActor *actor, const std::string &attribute)
Query whether an attribute exists on the actor.
Definition AttributeSystem.cpp:45
static eve::Result< int > removeModifiersBySource(RPGActor *actor, const std::string &attribute, const std::string &source)
Remove source modifiers with a structured count result.
Definition AttributeSystem.cpp:92
static void modifyBase(RPGActor *actor, const std::string &attribute, double delta)
Add a delta to a base value.
Definition AttributeSystem.cpp:41
static void invalidate(RPGActor *actor, const std::string &attribute)
Mark a canonical attribute value dirty for its next built-in read.
Definition AttributeSystem.cpp:107
static double getBase(RPGActor *actor, const std::string &attribute)
Read a base value, returning zero for a missing actor/attribute.
Definition AttributeSystem.cpp:37
static int removeAllModifiersBySource(RPGActor *actor, const std::string &source)
Compatibility all-attribute source removal facade.
Definition AttributeSystem.cpp:98
static double getFinal(RPGActor *actor, const std::string &attribute)
Compute the final value through the canonical attributes engine.
Definition AttributeSystem.cpp:103
static AttributeOpTable & customOps()
Process-wide custom policy registry used only for Custom modifiers.
Definition AttributeSystem.cpp:28
static eve::Result< ModifierId > addModifier(RPGActor *actor, AttributeModifier modifier)
Add one canonical modifier to an actor.
Definition AttributeSystem.cpp:49
static eve::Result< void > removeModifier(RPGActor *actor, const ModifierId &modifierId)
Remove by canonical modifier id with a structured result.
Definition AttributeSystem.cpp:81
eve::Result< ParsedAttributeOperation > parseAttributeOperation(std::string_view operation, double value)
Parse a built-in operation spelling used by existing data and APIs.
Definition AttributeSet.cpp:34
@ InvalidArgument
One canonical runtime modifier applied to one named attribute.
Definition AttributeSet.h:96
AttributeOperation operation
Definition AttributeSet.h:100