vault backup: 2026-05-31 12:41:10
This commit is contained in:
@@ -0,0 +1,565 @@
|
||||
# AIDM 项目技术分析报告
|
||||
|
||||
> 测试用提示词(标准化,两组完全一致)
|
||||
> 项目:AIDM — UE5.7 修仙 ARPG
|
||||
> 日期:2026-05-30
|
||||
|
||||
---
|
||||
|
||||
# 任务 1:NPC 系统完整架构
|
||||
|
||||
## 1.1 分级机制(A/B/C 三级)
|
||||
|
||||
NPC 分级体系定义在 `LWSNpcTypes.h:111-219` 和设计文档中:
|
||||
|
||||
| 级别 | 数量 | 跨存档保留 | 模拟深度 | 更新频率 |
|
||||
|------|------|-----------|---------|---------|
|
||||
| **A级** | 20~40 | 姓名/外貌/性格/资质永不改变(`IdentitySeedId` 种子驱动) | 完整(情绪/关系/目标/记忆/决策) | 每个时间单位 |
|
||||
| **B级** | 100~300 | 角色定位保留,人物更换 | 中度(目标/关系/基础决策) | 每2~5个时间单位 |
|
||||
| **C级** | 数百~上千 | 无 | 轻度(位置/状态/基础反应) | 按需/低频 |
|
||||
|
||||
关键字段:`FLWSNpcData` 中 `Tier`(`ELWSNpcTier`)、`IdentitySeedId`(A级跨存档种子ID)。C→B 涌现升级通过 `InteractionCount` 和 `SignificanceScore` 追踪。
|
||||
|
||||
## 1.2 决策模型(Utility AI)
|
||||
|
||||
核心文件:`LWSNpcDecisionSystem.h/.cpp`
|
||||
|
||||
**评分公式**(`LWSNpcDecisionSystem.h:19-31`):
|
||||
```
|
||||
BaseScore(a) = Σᵢ NeedRelevance[a][i] × Npc.Needs[i] (i ∈ 6维需求)
|
||||
PersonalityFactor = f(Temperament, Caution, Morality, a)
|
||||
GoalFactor = Π(Goal Type → bonus, a)
|
||||
ScoreWithNoise(a) = BaseScore × PersonalityFactor × GoalFactor + Uniform[0, 0.10]
|
||||
ChosenAction = argmaxₐ ScoreWithNoise(a)
|
||||
```
|
||||
|
||||
**6 维需求**:`Survival / Safety / Social / Power / Resource / Cultivation`,每日衰减(缺乏度↑),存储在 `FLWSNpcData::Needs`(`TArray<float>` 长度固定为6)。
|
||||
|
||||
**7 种高层 Action**:`Wander / GoHome / Cultivate / SeekResource / Socialize / Flee / Hunt`
|
||||
|
||||
**3 种 Behavior**(执行层翻译):
|
||||
- `Idle` → 原地不动
|
||||
- `Wander` → 6邻居随机跳转(20%概率原地不动)
|
||||
- `MoveTo` → 贪心1-hop向目标移动
|
||||
|
||||
**3D 性格**(`LWSNpcPersonalityTypes.h`):`Temperament`(冷→热)、`Caution`(慎→莽)、`Morality`(义→私),影响各 Action 的权重系数。
|
||||
|
||||
**行为持续性**(设计文档 §八,待实施):承诺期 `MinDuration`、完成判定 `IsFinished`、Need 分摊扣减、Stickiness 黏性、Hysteresis 迟滞、中断保护。
|
||||
|
||||
## 1.3 与时间系统的关系
|
||||
|
||||
时间系统定义在 `RPGCommon/Public/Time/RPGGameTimeTypes.h` 和 `RPGGameTimeSubsystem.h`:
|
||||
|
||||
- **日历常量**:12月/年,30天/月,360天/年(`FRPGGameRawTime`)
|
||||
- **驱动方式**:`URPGGameTimeSubsystem::OnGameTimeChanged` 广播,每次 `DeltaDays > 0` 触发
|
||||
- **NPC 模拟入口**:`ULWSNpcSimulationSubsystem::HandleGameTimeChanged` 订阅时间广播 → 按 `DeltaDays` 次调用 `SimulateOneDay()`
|
||||
- **数据流**:
|
||||
```
|
||||
GameTimeSubsystem.OnGameTimeChanged (DeltaDays>0)
|
||||
→ NpcSim.SimulateDays(N)
|
||||
→ 对每个存活 NPC:
|
||||
→ DecisionSystem.DecayNeeds (需求衰减)
|
||||
→ DecisionSystem.DecideAction (评分→选Action→翻译Behavior)
|
||||
→ TickNpcOneDay (Idle/Wander/MoveTo 物理推进)
|
||||
→ SpatialIndex.Move (更新空间索引)
|
||||
→ PushTrail (环形buffer记录轨迹)
|
||||
→ 同格NPC关系建立 / 关系衰减 / 信息传播
|
||||
```
|
||||
|
||||
## 1.4 存档方式
|
||||
|
||||
存档系统定义在 `RPGSaveSystem/Public/RPGSaveSubsystem.h`:
|
||||
|
||||
- **两级存档**:`URPGSaveSystemData`(系统级,槽位列表)+ `URPGSaveDataObject`(玩家级,`TMap<FName, FSaveDataContainer>`)
|
||||
- **接口机制**:各模块通过 `ISaveableInterface` 注册到 `URPGSaveSubsystem`,以 `FName SaveID` 标识
|
||||
- **NPC 数据持久化**:`ULWSNpcSimulationSubsystem` 提供 `GetActiveNpcsCopy()`(返回 `TArray<FLWSNpcData>` 副本)和 `RestoreNpcsFromSave()`(从存档还原),NPC 数据作为 `FLWSNpcData[]` 序列化存入 `FSaveDataContainer`
|
||||
- **玩家数据持久化**:通过 `URPGAttributeSet` + `FRPGCharacterAttributeData` 保存属性,`FRPGSkilllActionPoseTree` 保存技能映射,`FSkilllTreeDataPool` 保存技能树
|
||||
|
||||
---
|
||||
|
||||
# 任务 2:商队 NPC 跨系统依赖分析
|
||||
|
||||
新增「商队 NPC」类型需要修改以下模块:
|
||||
|
||||
## 必须修改的模块
|
||||
|
||||
### 1. LivingWorldSystem 模块
|
||||
|
||||
| 文件 | 修改内容 |
|
||||
|------|---------|
|
||||
| `LWSNpcTypes.h` | `ELWSNpcBehavior` 新增 `Trade`/`Caravan` 枚举值;`FLWSNpcData` 新增字段:`TradeRoute`(起点→终点)、`TradeGoods`(货物数组)、`CaravanOwnerFactionId` |
|
||||
| `LWSNpcPersonalityTypes.h` | `ELWSNpcAction` 新增 `TradeCaravan`;`ELWSNpcNeed` 可能需要新增 `Wealth` 维度;`ELWSNpcGoal` 新增 `TradeGoal` |
|
||||
| `LWSNpcDecisionSystem.h/.cpp` | `NeedRelevance` 矩阵新增 `TradeCaravan` 行;Personality/Goal 权重新增商队相关因子;`ApplyActionToBehavior` 新增 `TradeCaravan → MoveTo` 翻译逻辑 |
|
||||
| `LWSNpcSimulationSubsystem.h/.cpp` | `TickNpcOneDay` 新增 Trade 行为处理(沿路线移动、到达后触发交易结算) |
|
||||
| `LWSNpcGenerator.h/.cpp` | 新增商队生成逻辑(沿贸易路线撒点、分配货物) |
|
||||
| `LWSNpcRelationSubsystem.h/.cpp` | 商队与聚落/势力的交易关系类型 |
|
||||
| `LWSNpcSpatialIndex.h` | 如无结构变化则无需修改 |
|
||||
|
||||
### 2. 势力/聚落模块
|
||||
|
||||
| 文件 | 修改内容 |
|
||||
|------|---------|
|
||||
| `LWSFactionTypes.h` | 势力新增贸易路线数据、商队所有权 |
|
||||
| `LWSSettlementGenerator.h` | 聚落间贸易路线生成(可为商队提供路径) |
|
||||
| `LWSFactionGenerator.h` | 势力初始化时分配商队 |
|
||||
|
||||
### 3. 世界/资源模块
|
||||
|
||||
| 文件 | 修改内容 |
|
||||
|------|---------|
|
||||
| `LWSResourceGenerator.h` | 商队可携带/交易资源类型定义 |
|
||||
| `LWSChronicleSubsystem.h` | 商队到达/被劫事件写入编年史 |
|
||||
|
||||
## 存档结构变化
|
||||
|
||||
**需要变化**:`FLWSNpcData` 新增字段(TradeRoute、TradeGoods 等)会影响序列化。由于 `FLWSNpcData` 是 `USTRUCT` 且直接存储在 `ActiveNpcs`(`TArray<FLWSNpcData>`),新增字段后旧存档将不兼容。需要:
|
||||
|
||||
1. 在 `URPGSaveDataObject::VersionMap` 中递增 NPC 数据版本号
|
||||
2. 提供存档迁移逻辑(`RestoreNpcsFromSave` 中检测旧版本并填充默认值)
|
||||
|
||||
**`FRPGCharacterAttributeData` 和 `URPGAttributeSet`**:如果商队不涉及玩家属性变化,这两处不需要修改。
|
||||
|
||||
## 对 GAS 属性系统的影响
|
||||
|
||||
**直接影响:无。** GAS 属性系统(`URPGAttributeSet`)当前服务于玩家/Actor 角色的战斗属性,而 LivingWorld NPC 是纯数据 `USTRUCT`,不挂载 `AbilitySystemComponent`。
|
||||
|
||||
**间接影响(可选扩展)**:如果未来商队 NPC 需要与玩家发生战斗交互(如劫商队),则需要为商队守卫创建 `RPGAICharacter`(Actor),此时会走 GAS 属性系统。但这属于"商队战斗"子功能,不属于商队基础框架。
|
||||
|
||||
## 涉及文件汇总(约 12 个文件)
|
||||
|
||||
```
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcTypes.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcPersonalityTypes.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcDecisionSystem.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Private/LWSNpcDecisionSystem.cpp
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcSimulationSubsystem.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Private/LWSNpcSimulationSubsystem.cpp
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcGenerator.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Private/LWSNpcGenerator.cpp
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcRelationSubsystem.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSFactionTypes.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSSettlementGenerator.h
|
||||
Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSChronicleSubsystem.h
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 任务 3:「御剑飞行」ActionPose 代码生成
|
||||
|
||||
## 3.1 枚举扩展
|
||||
|
||||
在 `RPGTypes.h:202-260` 的 `ELM_ActionPose` 中,`AirFlying` 已存在,但「御剑飞行」作为一种特殊的战斗移动姿态,建议新增专用枚举值:
|
||||
|
||||
```cpp
|
||||
// RPGTypes.h — 在 AirFlying 之后、AirDodge 之前新增
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class ELM_ActionPose : uint8
|
||||
{
|
||||
// ... 现有值保持不变 ...
|
||||
|
||||
//空行
|
||||
AirFlying,
|
||||
//御剑飞行(战斗移动态,可在飞行中施法/攻击)
|
||||
AirSwordFlying, // <-- 新增
|
||||
//空避
|
||||
AirDodge,
|
||||
// ...
|
||||
};
|
||||
```
|
||||
|
||||
## 3.2 头文件声明
|
||||
|
||||
```cpp
|
||||
// SwordFlyingActionPose.h
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "LogicStateMachine/SDHGAState.h"
|
||||
#include "GameplayTagContainer.h"
|
||||
#include "SwordFlyingActionPose.generated.h"
|
||||
|
||||
/**
|
||||
* 御剑飞行 ActionPose 状态
|
||||
*
|
||||
* 设计要点:
|
||||
* - 继承自 USDHGAState,挂载在 USkillSMInstance 状态机中
|
||||
* - 进入此状态时:角色踩上飞剑,移动速度切换为飞行速度,消耗法力
|
||||
* - 在此状态中:可施放子架势技能(SubPose0~5),如御剑冲刺、御剑斩击
|
||||
* - 退出此状态时:飞剑消散,恢复地面移动速度
|
||||
* - 法力耗尽或受到重击时强制退出
|
||||
*/
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class RPGGAMEPLAYABILITY_API USwordFlyingActionPoseState : public USDHGAState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
USwordFlyingActionPoseState();
|
||||
|
||||
// Begin USDHGAState
|
||||
virtual void OnEnterState(const FGameplayTagContainer& ContextTags) override;
|
||||
virtual void OnExitState(const FGameplayTagContainer& ContextTags) override;
|
||||
virtual void TickState(float DeltaTime) override;
|
||||
// End USDHGAState
|
||||
|
||||
// 御剑飞行专属 GameplayEffect(持续消耗法力、修改移动速度)
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "SwordFlying")
|
||||
TSubclassOf<class UGameplayEffect> SwordFlyingGE;
|
||||
|
||||
// 法力每秒消耗量
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "SwordFlying", meta = (ClampMin = "0"))
|
||||
float ManaCostPerSecond = 5.0f;
|
||||
|
||||
// 飞行移动速度倍率(基于基础 MoveSpeed)
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "SwordFlying", meta = (ClampMin = "1.0"))
|
||||
float FlightSpeedMultiplier = 1.5f;
|
||||
|
||||
// 受击时是否强制退出御剑
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "SwordFlying")
|
||||
bool bForceExitOnHit = true;
|
||||
|
||||
// 最小法力阈值(低于此值强制退出)
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "SwordFlying", meta = (ClampMin = "0"))
|
||||
float MinManaThreshold = 10.0f;
|
||||
|
||||
protected:
|
||||
// 进入时应用的 GE Handle(用于退出时移除)
|
||||
FActiveGameplayEffectHandle ActiveFlyingGEHandle;
|
||||
|
||||
// 检查是否满足持续飞行条件
|
||||
bool CanSustainFlying() const;
|
||||
|
||||
// 获取 OwningCharacter 的属性集
|
||||
class URPGAttributeSet* GetOwnerAttributeSet() const;
|
||||
};
|
||||
```
|
||||
|
||||
## 3.3 关键逻辑实现
|
||||
|
||||
```cpp
|
||||
// SwordFlyingActionPose.cpp
|
||||
#include "SwordFlyingActionPose.h"
|
||||
#include "Character/RPGCharacterBase.h"
|
||||
#include "Character/Attribute/RPGAttributeSet.h"
|
||||
#include "Abilities/RPGAbilitySystemComponent.h"
|
||||
#include "LogicStateMachine/SDHSkillStateMachine.h"
|
||||
|
||||
USwordFlyingActionPoseState::USwordFlyingActionPoseState()
|
||||
{
|
||||
ManaCostPerSecond = 5.0f;
|
||||
FlightSpeedMultiplier = 1.5f;
|
||||
bForceExitOnHit = true;
|
||||
MinManaThreshold = 10.0f;
|
||||
}
|
||||
|
||||
void USwordFlyingActionPoseState::OnEnterState(const FGameplayTagContainer& ContextTags)
|
||||
{
|
||||
Super::OnEnterState(ContextTags);
|
||||
|
||||
ARPGCharacterBase* Owner = Cast<ARPGCharacterBase>(GetOuterActor());
|
||||
if (!Owner) return;
|
||||
|
||||
URPGAbilitySystemComponent* ASC = Owner->GetRPGAbilitySystemComponent();
|
||||
URPGAttributeSet* AttrSet = GetOwnerAttributeSet();
|
||||
if (!ASC || !AttrSet) return;
|
||||
|
||||
// 1. 应用御剑飞行 GE(持续消耗法力 + 移动速度修改)
|
||||
if (SwordFlyingGE)
|
||||
{
|
||||
FGameplayEffectContextHandle Context = ASC->MakeEffectContext();
|
||||
FGameplayEffectSpecHandle Spec = ASC->MakeOutgoingSpec(SwordFlyingGE, 1.0f, Context);
|
||||
if (Spec.IsValid())
|
||||
{
|
||||
ActiveFlyingGEHandle = ASC->ApplyGameplayEffectSpecToSelf(*Spec.Data.Get());
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 标记角色进入御剑飞行状态
|
||||
AttrSet->RPGFlags.AddTag(FGameplayTag::RequestGameplayTag(TEXT("State.ActionPose.SwordFlying")));
|
||||
|
||||
// 3. 播放踩剑动画 / 飞剑视觉效果(此处接入动画蓝图和 Niagara)
|
||||
// Owner->PlayMontageSection(...);
|
||||
}
|
||||
|
||||
void USwordFlyingActionPoseState::OnExitState(const FGameplayTagContainer& ContextTags)
|
||||
{
|
||||
ARPGCharacterBase* Owner = Cast<ARPGCharacterBase>(GetOuterActor());
|
||||
if (!Owner) return;
|
||||
|
||||
URPGAbilitySystemComponent* ASC = Owner->GetRPGAbilitySystemComponent();
|
||||
URPGAttributeSet* AttrSet = GetOwnerAttributeSet();
|
||||
if (!ASC || !AttrSet) return;
|
||||
|
||||
// 1. 移除御剑飞行 GE
|
||||
if (ActiveFlyingGEHandle.IsValid())
|
||||
{
|
||||
ASC->RemoveActiveGameplayEffect(ActiveFlyingGEHandle);
|
||||
ActiveFlyingGEHandle = FActiveGameplayEffectHandle();
|
||||
}
|
||||
|
||||
// 2. 移除状态 Tag
|
||||
AttrSet->RPGFlags.RemoveTag(FGameplayTag::RequestGameplayTag(TEXT("State.ActionPose.SwordFlying")));
|
||||
|
||||
// 3. 恢复地面姿态 → GroundDefault
|
||||
USkillSMInstance* SkillSM = Owner->GetSkillSMInstance();
|
||||
if (SkillSM)
|
||||
{
|
||||
SkillSM->SetDynamicSkillByActionPose(
|
||||
SkillSM->GetDynamicSkillClassByActionPose(ELM_ActionPose::GroundDefault, ELM_SubActionPose::NotSubPose),
|
||||
ELM_ActionPose::GroundDefault,
|
||||
ELM_SubActionPose::NotSubPose
|
||||
);
|
||||
}
|
||||
|
||||
Super::OnExitState(ContextTags);
|
||||
}
|
||||
|
||||
void USwordFlyingActionPoseState::TickState(float DeltaTime)
|
||||
{
|
||||
Super::TickState(DeltaTime);
|
||||
|
||||
// 检查持续飞行条件
|
||||
if (!CanSustainFlying())
|
||||
{
|
||||
// 法力不足或生命值危险 → 强制退出
|
||||
USkillSMInstance* SkillSM = Cast<USkillSMInstance>(GetStateMachineInstance());
|
||||
if (SkillSM)
|
||||
{
|
||||
SkillSM->ConsumeCommandTransmitter(
|
||||
FGameplayTag::RequestGameplayTag(TEXT("SkillTransmitter.QuitState.ForceGround"))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool USwordFlyingActionPoseState::CanSustainFlying() const
|
||||
{
|
||||
URPGAttributeSet* AttrSet = GetOwnerAttributeSet();
|
||||
if (!AttrSet) return false;
|
||||
|
||||
// 法力不足
|
||||
if (AttrSet->GetMana() < MinManaThreshold) return false;
|
||||
|
||||
// 生命值过低
|
||||
if (AttrSet->GetHealth() <= 0.0f) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
URPGAttributeSet* USwordFlyingActionPoseState::GetOwnerAttributeSet() const
|
||||
{
|
||||
ARPGCharacterBase* Owner = Cast<ARPGCharacterBase>(GetOuterActor());
|
||||
if (!Owner) return nullptr;
|
||||
|
||||
URPGAbilitySystemComponent* ASC = Owner->GetRPGAbilitySystemComponent();
|
||||
if (!ASC) return nullptr;
|
||||
|
||||
return const_cast<URPGAttributeSet*>(
|
||||
ASC->GetSet<URPGAttributeSet>()
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## 3.4 注册到 ActionPoseTree
|
||||
|
||||
在 `SystemData.h:113-134` 的 `FRPGSkilllActionPoseTree` 中注册:
|
||||
|
||||
```cpp
|
||||
// 玩家学习御剑飞行技能时:
|
||||
ActionPoseTree.SetActionPoseSkillClass(
|
||||
FLMActionPose(ELM_ActionPose::AirSwordFlying, ELM_SubActionPose::NotSubPose),
|
||||
SwordFlyingSkillSMClass
|
||||
);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 任务 4:「符修」技能效果系统设计 → GAS Effect 映射
|
||||
|
||||
## 4.1 符修核心机制回顾
|
||||
|
||||
来自 `修仙流派.md`:
|
||||
|
||||
- **符修定位**:将法术预先封存于符纸,战斗中瞬发不消耗灵力,但一次性使用
|
||||
- **加成流派**:魔修、鬼修、音修制符时产出 +20%
|
||||
- **道艺等级**:Lv.0~Lv.5(未入门→登峰造极),Lv.3+ 生效流派加成
|
||||
- **产出**:攻击符、防御符、遁术符、控制符、召唤符
|
||||
|
||||
## 4.2 符箓类型 → GAS Effect 映射
|
||||
|
||||
### 类型 A:攻击符(Instant GameplayEffect)
|
||||
|
||||
```
|
||||
攻击符 = UGameplayEffect (DurationPolicy = Instant)
|
||||
├── Modifiers:
|
||||
│ ├── Attribute = RPGAttributeSet.Damage (Magnitude = SetByCaller, Tag = "Data.Talisman.Damage")
|
||||
│ └── Execution = URPGDamageExecution (复用现有伤害结算)
|
||||
├── SetByCaller Magnitudes:
|
||||
│ ├── Data.Damage.Base = 符纸基础伤害
|
||||
│ ├── Data.Damage.Bonus = 符修加成百分比
|
||||
│ └── Data.Damage.Tough = 韧性伤害
|
||||
└── GameplayTags:
|
||||
├── GrantedTags: Effect.Damage.Talisman
|
||||
└── AssetTags: SkillType.Talisman.Attack
|
||||
```
|
||||
|
||||
### 类型 B:防御符(Duration GameplayEffect — 有限时间 Buff)
|
||||
|
||||
```
|
||||
防御符 = UGameplayEffect (DurationPolicy = HasDuration, Duration = 符纸时长)
|
||||
├── Modifiers:
|
||||
│ ├── Attribute = RPGAttributeSet.Shield (ModifierOp = Additive, 护盾值增加)
|
||||
│ ├── Attribute = RPGAttributeSet.DefensePower (ModifierOp = Multiplicitive, 防御力+%)
|
||||
│ └── Attribute = RPGAttributeSet.BlockRate (ModifierOp = Additive, 格挡率+N%)
|
||||
└── GameplayTags:
|
||||
├── GrantedTags: State.Buff.Talisman.Defense
|
||||
└── AssetTags: SkillType.Talisman.Defense
|
||||
```
|
||||
|
||||
### 类型 C:遁术符(Instant + Duration 混合)
|
||||
|
||||
```
|
||||
遁术符 = 两段式:
|
||||
1) Instant GE: 瞬移(位置修改,走 GameplayCue 或直接 SetActorLocation)
|
||||
2) Duration GE: 移速加成 + 闪避率提升(持续 N 秒)
|
||||
├── Modifiers:
|
||||
│ ├── Attribute = RPGAttributeSet.MoveSpeed (Multiplicitive, +x%)
|
||||
│ └── Attribute = RPGAttributeSet.DodgeRate (Additive, +y%)
|
||||
└── Tags: State.Buff.Talisman.Escape
|
||||
```
|
||||
|
||||
### 类型 D:控制符(Duration GameplayEffect — 施加于目标)
|
||||
|
||||
```
|
||||
控制符 = UGameplayEffect (DurationPolicy = HasDuration, 施加于 Enemy ASC)
|
||||
├── Modifiers:
|
||||
│ ├── Attribute = RPGAttributeSet.MoveSpeed (Multiplicitive, -x%, 减速)
|
||||
│ └── Attribute = RPGAttributeSet.AttackPower (Multiplicitive, -y%, 降攻)
|
||||
└── GameplayTags:
|
||||
├── GrantedTags: State.Debuff.Talisman.Snare (定身/减速)
|
||||
└── AssetTags: SkillType.Talisman.Control
|
||||
```
|
||||
|
||||
### 类型 E:召唤符(Infinite Duration GameplayEffect)
|
||||
|
||||
```
|
||||
召唤符 = UGameplayEffect (DurationPolicy = Infinite)
|
||||
├── 触发 GameplayCue → 生成召唤物 Actor
|
||||
├── Granted Abilities: 召唤物专属技能(如傀儡自动攻击)
|
||||
└── Tags: State.Buff.Talisman.Summon
|
||||
```
|
||||
|
||||
## 4.3 符箓消耗机制
|
||||
|
||||
符箓作为一种**可消耗物品**而非技能冷却资源:
|
||||
|
||||
```cpp
|
||||
// FTalismanItemData — 符箓道具数据结构
|
||||
USTRUCT(BlueprintType)
|
||||
struct FTalismanItemData
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// 符箓等级(对应道艺等级 Lv.1~5)
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
int32 TalismanLevel = 1;
|
||||
|
||||
// 对应的 GameplayEffect Class
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
TSubclassOf<UGameplayEffect> EffectClass;
|
||||
|
||||
// 符箓所属大道属性(决定伤害/效果类型标签)
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite)
|
||||
ERPGElementType DaoElement = ERPGElementType::SRT_Fire;
|
||||
|
||||
// 使用符箓 → ApplyGameplayEffectToTarget/Self → 从背包移除 1 张 → 触发 OnTalismanUsed
|
||||
};
|
||||
```
|
||||
|
||||
**关键设计差异**:符箓不是通过 GAS Ability 释放,而是通过**物品系统 Apply Effect**——这确保了"不消耗灵力"的设计意图,因为 `UGameplayEffect` 的 `Cost` 策略可以为空。
|
||||
|
||||
## 4.4 符修专属 GameplayTag 体系
|
||||
|
||||
```
|
||||
SkillType.Talisman.Attack // 攻击符
|
||||
SkillType.Talisman.Defense // 防御符
|
||||
SkillType.Talisman.Escape // 遁术符
|
||||
SkillType.Talisman.Control // 控制符
|
||||
SkillType.Talisman.Summon // 召唤符
|
||||
|
||||
Effect.Damage.Talisman // 符箓伤害来源标记
|
||||
State.Buff.Talisman.Defense // 符箓防御 Buff
|
||||
State.Buff.Talisman.Escape // 符箓遁术 Buff (MoveSpeed/Dodge)
|
||||
State.Debuff.Talisman.Snare // 符箓减速 Debuff
|
||||
State.Buff.Talisman.Summon // 符箓召唤 Buff
|
||||
|
||||
DaoElement.Fire.Talisman // 火系符箓
|
||||
DaoElement.Water.Talisman // 水系符箓
|
||||
// ... 按大道属性细分
|
||||
|
||||
Profession.Talisman.Specialist // 符修身份标签(挂载到 RPGFlags)
|
||||
```
|
||||
|
||||
## 4.5 属性映射汇总
|
||||
|
||||
| 符修机制 | GAS 组件 | 涉及属性 |
|
||||
|---------|---------|---------|
|
||||
| 攻击符 | `Instant GE` + `URPGDamageExecution` | Damage, AttackPowerMin/Max, FatalRate, ElementFire... |
|
||||
| 防御符 | `Duration GE` | Shield, DefensePower, BlockRate |
|
||||
| 遁术符 | `Instant GE` (位移) + `Duration GE` | MoveSpeed, DodgeRate |
|
||||
| 控制符 | `Duration GE` (施加目标) | MoveSpeed (减益), AttackPower (减益) |
|
||||
| 召唤符 | `Infinite GE` + `GameplayCue` | — (生成 Actor) |
|
||||
| 符纸消耗 | 物品系统 `URPGItemDataAsset` | — (从背包移除) |
|
||||
| 制符加成 | `CraftingSkillData` + Modifier | 产出数量 ×1.2(流派加成) |
|
||||
| 符修身份 | `RPGFlags` GameplayTag | `Profession.Talisman.Specialist` |
|
||||
|
||||
**核心洞察**:符修的 GAS 映射极简——不需要自定义 `ExecutionCalculation`,不需要新建 `AttributeSet`,不需要修改 `SDHGameplayAbility`。它完全依赖现有的 `UGameplayEffect` + `GameplayTag` + 物品系统三层即可实现,是十个修仙流派中与现有 GAS 架构耦合度最低的一个。
|
||||
|
||||
---
|
||||
|
||||
# 附录:项目关键文件索引
|
||||
|
||||
## 架构文档
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `.trae/documents/02_程序架构/spec.md` | 总体架构(表现层/游戏逻辑/核心框架/引擎) |
|
||||
| `.trae/documents/02_程序架构/spec_modules.md` | 模块详细规格 |
|
||||
| `.trae/specs/LivingWorldSystem/spec.md` | LivingWorld 系统完整规格 |
|
||||
|
||||
## NPC 系统
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `.trae/documents/01_策划设计/NPC系统与势力/NPC系统设计.md` | NPC 模拟系统完整设计 |
|
||||
| `Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcTypes.h` | NPC 数据结构(FLWSNpcData) |
|
||||
| `Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcPersonalityTypes.h` | 性格/目标/秘密/Need/Action 定义 |
|
||||
| `Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcSimulationSubsystem.h` | 模拟主循环 |
|
||||
| `Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcDecisionSystem.h` | 决策系统(Utility AI) |
|
||||
| `Plugins/RPGGameCore/Source/LivingWorldSystem/Public/LWSNpcRelationSubsystem.h` | 关系网络 |
|
||||
|
||||
## GAS / 属性系统
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/Character/Attribute/RPGAttributeSet.h` | 单一属性容器(5子集) |
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/Character/Attribute/RPGAttributeData.h` | ERPGPhase 境界枚举、灵根 |
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/Config/RPGDamageExecution.h` | GAS 伤害结算 |
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/Abilities/SDHGameplayAbility.h` | 技能基类 |
|
||||
|
||||
## ActionPose / 技能系统
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/RPGTypes.h` | ELM_ActionPose 枚举、FLMActionPose |
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/System/SystemData.h` | FRPGSkilllActionPoseTree |
|
||||
| `Plugins/RPGGameCore/Source/RPGGameplayAbility/Public/LogicStateMachine/SDHSkillStateMachine.h` | 技能状态机 |
|
||||
|
||||
## 修仙设计文档
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `.trae/documents/01_策划设计/修仙基础概念设定/修仙概念体系.md` | 流派/道艺/大道属性三层体系 |
|
||||
| `.trae/documents/01_策划设计/修仙基础概念设定/修仙流派.md` | 十大流派详细设计 |
|
||||
| `.trae/documents/01_策划设计/修仙基础概念设定/大道元素属性.md` | 37种大道属性 |
|
||||
Reference in New Issue
Block a user