存档完善和修复
This commit is contained in:
@@ -4,19 +4,19 @@ using BaseGames.Core.Save;
|
||||
namespace BaseGames.Progression
|
||||
{
|
||||
/// <summary>
|
||||
/// 由事件触发的成就条件(使用 World.Switches 中的布尔标志位)。
|
||||
/// 由事件触发的成就条件(使用 EventChains.WorldFlags 中的布尔标志位)。
|
||||
/// 由代码(如剧情节点、NPC 交互)写入标志,AchievementManager 轮询检查。
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "BaseGames/Achievement/Condition/EventTriggered", fileName = "COND_EventTriggered_")]
|
||||
public class EventTriggeredCondition : AchievementCondition
|
||||
{
|
||||
[Tooltip("World.Switches 中用于标记此事件发生的布尔 Key")]
|
||||
[Tooltip("EventChains.WorldFlags 中用于标记此事件发生的布尔 Key")]
|
||||
public string flagKey;
|
||||
|
||||
public override bool IsMet(SaveData save)
|
||||
{
|
||||
if (save?.World?.Switches == null || string.IsNullOrEmpty(flagKey)) return false;
|
||||
return save.World.Switches.TryGetValue(flagKey, out bool val) && val;
|
||||
if (save?.EventChains?.WorldFlags == null || string.IsNullOrEmpty(flagKey)) return false;
|
||||
return save.EventChains.WorldFlags.TryGetValue(flagKey, out bool val) && val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace BaseGames.Progression
|
||||
{
|
||||
/// <summary>
|
||||
/// 无治疗通关成就条件。
|
||||
/// 依赖 World.Switches 中的标志位:AchievementManager 在玩家治疗时写入 noHeal_failed=true。
|
||||
/// 依赖 EventChains.WorldFlags 中的标志位:AchievementManager 在玩家治疗时写入 noHeal_failed=true。
|
||||
/// 满足条件:Boss 已击败 且 无治疗标志未被置入失败状态。
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "BaseGames/Achievement/Condition/NoHealRun", fileName = "COND_NoHealRun_")]
|
||||
@@ -14,7 +14,7 @@ namespace BaseGames.Progression
|
||||
[Tooltip("追踪的 Boss ID(击败此 Boss 时检查是否治疗过)")]
|
||||
public string targetBossId;
|
||||
|
||||
[Tooltip("Switches 中记录「已治疗」失败状态的 Key(由 AchievementManager 设置)")]
|
||||
[Tooltip("WorldFlags 中记录「已治疗」失败状态的 Key(由 AchievementManager 设置)")]
|
||||
public string healFailFlagKey;
|
||||
|
||||
public override bool IsMet(SaveData save)
|
||||
@@ -22,7 +22,7 @@ namespace BaseGames.Progression
|
||||
if (save?.World == null) return false;
|
||||
// Boss 已击败 且 未触发治疗失败标志
|
||||
bool bossDefeated = save.World.DefeatedBossIds.Contains(targetBossId);
|
||||
bool didHeal = save.World.Switches.TryGetValue(healFailFlagKey, out bool val) && val;
|
||||
bool didHeal = save.EventChains?.WorldFlags?.TryGetValue(healFailFlagKey, out bool val) == true && val;
|
||||
return bossDefeated && !didHeal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user