载入中...
搜索中...
未找到
BattleSystem.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
14#include "common/Result.h"
15
16#include <string>
17#include <vector>
18
19namespace eve::rpg {
20
21class RPGActor;
22
26 std::string damageType = "hp";
28 std::string formula;
30 std::string element;
31 double critChance = 0.0;
32 int hitChance = 100;
33};
34
37 double amount = 0.0;
38 bool crit = false;
39 bool hit = true;
40 double elementRate = 1.0;
41};
42
48public:
57 [[nodiscard]] static eve::Result<void> registerSkillDamageChecked(const std::string &skillId,
58 const SkillDamageSpec &spec);
60 static void registerSkillDamage(const std::string &skillId, const SkillDamageSpec &spec);
62 static const SkillDamageSpec *findSkillDamage(const std::string &skillId);
64 static void clearSkillDamage();
65
70 static double evaluateFormula(const std::string &formula, RPGActor *attacker, RPGActor *target);
71
78 [[nodiscard]] static eve::Result<double> evaluateFormulaChecked(const std::string &formula,
79 RPGActor *attacker, RPGActor *target);
80
85 static DamageResult resolveHit(RPGActor *attacker, RPGActor *target,
86 const SkillDamageSpec &spec, unsigned seed);
87};
88
89} // namespace eve::rpg
LogicalId target
#define EVENGINE_API_PLATFORM
Definition Export.h:107
std::uint32_t seed
Definition PointSet.cpp:807
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
战斗数值:公式求值 + 技能伤害注册 + 结算。 @thread 纯计算,可在任意线程执行。
属性 / 状态 / 技能三表合一的 ECS 实体。
Definition RPGActor.h:34
RPG 模块的基础实体:把属性 / 状态 / 技能三张表挂到一个 ECS 实体上。
一次命中结算结果。
一次技能命中的伤害规格。
double critChance
追加到攻击方 critRate 的暴击率
int hitChance
命中率(百分比)
std::string formula
公式字符串,如 "a.atk * 4 - b.def * 2";空则对 hp 用默认物理公式。
std::string damageType
"hp" | "hpHeal" | "mp" | "mpHeal"。
std::string element
元素("" = 无);伤害乘目标对应元素耐性。