载入中...
搜索中...
未找到
Skill.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
4
5
6// 技能系统:数据驱动的 SkillDefinition(消耗、冷却、读条时间、命中后授予的效果……)。
7//
8// 灵活性/可定制点:
9// - targetType 是自由字符串("self"/"single"/"area"/... 或游戏自定义值),
10// 引擎不解释其含义——具体的目标选取逻辑完全由脚本/游戏代码实现,
11// SkillSystem 只负责冷却/消耗/读条与授予效果的通用流程。
12// - extra 字段是任意 string->string 的自定义数据(动画名、投射物速度……),
13// 不需要为每个新技能特性修改引擎结构体。
14// - 消耗使用 common/resource 的 CostSpec,可以是内建的 "mana",也可以是
15// 任何自定义资源;RPG 不再维护一份私有 Cost 类型。
16
17#include "common/Condition.h"
20
21#include <optional>
22#include <string>
23#include <unordered_map>
24#include <vector>
25
26namespace eve::rpg {
27
30 std::string id;
31 float cooldown = 0.f;
32 float castTime = 0.f;
33 std::string targetType = "self";
35 std::optional<eve::resource::CostSpec> cost;
36 std::vector<std::string> grantedEffects;
37 std::vector<std::string> tags;
40 std::unordered_map<std::string, std::string> extra;
41
43 EVENGINE_API_PLATFORM bool hasTag(const std::string& tag) const;
44};
45
48public:
55 [[nodiscard]] static eve::definitions::DefinitionRegistry &definitionRegistry();
56
57 static void registerSkill(const SkillDefinition &def);
66 static const SkillDefinition *find(const std::string &id);
68 static bool remove(const std::string &id);
70 static void clear();
72 static int count();
73
83 static int loadFromJson(const std::string &json, std::string *error = nullptr);
84};
85
86} // namespace eve::rpg
Pure, explainable condition trees shared by gameplay domains.
#define EVENGINE_API_PLATFORM
Definition Export.h:107
const std::string * tag
std::string error
Definition Package.cpp:174
Strongly typed, transaction-friendly resource cost protocol.
int count
Share string attribute map operations through the Windows Foundation DLL.
Immutable condition AST node.
Definition Condition.h:199
Deterministic registry of topic-neutral, versioned JSON definitions.
Definition Definitions.h:58
EVENGINE_API_PLATFORM public API.
Definition Skill.h:47
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
SkillDefinition public API.
Definition Skill.h:29
std::vector< std::string > tags
Definition Skill.h:37
float castTime
0 = 瞬发
Definition Skill.h:32
EVENGINE_API_PLATFORM bool hasTag(const std::string &tag) const
True when tag.
Definition Skill.cpp:69
std::string targetType
Definition Skill.h:33
std::vector< std::string > grantedEffects
命中/释放后施加给目标的效果 id 列表
Definition Skill.h:36
eve::condition::Condition castCondition
Side-effect-free condition tree required before this skill can cast.
Definition Skill.h:39
std::unordered_map< std::string, std::string > extra
游戏自定义附加数据
Definition Skill.h:40
std::optional< eve::resource::CostSpec > cost
Canonical resource cost; AttributeSet is an adapter, not a second cost model.
Definition Skill.h:35