mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-12-05 08:09:02 +00:00
还原保护机制
This commit is contained in:
parent
607d36e23a
commit
67f357a1cb
@ -487,7 +487,25 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
Character lastProtectedCharacter = list.Last().Character;
|
Character lastProtectedCharacter = list.Last().Character;
|
||||||
double lastProtectedHardnessTime = _hardnessTimes[lastProtectedCharacter];
|
double lastProtectedHardnessTime = _hardnessTimes[lastProtectedCharacter];
|
||||||
|
|
||||||
// 设置新的硬直时间大于保护角色的硬直时间
|
// 查找与最后一个受保护角色相同硬直时间的其他角色
|
||||||
|
var sameHardnessList = _queue
|
||||||
|
.Select((c, index) => new { Character = c, Index = index })
|
||||||
|
.Where(x => _hardnessTimes[x.Character] == lastProtectedHardnessTime && x.Index > protectIndex);
|
||||||
|
|
||||||
|
// 如果找到了相同硬直时间的角色,更新 protectIndex 为它们中最后一个的索引
|
||||||
|
if (sameHardnessList.Any())
|
||||||
|
{
|
||||||
|
protectIndex = sameHardnessList.Select(x => x.Index).Last();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否需要插入到受保护角色的后面
|
||||||
|
// 只有当插入位置在受保护角色之前或相同时才触发保护
|
||||||
|
if (insertIndex != -1 && insertIndex <= protectIndex)
|
||||||
|
{
|
||||||
|
// 插入到受保护角色的后面一位
|
||||||
|
insertIndex = protectIndex + 1;
|
||||||
|
|
||||||
|
// 设置硬直时间为保护角色的硬直时间 + 0.01
|
||||||
hardnessTime = lastProtectedHardnessTime + 0.01;
|
hardnessTime = lastProtectedHardnessTime + 0.01;
|
||||||
hardnessTime = ResolveConflict(hardnessTime, character);
|
hardnessTime = ResolveConflict(hardnessTime, character);
|
||||||
|
|
||||||
@ -498,6 +516,7 @@ namespace Milimoe.FunGame.Core.Model
|
|||||||
WriteLine($"由于 [ {string.Join(" ],[ ", list.Select(x => x.Character))} ] 受到行动保护,因此角色 [ {character} ] 将插入至顺序表第 {insertIndex + 1} 位。");
|
WriteLine($"由于 [ {string.Join(" ],[ ", list.Select(x => x.Character))} ] 受到行动保护,因此角色 [ {character} ] 将插入至顺序表第 {insertIndex + 1} 位。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果插入索引无效(为-1 或 大于等于队列长度),则添加到队列尾部
|
// 如果插入索引无效(为-1 或 大于等于队列长度),则添加到队列尾部
|
||||||
if (insertIndex == -1 || insertIndex >= _queue.Count)
|
if (insertIndex == -1 || insertIndex >= _queue.Count)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user