25#include <unordered_map>
40 void
release()
override { ecs::DestroyEntity(
this); }
60 std::unordered_map<std::string, StatusExecutorMetadata>
metadata;
63 int nextInstanceId = 1;
68 std::unordered_map<std::string, SkillRuntime>
known;
76 double xpToNext = 100.0;
84 std::unordered_map<std::string, double>
current;
97 int nextInstanceId = 1;
103 int skillsSyncedUpTo = 0;
133 void setBaseAttribute(
const std::string &attribute,
double value);
134 double getBaseAttribute(
const std::string &attribute);
135 void modifyBaseAttribute(
const std::string &attribute,
double delta);
136 bool hasAttribute(
const std::string &attribute);
140 std::string addAttributeModifier(
const std::string &attribute,
const std::string &
source,
const std::string &op,
144 bool removeAttributeModifier(
const std::string &attribute,
const std::string &modifierId);
145 int removeAttributeModifiersBySource(
const std::string &attribute,
const std::string &
source);
146 int removeAllAttributeModifiersBySource(
const std::string &
source);
147 double getFinalAttribute(
const std::string &attribute);
150 int applyEffect(
const std::string &effectId,
const std::string &
source =
"");
151 bool removeStatus(
int instanceId);
152 int removeStatusByEffect(
const std::string &effectId);
153 int removeStatusBySource(
const std::string &
source);
154 int removeStatusByTag(
const std::string &
tag);
155 bool hasEffect(
const std::string &effectId);
156 bool hasStatusTag(
const std::string &
tag);
157 int getStatusCount();
158 std::string getStatusEffectId(
int index);
159 int getStatusStacks(
int index);
160 float getStatusRemaining(
int index);
161 int getStatusInstanceId(
int index);
162 std::string getStatusSource(
int index);
163 std::string getStatusProp(
int instanceId,
const std::string &
key,
164 const std::string &fallback = {});
165 bool setStatusProp(
int instanceId,
const std::string &
key,
const std::string &
value);
168 int applyBuff(
const std::string &effectId,
const std::string &
source =
"");
169 bool removeBuff(
int instanceId);
170 int removeBuffByEffect(
const std::string &effectId);
171 int removeBuffBySource(
const std::string &
source);
172 int removeBuffByTag(
const std::string &
tag);
173 bool hasBuff(
const std::string &effectId);
174 bool hasBuffTag(
const std::string &
tag);
176 std::string getBuffEffectId(
int index);
177 int getBuffStacks(
int index);
178 float getBuffRemaining(
int index);
179 int getBuffInstanceId(
int index);
180 std::string getBuffSource(
int index);
181 std::string getBuffProp(
int instanceId,
const std::string &
key,
182 const std::string &fallback = {});
183 bool setBuffProp(
int instanceId,
const std::string &
key,
const std::string &
value);
186 void learnSkill(
const std::string &skillId);
187 bool knowsSkill(
const std::string &skillId);
188 bool forgetSkill(
const std::string &skillId);
189 float getSkillCooldown(
const std::string &skillId);
190 void setSkillCooldown(
const std::string &skillId,
float seconds);
191 bool canCastSkill(
const std::string &skillId);
193 std::string canCastSkillReason(
const std::string &skillId);
195 bool beginCastSkill(
const std::string &skillId, RPGActor *
target =
nullptr);
197 void cancelCastSkill();
199 bool isCastingSkill();
200 std::string getCastingSkillId();
201 float getCastProgress();
206 double getXpToNext();
207 void setXpToNext(
double value);
221 bool gainXp(
double amount);
224 double getCurrent(
const std::string &
resource);
225 double getMax(
const std::string &
resource);
227 double takeDamage(
const std::string &
resource,
double amount,
const std::string &
source =
"");
228 double heal(
const std::string &
resource,
double amount);
229 void revive(
const std::string &
resource,
double amount = -1.0);
230 bool isDead(
const std::string &
resource);
233 int applyTrait(
const std::string &traitId,
const std::string &
source =
"");
235 bool removeTrait(
int instanceId);
236 int removeTraitsBySource(
const std::string &
source);
237 int removeTraitsByTrait(
const std::string &traitId);
238 bool hasTrait(
const std::string &traitId);
240 int getTraitInstanceIdAt(
int index);
241 std::string getTraitIdAt(
int index);
242 std::string getTraitSourceAt(
int index);
243 double getParamRate(
const std::string ¶m);
244 double getElementRate(
const std::string &
element);
245 double getStateRate(
const std::string &stateId);
246 bool isStateResist(
const std::string &stateId);
247 double getExParam(
const std::string &exParam);
248 double getAttackSpeed();
249 int getAttackTimesAdd();
250 std::vector<std::string> getAttackElements();
251 std::vector<std::string> getAttackStates();
255 bool setClass(
const std::string &
classId);
256 std::string getClassId();
257 bool hasClass(
const std::string &
classId);
258 int checkLevelSkills();
259 int getClassLearnCount();
260 std::string getClassLearnSkillIdAt(
int index);
261 int getClassLearnLevelAt(
int index);
296 static const std::vector<RPGActor *> &liveActors();
299 struct CheckpointCandidate {
300 Attributes attributes;
302 Progression progression;
308 void commitCheckpoint(CheckpointCandidate candidate)
noexcept;
RPG compatibility names for the canonical attributes data model.
std::map< std::string, Var > values
#define EVENGINE_API_PLATFORM
std::function< eve::Result< void >()> release
const UnitySourceAsset & source
Move-only operation result carrying either a value or Status.
Generic owning collection of canonical attributes and modifiers.
Owns active effect instances and their deterministic lifecycle events.
Authoritative ordered relationship between stable party member IDs and RPG actors....
属性 / 状态 / 技能三表合一的 ECS 实体。
A non-owning save boundary for the persistent classic-RPG state owners.
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
::eve::attributes::ModifierId ModifierId
One canonical runtime modifier applied to one named attribute.
施法状态:同一时间每个 actor 只有一个进行中的引导/读条(可按需扩展为多槽)。
属性组件:AttributeSet 是属性状态与计算的唯一权威真源。
Attributes()
Constructs a Attributes.
::eve::attributes::AttributeSet values
职业:当前职业 id + 已同步学技能的等级上限。
std::unordered_map< std::string, SkillRuntime > known
Status lifecycle component backed by the generic effects container.
std::unordered_map< std::string, int > legacyIdByEffect
::eve::effects::EffectContainer container
std::unordered_map< std::string, StatusExecutorMetadata > metadata
std::unordered_map< int, std::string > effectByLegacyId
该 actor 的活动特征列表(TraitSystem 读写)。
std::vector< TraitInstance > active
当前资源(hp / mana ...):current 是运行时瞬时值,上限取同名最终属性。 max 由 attributes 推导(getFinalAttribute(resource)),本组件只存...
std::unordered_map< std::string, double > current